AnimaEngine  1.0.0
Nintendo DS Pokemon Black, White, Black 2, and White 2 sprite extraction and preview toolchain
gui_platform.h
Go to the documentation of this file.
1 
9 #ifndef GUI_PLATFORM_H
10 #define GUI_PLATFORM_H
11 
15 typedef struct GrColor { unsigned char r, g, b, a; } GrColor;
16 
20 typedef struct GrRect { float x, y, width, height; } GrRect;
21 
25 typedef struct GrTexture { unsigned int id; int w, h; } GrTexture;
26 
33 void Gr_InitWindow(int w, int h, const char *title);
34 
38 void Gr_CloseWindow(void);
39 
44 int Gr_WindowShouldClose(void);
45 
50 int Gr_GetScreenW(void);
51 
56 int Gr_GetScreenH(void);
57 
63 void Gr_SetMinSize(int w, int h);
64 
69 void Gr_SetTargetFPS(int fps);
70 
74 void Gr_BeginFrame(void);
75 
79 void Gr_EndFrame(void);
80 
85 void Gr_Clear(GrColor c);
86 
91 float Gr_GetTime(void);
92 
97 float Gr_GetFrameDelta(void);
98 
104 int Gr_FileExists(const char *path);
105 
109 typedef struct GrFilePathList {
110  unsigned int count;
111  char **paths;
113 
119 GrFilePathList Gr_LoadDirectoryFiles(const char *dirPath);
120 
126 
132 int Gr_IsPathFile(const char *path);
133 
139 const char* Gr_GetFileName(const char *filePath);
140 
145 const char* Gr_GetWorkingDirectory(void);
146 
152 const char* Gr_GetPrevDirectoryPath(const char *dirPath);
153 
155 int Gr_MouseX(void);
157 int Gr_MouseY(void);
159 int Gr_MousePressed(int btn);
161 int Gr_MouseDown(int btn);
163 int Gr_GetWheel(void);
165 int Gr_KeyPressed(int key);
167 int Gr_KeyDown(int key);
169 int Gr_GetChar(void);
171 const char *Gr_Clipboard(void);
173 int Gr_FileDropped(void);
175 int Gr_DropCount(void);
177 const char *Gr_DropPath(int i);
179 void Gr_DropFinish(void);
180 
187 GrRect Gr_MeasureText(const char *text, int size);
188 
197 void Gr_DrawText(const char *text, float x, float y, int size, GrColor c);
198 
204 void Gr_DrawRect(GrRect r, GrColor c);
205 
212 void Gr_DrawRectRounded(GrRect r, float rad, GrColor c);
213 
220 void Gr_DrawRectRoundedLines(GrRect r, float rad, GrColor c);
221 
229 void Gr_DrawCircle(int cx, int cy, float r, GrColor c);
230 
238 void Gr_ScissorBegin(int x, int y, int w, int h);
239 
243 void Gr_ScissorEnd(void);
244 
248 int Gr_CheckPointInRect(GrRect r, float px, float py);
249 
253 int Gr_CheckPointInCircle(float px, float py, float cx, float cy, float r);
254 
263 int Gr_MakeTextureRGBA(GrTexture *t, const unsigned char *rgba, int w, int h);
264 
270 void Gr_UpdateTexture(GrTexture *t, const unsigned char *rgba);
271 
279 void Gr_DrawTexture(GrTexture *t, GrRect src, GrRect dst, GrColor tint);
280 
285 void Gr_UnloadTexture(GrTexture *t);
286 
292 const char *Gr_FormatText(const char *fmt, ...);
293 
294 #endif
int Gr_MousePressed(int btn)
Checks if a mouse button was clicked.
Definition: gui_raylib.c:27
int Gr_GetScreenH(void)
Gets the current window canvas height in pixels.
Definition: gui_raylib.c:15
const char * Gr_GetWorkingDirectory(void)
Gets current process working directory (CWD) path.
Definition: gui_raylib.c:124
void Gr_UpdateTexture(GrTexture *t, const unsigned char *rgba)
Copies new raw RGBA pixel bytes directly into an active texture VRAM address.
Definition: gui_raylib.c:79
int Gr_MouseX(void)
Gets active cursor horizontal pixel index.
Definition: gui_raylib.c:25
int Gr_MouseY(void)
Gets active cursor vertical pixel index.
Definition: gui_raylib.c:26
int Gr_GetScreenW(void)
Gets the current window canvas width in pixels.
Definition: gui_raylib.c:14
const char * Gr_Clipboard(void)
Gets active system clipboard contents.
Definition: gui_raylib.c:38
int Gr_FileExists(const char *path)
Checks if a file path exists and is accessible.
Definition: gui_raylib.c:23
void Gr_BeginFrame(void)
Signals the rendering backend that a new frame has started (flushes draw calls).
Definition: gui_raylib.c:18
int Gr_KeyPressed(int key)
Checks if keyboard key was clicked.
Definition: gui_raylib.c:35
void Gr_DrawRectRounded(GrRect r, float rad, GrColor c)
Draws rounded corners solid rectangle.
Definition: gui_raylib.c:58
struct GrTexture GrTexture
Abstract texture representation mapped to graphics card registers.
void Gr_DrawRectRoundedLines(GrRect r, float rad, GrColor c)
Draws lines of a rounded corners rectangle.
Definition: gui_raylib.c:59
void Gr_UnloadTexture(GrTexture *t)
Deallocates hardware graphics memory registers used by a texture.
Definition: gui_raylib.c:88
int Gr_MouseDown(int btn)
Checks if a mouse button is currently held down.
Definition: gui_raylib.c:28
int Gr_MakeTextureRGBA(GrTexture *t, const unsigned char *rgba, int w, int h)
Allocates dynamic texture mapping using raw RGBA pixel arrays.
Definition: gui_raylib.c:66
int Gr_GetWheel(void)
Gets mouse wheel offset delta.
Definition: gui_raylib.c:29
struct GrColor GrColor
Abstract color representation using 8-bit red, green, blue, and alpha values.
void Gr_CloseWindow(void)
Terminates the windowing subsystem and cleans up remaining hardware resources.
Definition: gui_raylib.c:12
GrRect Gr_MeasureText(const char *text, int size)
Computes width bounds for a text string under a target font height size.
Definition: gui_raylib.c:52
void Gr_UnloadDirectoryFiles(GrFilePathList list)
Deallocates directory list memory allocations.
Definition: gui_raylib.c:108
void Gr_DrawRect(GrRect r, GrColor c)
Draws solid rectangle.
Definition: gui_raylib.c:57
void Gr_DropFinish(void)
Cleans up drag-and-drop platform handles.
Definition: gui_raylib.c:50
GrFilePathList Gr_LoadDirectoryFiles(const char *dirPath)
Loads all filenames/directories inside a specified folder.
Definition: gui_raylib.c:100
int Gr_CheckPointInRect(GrRect r, float px, float py)
Verifies collision point bounds inside a rectangle.
Definition: gui_raylib.c:63
const char * Gr_FormatText(const char *fmt,...)
Formats text string using printf-style layout arguments.
Definition: gui_raylib.c:91
int Gr_DropCount(void)
Gets count of dropped files.
Definition: gui_raylib.c:41
void Gr_EndFrame(void)
Signals the rendering backend that a frame has finished (swaps framebuffers).
Definition: gui_raylib.c:19
const char * Gr_GetPrevDirectoryPath(const char *dirPath)
Resolves parent directory path.
Definition: gui_raylib.c:128
int Gr_GetChar(void)
Pops latest character pressed from keyboard queue.
Definition: gui_raylib.c:37
void Gr_SetTargetFPS(int fps)
resticts the rendering execution speed to the target frames per second.
Definition: gui_raylib.c:17
void Gr_InitWindow(int w, int h, const char *title)
Initialises the application window and renderer context.
Definition: gui_raylib.c:11
void Gr_SetMinSize(int w, int h)
resticts the minimum allowable window sizing for resizable targets.
Definition: gui_raylib.c:16
float Gr_GetTime(void)
Returns total time elapsed in seconds since the window context started.
Definition: gui_raylib.c:21
int Gr_IsPathFile(const char *path)
Checks whether the given path represents a file or a directory.
Definition: gui_raylib.c:116
struct GrFilePathList GrFilePathList
Abstracted directory list container.
struct GrRect GrRect
Abstract rectangle bounding box in 2D coordinate space.
void Gr_DrawCircle(int cx, int cy, float r, GrColor c)
Draws solid circle.
Definition: gui_raylib.c:60
void Gr_DrawText(const char *text, float x, float y, int size, GrColor c)
Draws direct raster text on active canvas.
Definition: gui_raylib.c:56
const char * Gr_DropPath(int i)
Gets path of dropped file by index.
Definition: gui_raylib.c:42
int Gr_FileDropped(void)
Checks if any files have been dropped onto the window area in this frame.
Definition: gui_raylib.c:40
const char * Gr_GetFileName(const char *filePath)
Extracts the file name pointer (excluding folders) from a path string.
Definition: gui_raylib.c:120
void Gr_DrawTexture(GrTexture *t, GrRect src, GrRect dst, GrColor tint)
Draws a textured quad inside target coordinates.
Definition: gui_raylib.c:82
int Gr_KeyDown(int key)
Checks if keyboard key is being held.
Definition: gui_raylib.c:36
int Gr_CheckPointInCircle(float px, float py, float cx, float cy, float r)
Verifies collision bounds inside a circle.
Definition: gui_raylib.c:64
int Gr_WindowShouldClose(void)
Checks if the OS window closing event (close button, Alt+F4) has been triggered.
Definition: gui_raylib.c:13
void Gr_Clear(GrColor c)
Clears the entire active framebuffer with a solid background color.
Definition: gui_raylib.c:20
void Gr_ScissorEnd(void)
Disables scissor clipping bounding boxes.
Definition: gui_raylib.c:62
float Gr_GetFrameDelta(void)
Returns the duration time step in seconds between the previous frame and this frame.
Definition: gui_raylib.c:22
void Gr_ScissorBegin(int x, int y, int w, int h)
Sets a rectangular scissor clipping box on drawing calls.
Definition: gui_raylib.c:61
Abstract color representation using 8-bit red, green, blue, and alpha values.
Definition: gui_platform.h:15
unsigned char r
Definition: gui_platform.h:15
unsigned char a
Definition: gui_platform.h:15
unsigned char g
Definition: gui_platform.h:15
unsigned char b
Definition: gui_platform.h:15
Abstracted directory list container.
Definition: gui_platform.h:109
char ** paths
Definition: gui_platform.h:111
unsigned int count
Definition: gui_platform.h:110
Abstract rectangle bounding box in 2D coordinate space.
Definition: gui_platform.h:20
float width
Definition: gui_platform.h:20
float height
Definition: gui_platform.h:20
float x
Definition: gui_platform.h:20
float y
Definition: gui_platform.h:20
Abstract texture representation mapped to graphics card registers.
Definition: gui_platform.h:25
int w
Definition: gui_platform.h:25
unsigned int id
Definition: gui_platform.h:25
int h
Definition: gui_platform.h:25