170 likes | 187 Views
Explore SDL, OIS, and CEGUI input toolkits for cross-platform game development. Learn about features, pros and cons, and practical application. Use Ogre for seamless integration.
E N D
Input Zhaohui Ning Aaron Cardwell Boonthanome Nouanesengsy
Outline • Ogre Input • Other input toolkits • SDL • OIS • CEGUI
Ogre Input • Not supported well • Does not support joysticks • Inconsistent • Use 0, 1, 2 or a mask to determine mouse button • Mouse event in mouseDragged always returns 0
SDL • Simple DirectMedia Layer • Provides low level access to audio, keyboard, mouse, and video • Cross-platform
SDL Input • Keyboard Input • Mouse Input • Joystick Input
Example Code SDL_Event event; while(SDL_PollEvent(&event)) { switch(event.type) { case SDL_KEYDOWN: out<<"Oh! Key press\n"; break; case SDL_MOUSEMOTION: out<<"Mouse Motion\n"; break; case SDL_QUIT: i=-1; break; default: out<<"I don't know what this event is!\n"; } }
SDL with Ogre • Requires DirectX to compile • SDL wants to create its own window • Must tell SDL to use the Ogre window
OIS Object Oriented Input System Phillip Castaneda zlib/libpng License 0.6.0 MS Windows, Linux
Manual WreckedLibs:OIS:Manual Mouse Keyboard Joystick
Compiling Official ReleaseFFTestErrors.txtFix An OIS InputManager available on Wiki http://www.ogre3d.org/wiki/index.php/Using_OIS Practical Application - Let's Get Started A working version Basic Tutorial 5
CEGUI • CEGUI (Crazy Eddies Graphical User Interface) • Free graphical interface for graphics API’s which do not have or have a lacking graphical interface system • Combines graphical 2D overlaying displays with mouse input interfaces for the user
CEGUI • Pro’s • Free for use under LGPL licensing • Already integrated in Ogre3D • Tutorials provided in OgreSDK and Ogre’s Wiki on using CEGUI with Ogre • Good responsive forums • Decent wiki with documentation for CEGUI classes and tutorials
CEGUI • Cons • Random “holes” in documentation and tutorials but you can still figure most things out from forums • Large amount of external script files to compose a “Look” and a “scheme” are complicated • .scheme, .lookNfeel, .imageset, .layout
CEGUI • Cons (Cont.) • One major con of CEGUI is its problem in slow speed with lots of windows and elements as noticed in the provided ogre + CEGUI sample. • Child windows with lots of events and elements cause a messaging slowdown because of the cascading mouse move events
CEGUI • Solution to slowness of many layouts • Be careful and weary of using large CEGUI windows. • Efficiently group smaller child windows to exclude unnecessary checks on mouse enter/exits
CEGUI • Features • Easily displayable overlays with a multitude of functionality • Static images, text boxes, buttons • Use of XML to import layouts from a easily changeable file • Build your own layouts into xml files using their “official” layout editor
CEGUI • Features of using the editor • Very easy setup of the layout of a graphical display • Tree structure and snap-able grid for layout modification • Downfalls of using the editor • No ability to add specific images • Must still manually code in the event function calls • Missing attributes in the editor