oxy_cursor.h

Overview

#include "oxygen/oxy_cursor.h"
 oxy_cursor.h  allows users to display a functional cursor on the calculator screen. it allows users to interact with built-in GTK widgets which are the only thing they can really interact with.

What are some Features:
Create different mouse sprites
You can create different mouse sprites for each state of the mouse. from an idle state to a clicking state. in total there are 5 states.

Scrolling
oxygen cursor struct has information/data about how much a user wants to scroll horizontally or vertically.

View mouse data.
Using the mouse struct you can view what the cursor is currently hovering over or what was recently clicked you can also view see current mouse sprites! imagine what you could do with this data!
Different rendering techniques
The CE C toolchain has many ways to render sprites you can look into that  over here .

How to include:
#include "oxygen/oxy_cursor.h"
if you are trying to include the cursor section of the library by itself I would recommend you include the widget library, if you are trying to use widgets.
If you are trying to use widgets with the cursor:
#include "oxygen/oxy_widget.h"

But, If you're not trying to include the single library then including the whole would work just fine:
#include "oxygen/oxygen.h"


API Documentation



Authors

Alvajoy "Alvajoy123" Asante


Defines

 CURSOR_WIDTH 
The default width of the cursor

 CURSOR_HEIGHT 
The default height of the cursor

 CURSOR_STATE_HOVER 
The status of the cursor

 CURSOR_STATE_HOVER 
Value of Cursor if the state is in hover

 CURSOR_STATE_CLICK 
Value of Cursor if the state is in click

 CURSOR_STATE_MOVE  
Value of Cursor if the state is in a move

 CURSOR_STATE_H_MOVE 
Value of Cursor if the state is in a horizontal move

 CURSOR_STATE_V_MOVE 
Value of cursor if the state is in a vertical move.

 CURSOR_SPRITE_HOVER 
Direct access to cursor idle sprite.

 CURSOR_SPRITE_CLICK 
Direct access to cursor click sprite.

 CURSOR_SPRITE_MOVE 
Direct access to cursor move sprite.

 CURSOR_SPRITE_H_MOVE 
Direct access to horizontal move sprite.

 CURSOR_SPRITE_V_MOVE 
Direct access to vertical move sprite.

 CURSOR_HOVER_ID 
Direct access to hover id.

 CURSOR_CLICKED_ID 
Direct access to clicked id.

 CURSOR_STATE_ID 
Direct access to state id.

 struct oxy_cursor_t 
Define cursor structure.

Public Members
 gfx_sprite_t *spr[5] 
pointer to cursor sprites
 int x 
vertical (x) position of the cursor.
 int y 
horizontal (y) position of the cursor.
 uint8_t speed 
movement speed of the cursor.
 uint8_t state 
the current state of the cursor.
 uint24_t scroll_X 
vertical (x) scroll amount.
 uint24_t scroll_y 
horizontal (y) scroll amount.
 int clicked_id 
contains last click widget id.
 int hover_id 
contain the id of the widget the cursor is hovering over.
 void oxy_InitCursor(void) 
initialize the cursor.

 void oxy_CenterCursor(void) 
Sets the mouse position to the center of the screen

 void oxy_ResetCursor(void) 
Reset the cursor scroll amounts to 0 and resets the cursor last clicked id.

 void oxy_SetCursorSpeed(uint8_t speed) 
Sets the movement speed of the cursor.

 void oxy_UpdateCursor(void) 
Updates the cursor
This function checks for user key presses associated with the cursor.

 void oxy_RenderCursor(void) 
Renders the cursor on the screen.
Make sure that you render the cursor on a graphical screen!

Example:
 gfx_Begin(); // This is very important 
 oxy_UpdateCursor(); 
 oxy_RenderCursor(); 
 gfx_End(); // This is very important 



Copyright © 2018 - 2023, Alvajoy Asante