Added more debug options.
This commit is contained in:
parent
9d56e73896
commit
02b8c4aa06
2
.ccls
2
.ccls
|
|
@ -7,4 +7,4 @@ gcc
|
||||||
|
|
||||||
# Macros
|
# Macros
|
||||||
-DASSET_FILE_NAME="$(make print-ASSET_OUTPUT)"
|
-DASSET_FILE_NAME="$(make print-ASSET_OUTPUT)"
|
||||||
-DDEBUG=1
|
-DDEBUG=2
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
Subproject commit 4dbee83e8d89c965714fc521fa324e237dd35129
|
Subproject commit 7f66cb41728fdea5e1f71b8a8f7212e54088f81c
|
||||||
|
|
@ -11,7 +11,7 @@ SRC_CC = gcc
|
||||||
ifeq ($(RELEASE), 1)
|
ifeq ($(RELEASE), 1)
|
||||||
SRC_CFLAGS = --std=c17 --pedantic -O3 # RELEASE
|
SRC_CFLAGS = --std=c17 --pedantic -O3 # RELEASE
|
||||||
else
|
else
|
||||||
SRC_CFLAGS = --std=c17 --pedantic -O0 -g \
|
SRC_CFLAGS = --std=c17 --pedantic -O0 -g -DDEBUG=2 \
|
||||||
-Wall -Wno-missing-braces -Wextra -Wno-missing-field-initializers \
|
-Wall -Wno-missing-braces -Wextra -Wno-missing-field-initializers \
|
||||||
-Wformat=2 -Wswitch-default -Wswitch-enum -Wcast-align \
|
-Wformat=2 -Wswitch-default -Wswitch-enum -Wcast-align \
|
||||||
-Wpointer-arith -Wbad-function-cast -Wstrict-overflow=5 \
|
-Wpointer-arith -Wbad-function-cast -Wstrict-overflow=5 \
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,12 @@
|
||||||
#define DRAW(PREFIX) PREFIX##_draw
|
#define DRAW(PREFIX) PREFIX##_draw
|
||||||
#define NO_DRAW(...) NULL
|
#define NO_DRAW(...) NULL
|
||||||
|
|
||||||
|
#if DEBUG >= 2
|
||||||
|
COMPONENT(TRANSFORM_COMPONENT, transform_component, DRAW)
|
||||||
|
#else
|
||||||
COMPONENT(TRANSFORM_COMPONENT, transform_component, NO_DRAW)
|
COMPONENT(TRANSFORM_COMPONENT, transform_component, NO_DRAW)
|
||||||
|
#endif // DEBUG >= 2
|
||||||
|
|
||||||
COMPONENT(SPRITE_COMPONENT, sprite_component, DRAW)
|
COMPONENT(SPRITE_COMPONENT, sprite_component, DRAW)
|
||||||
COMPONENT(ANIMATION_SYSTEM, animation_system, NO_DRAW)
|
COMPONENT(ANIMATION_SYSTEM, animation_system, NO_DRAW)
|
||||||
COMPONENT(PLAYER_SYSTEM, player_system, NO_DRAW)
|
COMPONENT(PLAYER_SYSTEM, player_system, NO_DRAW)
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,10 @@ int transform_component_init(component_t *component);
|
||||||
|
|
||||||
int transform_component_update(component_t *component);
|
int transform_component_update(component_t *component);
|
||||||
|
|
||||||
|
#if DEBUG >= 2
|
||||||
|
int transform_component_draw(component_t *component);
|
||||||
|
#endif
|
||||||
|
|
||||||
int transform_component_destroy(component_t *component);
|
int transform_component_destroy(component_t *component);
|
||||||
|
|
||||||
#endif // TRANSFORM_COMPONENT_H
|
#endif // TRANSFORM_COMPONENT_H
|
||||||
|
|
@ -34,6 +34,30 @@ int transform_component_update(component_t *component)
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if DEBUG >= 2
|
||||||
|
#include "display.h"
|
||||||
|
#include "errors.h"
|
||||||
|
|
||||||
|
int transform_component_draw(component_t *component)
|
||||||
|
{
|
||||||
|
transform_component_data_t *component_data = component->component_data;
|
||||||
|
|
||||||
|
if(!SDL_SetRenderDrawColor(renderer, C_BLUE))
|
||||||
|
{
|
||||||
|
error_printf("Failed to change renderer draw color : %s", SDL_GetError());
|
||||||
|
return EXIT_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!SDL_RenderRect(renderer, &component_data->bounds))
|
||||||
|
{
|
||||||
|
error_printf("Failed to draw rectangle to renderer : %s", SDL_GetError());
|
||||||
|
return EXIT_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return EXIT_SUCCESS;
|
||||||
|
}
|
||||||
|
#endif // DEBUG >= 2
|
||||||
|
|
||||||
inline int transform_component_destroy(component_t *component)
|
inline int transform_component_destroy(component_t *component)
|
||||||
{
|
{
|
||||||
transform_component_data_t *component_data = component->component_data;
|
transform_component_data_t *component_data = component->component_data;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue