Video processingiimavlib provides several video data types. There are also some basic video operations. SDLDeviceFor video related operations, iimavlib provides lightweight wrapper around SDL library, in the class SDLDevice. Signature of the constructor is: SDLDevice(size_t width, size_t height, const std::string& title = "IIMAudio application", bool fullscreen = false); The first two mandatory parameters (width and height) define dimensions of the application window. Parameter title defines the title of the window. When the parameter fullscreen is set to true, the application will try to start in fullscreen rather than in a window. For simple drawing you need to use only a single method: SDLDevice::blit. It's signature is: bool blit(const video_buffer_t&, rectangle_t position);
Input (keyboard, mouse)If you intend to handle keyboard events, you have to inherit from the SDLDevice class and implement methods handling the input events. An example how to use them is in the example called sdl_drums in the library package (either in the binary form and the source one).
All the method return a boolean value. If the returned value is false, then the application will end. do_key_pressedThis method is called for every key press or release event. The parameter key defined the key that was pressed (you can find definitions of the keys in include/iimavlib/keys). When parameter pressed is true then the key was pressed, when it's false then the key wa released. do_mouse_buttonThis method is called for every mouse button. key means the button index, pressed has the same meaning as in do_key_pressed. Parameters x and y mean position of mouse when the button was pressed. do_mouse_movedThis method is called when mouse is moved. Parameters x and y mean the new position of the mouse, parameters rel_x and rel_y mean relative mouse movement since last event. |