ym_gfx is responsible for graphics processing within the ym project.
More...
ym_gfx is responsible for graphics processing within the ym project.
It contains platform independent support for simple graphics processing, like window functionality.
Simple typedef for void, as no direct handling of the window is legal.
To keep the window system cross platform it has been decided that the window system should be completely opaque. And access is only given through functions that accepts a ym_gfx_window* as a parameter.
Creates a ym_gfx_window with the specified width, height, and name.
Allocates and prepares a new window with the supplied parameters.
- Parameters
-
width | The width of the window to create in pixels |
height | The height of the window to create in pixels. |
window_name | The name of the window to be created. Cannot be NULL. |
- Returns
- Pointer to newly allocated window on success, NULL on failures.
- Todo:
- Find out how to do error checking here. Don't want to change the typedef to void* rather than void. As the cast is easier to have mistakes then. Potentially do a out_errc?
Destroys/deallocates the window pointed to by window.
- Parameters
-
window | Window to destroy/deallocate. Cannot be NULL. |
Initializes the ym_gfx module with a given memory region.
Initializes the ym_gfx module, allowing it to do any needed setup before it can function properly.
- Parameters
-
memory_region | Pointer to the memory region the ym_gfx module should use for allocating memory. Cannot be NULL. The region is stored, and cannot be deleted before ym_gfx is shut down. |
- Returns
- ym_errc_success on success. ym_errc_* on failure.
Finished the last of de-initialization needed by the ym_gfx module.
De-initializes the ym_gfx module. Doing any required cleanup before shutting down.
- Returns
- ym_errc_success on success. ym_errc_* on failure.
Clears the given window.
- Parameters
-
window | The window to be cleared. |
Displays everything that has been rendered to the window.
Essentially it swaps the gl buffer.
- Parameters
-
window | The window to display to. Cannot be NULL. |
Gets the width and height dimension of the given window.
- Parameters
-
window | The window to check. Cannot be NULL. |
out_width | Out parameter used to store width. |
out_height | Out parameter used to store height. |
Checks if the current supplied window is open, or if it has been closed.
- Parameters
-
window | The window to check if open. Cannot be NULL. |
- Returns
- True if the window is open. False if it has been closed.
Polls events tied to the window in question.
Polls all events that the OS pushed. Additionally the keyboard and mouse is updated.
- Parameters
-
window | Window to poll events from. Cannot be NULL. |