refactoring
This commit is contained in:
parent
aa7b921523
commit
e6bdc84343
8 changed files with 35 additions and 3 deletions
|
|
@ -3,8 +3,15 @@
|
||||||
#define RGFW_OPENGL
|
#define RGFW_OPENGL
|
||||||
#include "../rgfw.h"
|
#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();
|
RGFW_glHints* hints = RGFW_getGlobalHints_OpenGL();
|
||||||
hints->major = 3;
|
hints->major = 3;
|
||||||
|
|
@ -24,7 +31,7 @@ int platform_run(int argc, char **argv)
|
||||||
|
|
||||||
RGFW_window_setExitKey(win, RGFW_escape);
|
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("OpenGL Version: %s\n", version);
|
||||||
printf("GLAD Version: %d.%d\n", GLAD_VERSION_MAJOR(glad_version), GLAD_VERSION_MINOR(glad_version));
|
printf("GLAD Version: %d.%d\n", GLAD_VERSION_MAJOR(glad_version), GLAD_VERSION_MINOR(glad_version));
|
||||||
|
|
||||||
2
makefile
2
makefile
|
|
@ -3,7 +3,7 @@ include config.mk
|
||||||
SRC:=topaz.c
|
SRC:=topaz.c
|
||||||
|
|
||||||
ifeq (${BACKEND},gl)
|
ifeq (${BACKEND},gl)
|
||||||
SRC += opengl/gl.c opengl/platform.c
|
SRC += gl/gl.c gl/platform.c
|
||||||
endif
|
endif
|
||||||
|
|
||||||
OBJ:=${SRC:.c=.o}
|
OBJ:=${SRC:.c=.o}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
#ifndef PLATFORM_H
|
#ifndef PLATFORM_H
|
||||||
#define PLATFORM_H
|
#define PLATFORM_H
|
||||||
|
|
||||||
|
/* Check out gl/platform.c or vk/platform.c */
|
||||||
int platform_run(int argc, char **argv);
|
int platform_run(int argc, char **argv);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
19
types.h
Normal file
19
types.h
Normal 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
5
utils.h
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
#ifndef UTILS_H
|
||||||
|
#define UTILS_H
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
Loading…
Add table
Add a link
Reference in a new issue