ref: 3c6de42ce452499062773d64d393aff8bee42a30
parent: 95ba852b92acfc26469e8382e101e3953241d946
author: Jacob Moody <[email protected]>
date: Sun Aug 27 17:55:31 EDT 2023
the globals need initialized earlier then initially thought
--- a/src/platform_sdl.c
+++ b/src/platform_sdl.c
@@ -208,8 +208,10 @@
#endif
+void global_init(void);
int main(int argc, char *argv[]) {
+ global_init();
SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_JOYSTICK);
SDL_AudioSpec spec = {
--- a/src/render_software.c
+++ b/src/render_software.c
@@ -31,18 +31,22 @@
uint16_t RENDER_NO_TEXTURE;
-
-void render_init(vec2i_t screen_size) {
+void global_init(void)
+{
#ifdef __plan9__
setfcr(0);
#endif
- render_set_screen_size(screen_size);
- textures_len = 0;
-
view_mat = mat4_identity();
mvp_mat = mat4_identity();
projection_mat = mat4_identity();
sprite_mat = mat4_identity();
+}
+
+
+void render_init(vec2i_t screen_size) {
+ render_set_screen_size(screen_size);
+ textures_len = 0;
+
rgba_t white_pixels[4] = {
rgba(128,128,128,255), rgba(128,128,128,255),
rgba(128,128,128,255), rgba(128,128,128,255)