refactoring

This commit is contained in:
Lorenzo Torres 2025-11-01 16:32:49 +01:00
parent aa7b921523
commit e6bdc84343
8 changed files with 35 additions and 3 deletions

View file

@ -3,8 +3,15 @@
#define RGFW_OPENGL
#include "../rgfw.h"
int platform_run(int argc, char **argv)
/*
* This function is the entrypoint for the whole
* game. Its role is to initialize OpenGL, create
* the renderer and start the game loop.
*/
int platform_run(i32 argc, u8 **argv)
{
(void) argc;
(void) argv;
RGFW_glHints* hints = RGFW_getGlobalHints_OpenGL();
hints->major = 3;
@ -24,7 +31,7 @@ int platform_run(int argc, char **argv)
RGFW_window_setExitKey(win, RGFW_escape);
const GLubyte *version = glGetString(GL_VERSION);
const u8 *version = glGetString(GL_VERSION);
printf("OpenGL Version: %s\n", version);
printf("GLAD Version: %d.%d\n", GLAD_VERSION_MAJOR(glad_version), GLAD_VERSION_MINOR(glad_version));

View file

@ -3,7 +3,7 @@ include config.mk
SRC:=topaz.c
ifeq (${BACKEND},gl)
SRC += opengl/gl.c opengl/platform.c
SRC += gl/gl.c gl/platform.c
endif
OBJ:=${SRC:.c=.o}

View file

@ -1,6 +1,7 @@
#ifndef PLATFORM_H
#define PLATFORM_H
/* Check out gl/platform.c or vk/platform.c */
int platform_run(int argc, char **argv);
#endif

19
types.h Normal file
View file

@ -0,0 +1,19 @@
#ifndef TYPES_H
#define TYPES_H
#include <stdint.h>
#include <stddef.h>
typedef uint8_t u8;
typedef uint16_t u16;
typedef uint32_t u32;
typedef uint64_t u64;
typedef int8_t i8;
typedef int16_t i16;
typedef int32_t i32;
typedef int64_t i64;
typedef size_t usize;
#endif

5
utils.h Normal file
View file

@ -0,0 +1,5 @@
#ifndef UTILS_H
#define UTILS_H
#endif