Difference between revisions of "Component: Display Manager (Graphical Library)"
Line 5: | Line 5: | ||
|- | |- | ||
| width="20%" style="color:gray;" | Version | | width="20%" style="color:gray;" | Version | ||
− | | | + | | 2.0 |
|- | |- | ||
| width="20%" style="color:gray;" | Category | | width="20%" style="color:gray;" | Category | ||
Line 14: | Line 14: | ||
==Display Manager component== | ==Display Manager component== | ||
A component designed to simplify the process of drawing primitives and text onto a graphical display. Keeps track of coordinates so you don't have to. Also works great as a base layer for gLCD based games as it will check for collisions and perform movement. | A component designed to simplify the process of drawing primitives and text onto a graphical display. Keeps track of coordinates so you don't have to. Also works great as a base layer for gLCD based games as it will check for collisions and perform movement. | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
==Detailed description== | ==Detailed description== | ||
Line 66: | Line 60: | ||
{{Fcfile|DisplayManagerExample.fcfx|Display Manager Example}} | {{Fcfile|DisplayManagerExample.fcfx|Display Manager Example}} | ||
+ | |||
+ | |||
Line 78: | Line 74: | ||
==Macro reference== | ==Macro reference== | ||
+ | |||
+ | ===CheckForTouch=== | ||
+ | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
+ | |- | ||
+ | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | ||
+ | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''CheckForTouch''' | ||
+ | |- | ||
+ | | colspan="2" | Uses the X and Y coordinates from a touch sensor to check for button presses. Returns 0 for no buttons pressed. Returns 1 for a valid button press. The ID of the pressed item can be found by calling GetButtonID macro. Any touched slider buttons will automatically move their thumb and value to the touch position. | ||
+ | |- | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT | ||
+ | | width="90%" | X | ||
+ | |- | ||
+ | | colspan="2" | | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT | ||
+ | | width="90%" | Y | ||
+ | |- | ||
+ | | colspan="2" | | ||
+ | |- | ||
+ | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-bool-icon.png]] - BOOL | ||
+ | | width="90%" style="border-top: 2px solid #000;" | ''Return'' | ||
+ | |} | ||
+ | |||
+ | |||
+ | ===ClearAll=== | ||
+ | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
+ | |- | ||
+ | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | ||
+ | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ClearAll''' | ||
+ | |- | ||
+ | | colspan="2" | Removes all objects and buttons from memory. Also clears the screen if required. | ||
+ | |- | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-bool-icon.png]] - BOOL | ||
+ | | width="90%" | ClearScreen | ||
+ | |- | ||
+ | | colspan="2" | 0=Don't clear the screen, 1=Clear the screen | ||
+ | |- | ||
+ | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID | ||
+ | | width="90%" style="border-top: 2px solid #000;" | ''Return'' | ||
+ | |} | ||
+ | |||
+ | |||
+ | ===CreateButton=== | ||
+ | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
+ | |- | ||
+ | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | ||
+ | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''CreateButton''' | ||
+ | |- | ||
+ | | colspan="2" | Define an interactive button or slider. Returns the Button ID. | ||
+ | |- | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | ||
+ | | width="90%" | ButtonType | ||
+ | |- | ||
+ | | colspan="2" | 0=ButtonHidden, 1=ButtonRect, 2=ButtonRoundedRect, 3=ButtonEllipse, 4=VSlider, 5=HSlider, 6=VSliderRound, 7=HSliderRound | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT | ||
+ | | width="90%" | X | ||
+ | |- | ||
+ | | colspan="2" | X Pixel Coordinate | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT | ||
+ | | width="90%" | Y | ||
+ | |- | ||
+ | | colspan="2" | Y Pixel Coordinate | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT | ||
+ | | width="90%" | Width | ||
+ | |- | ||
+ | | colspan="2" | Pixel Width or X Radius | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT | ||
+ | | width="90%" | Height | ||
+ | |- | ||
+ | | colspan="2" | Pixel Height or Y Radius | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | ||
+ | | width="90%" | Theme | ||
+ | |- | ||
+ | | colspan="2" | Theme index to use to draw the button | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-bool-icon.png]] - BOOL | ||
+ | | width="90%" | DrawButton | ||
+ | |- | ||
+ | | colspan="2" | 0=Do not draw button yet, 1=Draw button now | ||
+ | |- | ||
+ | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u16-icon.png]] - UINT | ||
+ | | width="90%" style="border-top: 2px solid #000;" | ''Return'' | ||
+ | |} | ||
+ | |||
===CreateObject=== | ===CreateObject=== | ||
Line 85: | Line 173: | ||
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''CreateObject''' | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''CreateObject''' | ||
|- | |- | ||
− | | colspan="2" | Define | + | | colspan="2" | Define a none touchable graphical object. Returns the Object ID. |
|- | |- | ||
|- | |- | ||
− | | width="10%" align="center" | [[File:Fc9- | + | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE |
| width="90%" | ObjectType | | width="90%" | ObjectType | ||
|- | |- | ||
− | | colspan="2" | 0= | + | | colspan="2" | 0=Hidden, 1=Rect, 2=Line, 3=Ellipse, 4=FilledEllipse, 5=FilledRect |
|- | |- | ||
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT | | width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT | ||
Line 112: | Line 200: | ||
|- | |- | ||
| colspan="2" | Pixel Height or Y Radius | | colspan="2" | Pixel Height or Y Radius | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | ||
+ | | width="90%" | Theme | ||
+ | |- | ||
+ | | colspan="2" | Theme index to use to draw the object | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-bool-icon.png]] - BOOL | ||
+ | | width="90%" | DrawObject | ||
+ | |- | ||
+ | | colspan="2" | 0=Do not draw object yet, 1=Draw object now | ||
|- | |- | ||
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u16-icon.png]] - UINT | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u16-icon.png]] - UINT | ||
Line 118: | Line 216: | ||
− | === | + | ===DrawAll=== |
{| class="wikitable" style="width:60%; background-color:#FFFFFF;" | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
|- | |- | ||
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | ||
− | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | ''' | + | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''DrawAll''' |
|- | |- | ||
− | | colspan="2" | Draws a single object onto the display without clearing the display. Doesn't draw a textfield component, this is done using the SetObjectText macro. | + | | colspan="2" | Redraws all of the defined Objects and Buttons. Doesn't draw text, this is done using the SetText macro. |
+ | |- | ||
+ | |- | ||
+ | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID | ||
+ | | width="90%" style="border-top: 2px solid #000;" | ''Return'' | ||
+ | |} | ||
+ | |||
+ | |||
+ | ===DrawItem=== | ||
+ | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
+ | |- | ||
+ | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | ||
+ | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''DrawItem''' | ||
+ | |- | ||
+ | | colspan="2" | Draws a single object or button onto the display without clearing the display. Doesn't draw a textfield component, this is done using the SetObjectText macro. | ||
|- | |- | ||
|- | |- | ||
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT | | width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT | ||
− | | width="90%" | | + | | width="90%" | ID |
|- | |- | ||
− | | colspan="2" | | + | | colspan="2" | Unique ID of the Object or Button |
|- | |- | ||
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID | ||
Line 137: | Line 249: | ||
− | === | + | ===GetLastTouchID=== |
+ | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
+ | |- | ||
+ | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | ||
+ | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''GetLastTouchID''' | ||
+ | |- | ||
+ | | colspan="2" | Gets the ID of the last button that returned a valid press via the CheckForTouch macro. Returns -1 for valid touch recorded. | ||
+ | |- | ||
+ | |- | ||
+ | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-s16-icon.png]] - INT | ||
+ | | width="90%" style="border-top: 2px solid #000;" | ''Return'' | ||
+ | |} | ||
+ | |||
+ | |||
+ | ===GetSliderValue=== | ||
{| class="wikitable" style="width:60%; background-color:#FFFFFF;" | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
|- | |- | ||
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | ||
− | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | ''' | + | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''GetSliderValue''' |
|- | |- | ||
− | | colspan="2" | | + | | colspan="2" | Reads the value of one of the sliders ranging between 0 and 1. |
|- | |- | ||
|- | |- | ||
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT | | width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT | ||
− | | width="90%" | | + | | width="90%" | ButtonID |
|- | |- | ||
| colspan="2" | | | colspan="2" | | ||
|- | |- | ||
− | | width="10%" align="center" | [[File:Fc9- | + | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-f32-icon.png]] - FLOAT |
− | | width="90%" | | + | | width="90%" style="border-top: 2px solid #000;" | ''Return'' |
+ | |} | ||
+ | |||
+ | |||
+ | ===Initialise=== | ||
+ | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
|- | |- | ||
− | | | + | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] |
+ | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Initialise''' | ||
|- | |- | ||
− | | | + | | colspan="2" | Initialises the object and button control variables and sets up the default themes. |
− | |||
|- | |- | ||
− | |||
|- | |- | ||
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID | ||
Line 166: | Line 296: | ||
− | === | + | ===ModifyPosition=== |
{| class="wikitable" style="width:60%; background-color:#FFFFFF;" | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
|- | |- | ||
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | ||
− | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | ''' | + | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ModifyPosition''' |
+ | |- | ||
+ | | colspan="2" | Moves an existing object or button to absolute coordinates on the screen. | ||
+ | |- | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT | ||
+ | | width="90%" | ID | ||
+ | |- | ||
+ | | colspan="2" | Unique ID of the object or button | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-s16-icon.png]] - INT | ||
+ | | width="90%" | X | ||
|- | |- | ||
− | | colspan="2" | | + | | colspan="2" | |
|- | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-s16-icon.png]] - INT | ||
+ | | width="90%" | Y | ||
+ | |- | ||
+ | | colspan="2" | | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-bool-icon.png]] - BOOL | ||
+ | | width="90%" | Relative | ||
+ | |- | ||
+ | | colspan="2" | 0=Absolute Positioning, 1=Relative Positioning | ||
|- | |- | ||
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID | ||
Line 180: | Line 330: | ||
− | === | + | ===ModifyScale=== |
{| class="wikitable" style="width:60%; background-color:#FFFFFF;" | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
|- | |- | ||
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | ||
− | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | ''' | + | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ModifyScale''' |
|- | |- | ||
− | | colspan="2" | Changes the width and height of the selected Object | + | | colspan="2" | Changes the width and height of the selected Object or Button. |
|- | |- | ||
|- | |- | ||
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT | | width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT | ||
− | | width="90%" | | + | | width="90%" | ID |
|- | |- | ||
− | | colspan="2" | | + | | colspan="2" | Unique ID of the object or button |
|- | |- | ||
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT | | width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT | ||
Line 209: | Line 359: | ||
− | === | + | ===ModifyTheme=== |
{| class="wikitable" style="width:60%; background-color:#FFFFFF;" | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
|- | |- | ||
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | ||
− | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | ''' | + | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ModifyTheme''' |
|- | |- | ||
− | | colspan="2" | | + | | colspan="2" | Changes the theme index of the selected Object or Button. |
|- | |- | ||
|- | |- | ||
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT | | width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT | ||
− | | width="90%" | | + | | width="90%" | ID |
+ | |- | ||
+ | | colspan="2" | Unique ID of the object or button | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | ||
+ | | width="90%" | Theme | ||
+ | |- | ||
+ | | colspan="2" | Theme index of the button or object | ||
+ | |- | ||
+ | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID | ||
+ | | width="90%" style="border-top: 2px solid #000;" | ''Return'' | ||
+ | |} | ||
+ | |||
+ | |||
+ | ===NoTouch=== | ||
+ | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
+ | |- | ||
+ | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | ||
+ | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''NoTouch''' | ||
+ | |- | ||
+ | | colspan="2" | Called when no touch is present, Allows the repeat rate counter to be cleared allowing for better responses to fast touches. | ||
+ | |- | ||
|- | |- | ||
− | | colspan="2" | | + | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID |
+ | | width="90%" style="border-top: 2px solid #000;" | ''Return'' | ||
+ | |} | ||
+ | |||
+ | |||
+ | ===OverrideButtonTheme=== | ||
+ | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
+ | |- | ||
+ | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | ||
+ | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''OverrideButtonTheme''' | ||
+ | |- | ||
+ | | colspan="2" | Overrides the colour of a button theme, used by the draw button macro. | ||
+ | |- | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | ||
+ | | width="90%" | ThemeIndex | ||
+ | |- | ||
+ | | colspan="2" | Index of the object colour theme | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | ||
+ | | width="90%" | FG_R | ||
+ | |- | ||
+ | | colspan="2" | Foreground colour channel value | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | ||
+ | | width="90%" | FG_G | ||
+ | |- | ||
+ | | colspan="2" | Foreground colour channel value | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | ||
+ | | width="90%" | FG_B | ||
+ | |- | ||
+ | | colspan="2" | Foreground colour channel value | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | ||
+ | | width="90%" | BG_R | ||
+ | |- | ||
+ | | colspan="2" | Background colour channel value | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | ||
+ | | width="90%" | BG_G | ||
+ | |- | ||
+ | | colspan="2" | Background colour channel value | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | ||
+ | | width="90%" | BG_B | ||
+ | |- | ||
+ | | colspan="2" | Background colour channel value | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | ||
+ | | width="90%" | HL_R | ||
+ | |- | ||
+ | | colspan="2" | Highlight colour channel value | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | ||
+ | | width="90%" | HL_G | ||
+ | |- | ||
+ | | colspan="2" | Highlight colour channel value | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | ||
+ | | width="90%" | HL_B | ||
+ | |- | ||
+ | | colspan="2" | Highlight colour channel value | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | ||
+ | | width="90%" | LL_R | ||
+ | |- | ||
+ | | colspan="2" | Lowlight colour channel value | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | ||
+ | | width="90%" | LL_G | ||
+ | |- | ||
+ | | colspan="2" | Lowlight colour channel value | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | ||
+ | | width="90%" | LL_B | ||
+ | |- | ||
+ | | colspan="2" | Lowlight colour channel value | ||
+ | |- | ||
+ | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID | ||
+ | | width="90%" style="border-top: 2px solid #000;" | ''Return'' | ||
+ | |} | ||
+ | |||
+ | |||
+ | ===OverrideObjectTheme=== | ||
+ | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
+ | |- | ||
+ | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | ||
+ | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''OverrideObjectTheme''' | ||
+ | |- | ||
+ | | colspan="2" | Overrides the colour of an object theme, used by the draw object macro. | ||
+ | |- | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | ||
+ | | width="90%" | ThemeIndex | ||
+ | |- | ||
+ | | colspan="2" | Index of the object colour theme | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | ||
+ | | width="90%" | FG_R | ||
+ | |- | ||
+ | | colspan="2" | Foreground colour channel value | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | ||
+ | | width="90%" | FG_G | ||
+ | |- | ||
+ | | colspan="2" | Foreground colour channel value | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | ||
+ | | width="90%" | FG_B | ||
+ | |- | ||
+ | | colspan="2" | Foreground colour channel value | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | ||
+ | | width="90%" | BG_R | ||
+ | |- | ||
+ | | colspan="2" | Background colour channel value | ||
|- | |- | ||
− | | width="10%" align="center" | [[File:Fc9- | + | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE |
− | | width="90%" | | + | | width="90%" | BG_G |
|- | |- | ||
− | | colspan="2" | | + | | colspan="2" | Background colour channel value |
|- | |- | ||
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | ||
− | | width="90%" | | + | | width="90%" | BG_B |
+ | |- | ||
+ | | colspan="2" | Background colour channel value | ||
+ | |- | ||
+ | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID | ||
+ | | width="90%" style="border-top: 2px solid #000;" | ''Return'' | ||
+ | |} | ||
+ | |||
+ | |||
+ | ===SetSliderValue=== | ||
+ | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
+ | |- | ||
+ | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | ||
+ | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SetSliderValue''' | ||
+ | |- | ||
+ | | colspan="2" | Sets the value of one of the sliders and optionally redraws the slider to reflect the value change. | ||
+ | |- | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT | ||
+ | | width="90%" | ButtonID | ||
|- | |- | ||
| colspan="2" | | | colspan="2" | | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-f32-icon.png]] - FLOAT | ||
+ | | width="90%" | Value | ||
+ | |- | ||
+ | | colspan="2" | Range: 0 to 1 | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-bool-icon.png]] - BOOL | ||
+ | | width="90%" | RedrawSlider | ||
+ | |- | ||
+ | | colspan="2" | 0=Do not redraw, 1=Redraw | ||
|- | |- | ||
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID | ||
Line 238: | Line 554: | ||
− | === | + | ===SetText=== |
{| class="wikitable" style="width:60%; background-color:#FFFFFF;" | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
|- | |- | ||
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | ||
− | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | ''' | + | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SetText''' |
|- | |- | ||
− | | colspan="2" | | + | | colspan="2" | Draws a single line of text onto an object or button location. Useful for labelling buttons or having name, value statistics. Drawn using the object themes. |
|- | |- | ||
|- | |- | ||
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT | | width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT | ||
− | | width="90%" | | + | | width="90%" | ID |
+ | |- | ||
+ | | colspan="2" | Unique identifier of object or button. | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-string-icon.png]] - STRING | ||
+ | | width="90%" | Text | ||
|- | |- | ||
| colspan="2" | | | colspan="2" | | ||
|- | |- | ||
− | | width="10%" align="center" | [[File:Fc9- | + | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE |
− | | width="90%" | | + | | width="90%" | Font |
|- | |- | ||
| colspan="2" | | | colspan="2" | | ||
|- | |- | ||
− | | width="10%" align="center" | [[File:Fc9- | + | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE |
− | | width="90%" | | + | | width="90%" | HAlignment |
+ | |- | ||
+ | | colspan="2" | 0=Left, 1=Center, 2=Right | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | ||
+ | | width="90%" | VAlignment | ||
+ | |- | ||
+ | | colspan="2" | 0=Top, 1=Middle, 2=Bottom | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | ||
+ | | width="90%" | Theme | ||
+ | |- | ||
+ | | colspan="2" | Object theme index to control the colour of the text | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-bool-icon.png]] - BOOL | ||
+ | | width="90%" | Transparent | ||
|- | |- | ||
− | | colspan="2" | | + | | colspan="2" | 0=Background Colour Drawn, 1=Don't Draw Background Colour |
|- | |- | ||
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID | ||
Line 279: | Line 615: | ||
|- | |- | ||
| colspan="2" | | | colspan="2" | | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-type-21-icon.png]] | ||
+ | | width="90%" | Ram Usage Bytes | ||
+ | |- | ||
+ | | colspan="2" | The calculated number of bytes of RAM required by the display manager. | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-type-21-icon.png]] | ||
+ | | width="90%" | Text Align Offset | ||
+ | |- | ||
+ | | colspan="2" | Number of pixels to move away from an edge when calling SetText | ||
+ | |- | ||
+ | | width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]] | ||
+ | | width="90%" style="background-color:#EAE1EA; color:#4B008D;" | Objects | ||
+ | |- | ||
|- | |- | ||
| width="10%" align="center" | [[File:Fc9-type-21-icon.png]] | | width="10%" align="center" | [[File:Fc9-type-21-icon.png]] | ||
| width="90%" | Max Objects | | width="90%" | Max Objects | ||
|- | |- | ||
− | | colspan="2" | The total number of objects allowed on the screen. Sets the size of the RAM buffers used to track the various screen elements. | + | | colspan="2" | The total number of primitive objects allowed on the screen at once. Sets the size of the RAM buffers used to track the various screen elements. Each object requires 10 bytes of RAM to stores things like size, location and type. |
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-type-16-icon.png]] | ||
+ | | width="90%" | Object Theme Count | ||
+ | |- | ||
+ | | colspan="2" | Sets the number of themes available when drawing primitive objects. Each object theme requires 6 bytes of RAM to store the colour channels. | ||
+ | |- | ||
+ | | width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]] | ||
+ | | width="90%" style="background-color:#EAE1EA; color:#4B008D;" | Theme 0 | ||
+ | |- | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-type-1-icon.png]] | ||
+ | | width="90%" | Foreground | ||
+ | |- | ||
+ | | colspan="2" | Foreground colour of the theme | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-type-1-icon.png]] | ||
+ | | width="90%" | Background | ||
+ | |- | ||
+ | | colspan="2" | Background colour of the theme | ||
+ | |- | ||
+ | | width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]] | ||
+ | | width="90%" style="background-color:#EAE1EA; color:#4B008D;" | Theme 1 | ||
+ | |- | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-type-1-icon.png]] | ||
+ | | width="90%" | Foreground | ||
+ | |- | ||
+ | | colspan="2" | Foreground colour of the theme | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-type-1-icon.png]] | ||
+ | | width="90%" | Background | ||
+ | |- | ||
+ | | colspan="2" | Background colour of the theme | ||
+ | |- | ||
+ | | width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]] | ||
+ | | width="90%" style="background-color:#EAE1EA; color:#4B008D;" | Buttons | ||
+ | |- | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-type-21-icon.png]] | ||
+ | | width="90%" | Max Buttons | ||
+ | |- | ||
+ | | colspan="2" | The total number of touchable interactibe objects allowed on the screen at once e.g. buttons and sliders. Sets the size of the RAM buffers used to track the various screen elements Each button requires 18 bytes of RAM to stores things like size, location, value and type. | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-type-21-icon.png]] | ||
+ | | width="90%" | Touch Repeat Rate | ||
+ | |- | ||
+ | | colspan="2" | Sets the period for touch repeats in terms of calls of the CheckForTouch macro. Buttons will only register a repeat touch after x calls if continually held down. Sliders will always register a touch. The touch count can be cleared using the NoTouch macro if no touch is detected. | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-type-21-icon.png]] | ||
+ | | width="90%" | Slider Thumb Width | ||
+ | |- | ||
+ | | colspan="2" | Number of pixels wide to make a slider thumb marker, | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-type-21-icon.png]] | ||
+ | | width="90%" | Slider Center Line Thickness | ||
+ | |- | ||
+ | | colspan="2" | Number of pixels thick to draw the slider central line | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-type-16-icon.png]] | ||
+ | | width="90%" | Button Theme Count | ||
+ | |- | ||
+ | | colspan="2" | Sets the number of themes available for drawng buttons. Each button theme requires 12 bytes of RAM to store the colour channels. | ||
+ | |- | ||
+ | | width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]] | ||
+ | | width="90%" style="background-color:#EAE1EA; color:#4B008D;" | Theme 0 | ||
+ | |- | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-type-1-icon.png]] | ||
+ | | width="90%" | Foreground | ||
+ | |- | ||
+ | | colspan="2" | Foreground colour of the theme | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-type-1-icon.png]] | ||
+ | | width="90%" | Background | ||
+ | |- | ||
+ | | colspan="2" | Background colour of the theme | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-type-1-icon.png]] | ||
+ | | width="90%" | Highlight | ||
+ | |- | ||
+ | | colspan="2" | Highlight colour of the theme | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-type-1-icon.png]] | ||
+ | | width="90%" | Lowlight | ||
+ | |- | ||
+ | | colspan="2" | Lowlight colour of the theme | ||
+ | |- | ||
+ | | width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]] | ||
+ | | width="90%" style="background-color:#EAE1EA; color:#4B008D;" | Theme 1 | ||
+ | |- | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-type-1-icon.png]] | ||
+ | | width="90%" | Foreground | ||
+ | |- | ||
+ | | colspan="2" | Foreground colour of the theme | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-type-1-icon.png]] | ||
+ | | width="90%" | Background | ||
+ | |- | ||
+ | | colspan="2" | Background colour of the theme | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-type-1-icon.png]] | ||
+ | | width="90%" | Highlight | ||
+ | |- | ||
+ | | colspan="2" | Highlight colour of the theme | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-type-1-icon.png]] | ||
+ | | width="90%" | Lowlight | ||
+ | |- | ||
+ | | colspan="2" | Lowlight colour of the theme | ||
|} | |} | ||
+ | |||
+ | ==Component Source Code== | ||
+ | |||
+ | Please click here to download the component source project: [https://www.flowcode.co.uk/wiki/componentsource/FC_Comp_Source_Lib_DisplayManager.fcfx FC_Comp_Source_Lib_DisplayManager.fcfx] | ||
+ | |||
+ | Please click here to view the component source code (Beta): [https://www.flowcode.co.uk/FlowchartView/?wfile=componentsource/FC_Comp_Source_Lib_DisplayManager.fcfx FC_Comp_Source_Lib_DisplayManager.fcfx] |
Revision as of 11:13, 10 April 2024
Author | MatrixTSL |
Version | 2.0 |
Category | Graphical Library |
Contents
Display Manager component
A component designed to simplify the process of drawing primitives and text onto a graphical display. Keeps track of coordinates so you don't have to. Also works great as a base layer for gLCD based games as it will check for collisions and perform movement.
Detailed description
The component can create the follow objects.
- Type_Line - 2 - A simple straight line.
- Type_Rectangle - 1 - A simple rectangular box.
- Type_RectangeFilled - 5 - A filled rectangular box.
- Type_Ellipse - 3 - A simple ellipse or circle.
- Type_EllipseFilled - 4 - A filled ellipse or circle.
- Type_TextBox - 0 - A text area allowing a line of text to be displayed.
The type can be entered by using the component's public constants. Begin with the Display Manager handle name followed by :: and the list of the public variables will be displayed.
For example... DisplayManager1::Type_TextBox
Examples
An example showing the creation of some text areas inside formatted shapes.
Macro reference
CheckForTouch
ClearAll
ClearAll | |
Removes all objects and buttons from memory. Also clears the screen if required. | |
- BOOL | ClearScreen |
0=Don't clear the screen, 1=Clear the screen | |
- VOID | Return |
CreateButton
CreateObject
DrawAll
DrawAll | |
Redraws all of the defined Objects and Buttons. Doesn't draw text, this is done using the SetText macro. | |
- VOID | Return |
DrawItem
GetLastTouchID
GetLastTouchID | |
Gets the ID of the last button that returned a valid press via the CheckForTouch macro. Returns -1 for valid touch recorded. | |
- INT | Return |
GetSliderValue
GetSliderValue | |
Reads the value of one of the sliders ranging between 0 and 1. | |
- UINT | ButtonID |
- FLOAT | Return |
Initialise
Initialise | |
Initialises the object and button control variables and sets up the default themes. | |
- VOID | Return |
ModifyPosition
ModifyScale
ModifyScale | |
Changes the width and height of the selected Object or Button. | |
- UINT | ID |
Unique ID of the object or button | |
- UINT | Width |
- UINT | Height |
- VOID | Return |
ModifyTheme
ModifyTheme | |
Changes the theme index of the selected Object or Button. | |
- UINT | ID |
Unique ID of the object or button | |
- BYTE | Theme |
Theme index of the button or object | |
- VOID | Return |
NoTouch
NoTouch | |
Called when no touch is present, Allows the repeat rate counter to be cleared allowing for better responses to fast touches. | |
- VOID | Return |
OverrideButtonTheme
OverrideObjectTheme
SetSliderValue
SetText
Property reference
Component Source Code
Please click here to download the component source project: FC_Comp_Source_Lib_DisplayManager.fcfx
Please click here to view the component source code (Beta): FC_Comp_Source_Lib_DisplayManager.fcfx