event fix..?

This commit is contained in:
2024-08-30 01:18:18 -04:00
parent fe421727d0
commit f0858189e2
6 changed files with 42 additions and 22 deletions

View File

@ -21,14 +21,13 @@ random_f32(void)
f32
random_f32_in_range(f32 min, f32 max)
{
return (f32)((random_f32() * (max - min + 1)) + min);
return (f32)((random_f32() * (max - min)) + min);
}
s32
random_s32_in_range(s32 min, s32 max)
{
return (s32)((random_f32() * (max - min + 1)) + min);
return (s32)((random_f32() * (max - min)) + min);
}
bool

View File

@ -87,6 +87,8 @@ renderer_init(Renderer* self, Window* window, CameraType type, const ivec2* buff
}
glEnable(GL_BLEND);
glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_LESS);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
}

View File

@ -49,15 +49,12 @@ sdl_init(void)
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 3);
/*
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_ES);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3);
*/
SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8);
SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 8);
SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8);
SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, 8);
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
*/
}
/* Quits SDL. */

View File

@ -3,15 +3,29 @@
void
surface_rgba_init(SDL_Surface** self, ivec2 size)
{
*self = SDL_CreateRGBSurface
(
0,
size[0],
size[1],
32,
0xFF000000,
0x00FF0000,
0x0000FF00,
0x000000FF
);
#if SDL_BYTEORDER == SDL_BIG_ENDIAN
*self = SDL_CreateRGBSurface
(
0,
size[0],
size[1],
32,
0xFF000000,
0x00FF0000,
0x0000FF00,
0x000000FF
);
#else
*self = SDL_CreateRGBSurface
(
0,
size[0],
size[1],
32,
0x000000FF,
0x0000FF00,
0x00FF0000,
0xFF000000
);
#endif
}