summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorrealtradam <[email protected]>2023-01-05 03:46:31 -0500
committerrealtradam <[email protected]>2023-01-05 03:46:31 -0500
commitb1f855a82b40f1caeaf4d672638f2cfc933c8040 (patch)
tree01ac9bb85ade849534b952d19736d1dbcc54f0d8
parentf6a04f084551b4db123c293b98f5b590813cf767 (diff)
downloadRodeoKit-b1f855a82b40f1caeaf4d672638f2cfc933c8040.tar.gz
RodeoKit-b1f855a82b40f1caeaf4d672638f2cfc933c8040.zip
add debug text function + some cleanup
-rw-r--r--.vimrc2
-rw-r--r--include/rodeo.h28
-rw-r--r--src/compile_flags.txt1
-rw-r--r--src/rodeo.c64
4 files changed, 60 insertions, 35 deletions
diff --git a/.vimrc b/.vimrc
deleted file mode 100644
index bcaff77..0000000
--- a/.vimrc
+++ /dev/null
@@ -1,2 +0,0 @@
-" press F5 to compile and execute the project code
-map <f5> :AsyncRun -save=1 -cwd=<root> ./build ; ./run <CR>
diff --git a/include/rodeo.h b/include/rodeo.h
index e468c11..86505f1 100644
--- a/include/rodeo.h
+++ b/include/rodeo.h
@@ -5,7 +5,7 @@
typedef
struct
Rodeo__\
-Data_t
+data_t
{
SDL_Window* window;
SDL_Surface* screen_surface;
@@ -14,12 +14,23 @@ Data_t
int screen_height;
SDL_Event sdl_event;
bool quit;
-} Rodeo__Data_t;
+} Rodeo__data_t;
+
+typedef
+struct
+Rodeo__\
+color_t
+{
+ float red;
+ float green;
+ float blue;
+ float alpha;
+} Rodeo__color_t;
void
Rodeo__\
init_window(
- Rodeo__Data_t* state,
+ Rodeo__data_t* state,
int screen_height,
int screen_width,
char* title
@@ -27,7 +38,7 @@ init_window(
void
Rodeo__\
-deinit_window(Rodeo__Data_t* state);
+deinit_window(Rodeo__data_t* state);
void
Rodeo__\
@@ -35,8 +46,13 @@ quit();
void
Rodeo__\
-begin(Rodeo__Data_t* state);
+begin(Rodeo__data_t* state);
void
Rodeo__\
-end(Rodeo__Data_t* state);
+end(Rodeo__data_t* state);
+
+void
+Rodeo__\
+draw_debug_text(u_int16_t x, u_int16_t y, const char *format, ...);
+
diff --git a/src/compile_flags.txt b/src/compile_flags.txt
index 90e041f..834f763 100644
--- a/src/compile_flags.txt
+++ b/src/compile_flags.txt
@@ -1,4 +1,5 @@
-I./
+-I../include
-I../external/SDL/include
-I../external/bgfx/include
-I../external/bx/include
diff --git a/src/rodeo.c b/src/rodeo.c
index 46ed014..3885ceb 100644
--- a/src/rodeo.c
+++ b/src/rodeo.c
@@ -4,16 +4,16 @@
#include "rodeo.h"
-//static Rodeo__Data_t Rodeo__State = { 0 };
+//static Rodeo__data_t Rodeo__State = { 0 };
void
Rodeo__\
init_window(
- Rodeo__Data_t* state,
- int screen_height,
- int screen_width,
- char* title
- )
+ Rodeo__data_t* state,
+ int screen_height,
+ int screen_width,
+ char* title
+)
{
state->window = NULL;
state->screen_surface = NULL;
@@ -27,13 +27,13 @@ init_window(
}
state->window = SDL_CreateWindow(
- title,
- SDL_WINDOWPOS_UNDEFINED,
- SDL_WINDOWPOS_UNDEFINED,
- screen_width,
- screen_height,
- SDL_WINDOW_SHOWN
- );
+ title,
+ SDL_WINDOWPOS_UNDEFINED,
+ SDL_WINDOWPOS_UNDEFINED,
+ screen_width,
+ screen_height,
+ SDL_WINDOW_SHOWN
+ );
if(state->window == NULL)
{
@@ -43,11 +43,11 @@ init_window(
SDL_VERSION(&state->wmi.version);
if(
- !SDL_GetWindowWMInfo(
- state->window,
- &state->wmi
- )
- )
+ !SDL_GetWindowWMInfo(
+ state->window,
+ &state->wmi
+ )
+ )
{
printf("SDL_Error %s\n", SDL_GetError());
exit(EXIT_FAILURE);
@@ -75,12 +75,12 @@ init_window(
bgfx_set_debug(BGFX_DEBUG_TEXT);
bgfx_set_view_clear(
- 0,
- BGFX_CLEAR_COLOR | BGFX_CLEAR_DEPTH,
- 0x443355FF,
- 1.0f,
- 0
- );
+ 0,
+ BGFX_CLEAR_COLOR | BGFX_CLEAR_DEPTH,
+ 0x443355FF,
+ 1.0f,
+ 0
+ );
bgfx_set_view_rect(0, 0, 0, state->screen_width, state->screen_height);
bgfx_touch(0);
@@ -90,7 +90,7 @@ init_window(
void
Rodeo__\
-deinit_window(Rodeo__Data_t* state)
+deinit_window(Rodeo__data_t* state)
{
bgfx_shutdown();
SDL_DestroyWindow(state->window);
@@ -105,13 +105,13 @@ quit()
void
Rodeo__\
-begin(Rodeo__Data_t* state)
+begin(Rodeo__data_t* state)
{
}
void
Rodeo__\
-end(Rodeo__Data_t* state)
+end(Rodeo__data_t* state)
{
while(SDL_PollEvent(&state->sdl_event))
{
@@ -123,3 +123,13 @@ end(Rodeo__Data_t* state)
bgfx_touch(0);
bgfx_frame(false);
}
+
+void
+Rodeo__\
+draw_debug_text(u_int16_t x, u_int16_t y, const char *format, ...)
+{
+ va_list argList;
+ va_start(argList, format);
+ bgfx_dbg_text_vprintf(x, y, 0x65, format, argList);
+ va_end(argList);
+}