change to the rendering system so it's not god awful oh my lord
This commit is contained in:
parent
2a63b62832
commit
9138103552
@ -35,14 +35,14 @@ file(GLOB src
|
||||
|
||||
add_executable(${PROJECT_NAME} ${src})
|
||||
|
||||
set (CMAKE_C_FLAGS "-O2 -Wall -Wextra -pedantic -Wno-unused-variable -Wno-unused-parameter -Wno-parentheses")
|
||||
set (CMAKE_C_FLAGS "-O2 -Wall -Wextra -pedantic -Wno-discarded-qualifiers -Wno-unused-variable -Wno-unused-parameter -Wno-parentheses")
|
||||
|
||||
if (EMSCRIPTEN)
|
||||
set(CMAKE_EXECUTABLE_SUFFIX ".html")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -s USE_SDL=2 -s USE_SDL_IMAGE=2 -s SDL2_IMAGE_FORMATS='['png']' -s USE_SDL_MIXER=2 -s SDL2_MIXER_FORMATS='['ogg']' -s USE_SDL_TTF=2 -s ASSERTIONS=1 -s ALLOW_MEMORY_GROWTH=1 -Wno-strict-prototypes -Wno-incompatible-pointer-types-discards-qualifiers -Wno-unused-command-line-argument -Wno-ignored-qualifiers")
|
||||
target_link_options(${PROJECT_NAME} PRIVATE --preload-file res -s USE_WEBGL2=1 )
|
||||
elseif (WIN32)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mwindows -Wno-discarded-qualifers")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mwindows")
|
||||
target_link_libraries(${PROJECT_NAME} mingw32 m SDL2main SDL2 SDL2_image SDL2_mixer SDL2_ttf opengl32 glew32)
|
||||
elseif (UNIX)
|
||||
target_link_libraries(${PROJECT_NAME} m SDL2 SDL2_image SDL2_mixer SDL2_ttf GL GLEW)
|
||||
|
@ -99,8 +99,8 @@ renderer_init(Renderer* self, Window* window, CameraType type, const ivec2* buff
|
||||
}
|
||||
|
||||
glEnable(GL_BLEND);
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
glDepthFunc(GL_LESS);
|
||||
//glEnable(GL_DEPTH_TEST);
|
||||
//glDepthFunc(GL_LESS);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
}
|
||||
|
||||
@ -134,6 +134,9 @@ void
|
||||
renderer_clear(Renderer* self)
|
||||
{
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
for (s32 i = 0; i < RENDERER_BUFFER_COUNT; i++)
|
||||
renderer_buffer_clear(self, i);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -20,6 +20,7 @@ entity_cursor_add(ECS* ecs)
|
||||
(f32*)ENTITY_CURSOR_POSITION
|
||||
);
|
||||
|
||||
/*
|
||||
component_pulsate_init
|
||||
(
|
||||
ecs_component_get(ecs, COMPONENT_PULSATE, id),
|
||||
@ -28,6 +29,7 @@ entity_cursor_add(ECS* ecs)
|
||||
(f32*)ENTITY_CURSOR_PULSATE_MAX_SCALE,
|
||||
ENTITY_CURSOR_PULSATE_FREQUENCY
|
||||
);
|
||||
*/
|
||||
|
||||
return id;
|
||||
}
|
||||
|
@ -6,12 +6,12 @@
|
||||
|
||||
EntityID entity_cursor_add(ECS* ecs);
|
||||
|
||||
#define ENTITY_CURSOR_DEPENDENCY_COUNT 3
|
||||
#define ENTITY_CURSOR_DEPENDENCY_COUNT 2
|
||||
static const ComponentType ENTITY_CURSOR_DEPENDENCIES[ENTITY_CURSOR_DEPENDENCY_COUNT] =
|
||||
{
|
||||
COMPONENT_GAME_OBJECT,
|
||||
COMPONENT_COPY_MOUSE_POSITION,
|
||||
COMPONENT_PULSATE,
|
||||
//COMPONENT_PULSATE,
|
||||
};
|
||||
|
||||
static const RendererBuffer ENTITY_CURSOR_BUFFER = RENDERER_BUFFER_CURSOR;
|
||||
|
@ -14,6 +14,9 @@ _game_quit(Game* self)
|
||||
|
||||
ecs_free(&self->ecs);
|
||||
|
||||
for (s32 i = 0; i < RENDERER_BUFFER_COUNT; i++)
|
||||
renderer_buffer_free(&self->renderer, (RendererBuffer)i);
|
||||
|
||||
renderer_free(&self->renderer);
|
||||
|
||||
window_free(&self->window);
|
||||
@ -57,20 +60,16 @@ _game_tick(Game* self)
|
||||
static void
|
||||
_game_update(Game* self)
|
||||
{
|
||||
renderer_update(&self->renderer);
|
||||
ecs_update(&self->ecs);
|
||||
}
|
||||
|
||||
static void
|
||||
_game_draw(Game* self)
|
||||
{
|
||||
renderer_clear_color_set(&self->renderer, (f32*)RENDERER_CLEAR_COLOR);
|
||||
renderer_clear_color_set(&self->renderer, (f32*)BLACK);
|
||||
|
||||
renderer_clear(&self->renderer);
|
||||
|
||||
for (s32 i = 0; i < RENDERER_BUFFER_COUNT; i++)
|
||||
renderer_buffer_init(&self->renderer, (RendererBuffer)i);
|
||||
|
||||
ecs_draw(&self->ecs);
|
||||
|
||||
for (s32 i = 0; i < RENDERER_BUFFER_COUNT; i++)
|
||||
@ -85,9 +84,6 @@ _game_draw(Game* self)
|
||||
}
|
||||
|
||||
renderer_present(&self->renderer);
|
||||
|
||||
for (s32 i = 0; i < RENDERER_BUFFER_COUNT; i++)
|
||||
renderer_buffer_free(&self->renderer, (RendererBuffer)i);
|
||||
}
|
||||
void
|
||||
game_init(Game* self)
|
||||
@ -111,6 +107,9 @@ game_init(Game* self)
|
||||
for (s32 i = 0; i < RENDERER_BUFFER_COUNT; i++)
|
||||
postprocessing_init(&self->postprocessing[i], OPAQUE, TRANSPARENT);
|
||||
|
||||
for (s32 i = 0; i < RENDERER_BUFFER_COUNT; i++)
|
||||
renderer_buffer_init(&self->renderer, (RendererBuffer)i);
|
||||
|
||||
if (!resources_init(&self->resources))
|
||||
{
|
||||
printf("%s\n", STRING_RESOURCE_ERROR);
|
||||
|
@ -24,8 +24,6 @@ buffer_draw(Renderer* renderer, Shader* shader, RendererBuffer buffer, Postproce
|
||||
camera_projection_get(&renderer->camera[buffer], projection);
|
||||
camera_view_get(&renderer->camera[buffer], view);
|
||||
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
|
||||
texture_quad_draw
|
||||
(
|
||||
&renderer->fboTextures[buffer],
|
||||
|
Loading…
Reference in New Issue
Block a user