Compare commits
6 Commits
8e350ac509
...
44a3cec957
| Author | SHA1 | Date |
|---|---|---|
|
|
44a3cec957 | |
|
|
434cc4fd4e | |
|
|
6c25cc0ca0 | |
|
|
c44f6b9842 | |
|
|
93c76a992c | |
|
|
8f547d6e37 |
|
|
@ -1 +1 @@
|
||||||
Subproject commit 152be5f888f7c5c44d0cee77c21d75abf78ec410
|
Subproject commit 519ae78ada36b922c64de8d37571db8d0ba0c944
|
||||||
8
TODO.md
8
TODO.md
|
|
@ -24,9 +24,9 @@
|
||||||
### In progress
|
### In progress
|
||||||
|
|
||||||
- [ ] Create tilemap management and display
|
- [ ] Create tilemap management and display
|
||||||
- [ ] Find tilemap building format
|
- [x] Find tilemap building format
|
||||||
- [ ] Add building support for tilemaps in asset builder
|
- [x] Add building support for tilemaps in asset builder
|
||||||
- [ ] Add loading support in asset manager
|
- [x] Add loading support in asset manager
|
||||||
- [ ] Display tilemaps
|
- [ ] Display tilemaps
|
||||||
- [ ] Work on optimizations !
|
- [ ] Work on optimizations !
|
||||||
|
|
||||||
|
|
@ -43,6 +43,6 @@
|
||||||
- [x] Make functionnal hitboxes between entities
|
- [x] Make functionnal hitboxes between entities
|
||||||
|
|
||||||
- [x] Change the way default values are defined across components and systems
|
- [x] Change the way default values are defined across components and systems
|
||||||
- [NO] Remove the need of a dummy texture
|
- [x] Remove the need of a dummy texture
|
||||||
|
|
||||||
- [x] Work on linked lists optimizations
|
- [x] Work on linked lists optimizations
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ For the moment each input file is openend and analized 2 times.
|
||||||
|
|
||||||
## Image (.png)
|
## Image (.png)
|
||||||
|
|
||||||
Convert png's RGBA8888 to custom RGB565 with #FF00FF (or #F81F in RGB565) as the transparent color.
|
Convert png's RGBA8888 to custom RGB565 with #0001 in RGB565 as the transparent color.
|
||||||
If png's alpha is null then the color of the pixel will be replaced with this.
|
If png's alpha is null then the color of the pixel will be replaced with this.
|
||||||
|
|
||||||
### Image asset data structure
|
### Image asset data structure
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,8 @@ ASSET_BUILDER_SOURCES := \
|
||||||
ASSET_BUILDER_CC = gcc
|
ASSET_BUILDER_CC = gcc
|
||||||
ifeq ($(RELEASE), 1)
|
ifeq ($(RELEASE), 1)
|
||||||
ASSET_BUILDER_CFLAGS = --std=c17 --pedantic -O3 $(shell pkg-config --cflags libpng json-c) # RELEASE
|
ASSET_BUILDER_CFLAGS = --std=c17 --pedantic -O3 $(shell pkg-config --cflags libpng json-c) # RELEASE
|
||||||
|
|
||||||
|
ASSET_BUILDER_LDFLAGS = -O3 $(shell pkg-config --libs libpng json-c)
|
||||||
else
|
else
|
||||||
ASSET_BUILDER_CFLAGS = --std=c17 --pedantic -O1 -DDEBUG=1 -g $(shell pkg-config --cflags libpng json-c) \
|
ASSET_BUILDER_CFLAGS = --std=c17 --pedantic -O1 -DDEBUG=1 -g $(shell pkg-config --cflags libpng json-c) \
|
||||||
-Wall -Wno-missing-braces -Wextra -Wno-missing-field-initializers \
|
-Wall -Wno-missing-braces -Wextra -Wno-missing-field-initializers \
|
||||||
|
|
@ -18,13 +20,13 @@ ASSET_BUILDER_CFLAGS = --std=c17 --pedantic -O1 -DDEBUG=1 -g $(shell pkg-config
|
||||||
-Wcast-qual -Wshadow -Wunreachable-code -Wlogical-op \
|
-Wcast-qual -Wshadow -Wunreachable-code -Wlogical-op \
|
||||||
-Wfloat-equal -Wstrict-aliasing=2 -Wredundant-decls \
|
-Wfloat-equal -Wstrict-aliasing=2 -Wredundant-decls \
|
||||||
-Wold-style-definition # DEVELOPEMENT
|
-Wold-style-definition # DEVELOPEMENT
|
||||||
|
|
||||||
|
ASSET_BUILDER_LDFLAGS = -O1 $(shell pkg-config --libs libpng json-c)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ASSET_BUILDER_INCLUDE_DIRS = $(ASSET_BUILDER_DIR)/headers $(SOURCE_DIR)/components/headers
|
ASSET_BUILDER_INCLUDE_DIRS = $(ASSET_BUILDER_DIR)/headers $(SOURCE_DIR)/components/headers
|
||||||
ASSET_BUILDER_INCLUDE_DIRS := $(addprefix -I, $(ASSET_BUILDER_INCLUDE_DIRS))
|
ASSET_BUILDER_INCLUDE_DIRS := $(addprefix -I, $(ASSET_BUILDER_INCLUDE_DIRS))
|
||||||
|
|
||||||
ASSET_BUILDER_LDFLAGS = $(shell pkg-config --libs libpng json-c)
|
|
||||||
|
|
||||||
# Deduce objects
|
# Deduce objects
|
||||||
ASSET_BUILDER_OBJECTS = $(ASSET_BUILDER_SOURCES:%.c=$(BUILD_DIR)/$(ASSET_BUILDER_DIR)/%.o)
|
ASSET_BUILDER_OBJECTS = $(ASSET_BUILDER_SOURCES:%.c=$(BUILD_DIR)/$(ASSET_BUILDER_DIR)/%.o)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -186,9 +186,9 @@ int parse_png_for_content_and_write(const char *input_file_name, FILE *output_fi
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
r = 0x1F;
|
r = 0x00;
|
||||||
g = 0x00;
|
g = 0x00;
|
||||||
b = 0x1F;
|
b = 0x01;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t pixel = ((r) << 11) | ((g) << 5) | b;
|
uint16_t pixel = ((r) << 11) | ((g) << 5) | b;
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ SRC_CFLAGS = --std=c17 --pedantic -O3 # RELEASE
|
||||||
|
|
||||||
SRC_LDFLAGS = -O3
|
SRC_LDFLAGS = -O3
|
||||||
else
|
else
|
||||||
SRC_CFLAGS = --std=c17 --pedantic -O0 -g -DDEBUG=2 \
|
SRC_CFLAGS = --std=c17 --pedantic -O1 -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 -Wcast-align \
|
-Wformat=2 -Wswitch-default -Wswitch -Wcast-align \
|
||||||
-Wpointer-arith -Wbad-function-cast -Wstrict-overflow=5 \
|
-Wpointer-arith -Wbad-function-cast -Wstrict-overflow=5 \
|
||||||
|
|
@ -27,7 +27,7 @@ SRC_CFLAGS = --std=c17 --pedantic -O0 -g -DDEBUG=2 \
|
||||||
-Wfloat-equal -Wstrict-aliasing=2 -Wredundant-decls \
|
-Wfloat-equal -Wstrict-aliasing=2 -Wredundant-decls \
|
||||||
-Wold-style-definition # DEVELOPEMENT
|
-Wold-style-definition # DEVELOPEMENT
|
||||||
|
|
||||||
SRC_LDFLAGS = -O0
|
SRC_LDFLAGS = -O1
|
||||||
endif
|
endif
|
||||||
|
|
||||||
SRC_INCLUDE_DIRS = $(SOURCE_DIR)/components/headers $(CORE_DIR)/headers
|
SRC_INCLUDE_DIRS = $(SOURCE_DIR)/components/headers $(CORE_DIR)/headers
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,5 @@ int interact_component_draw(const component_t *component);
|
||||||
int interact_component_destroy(component_t *component);
|
int interact_component_destroy(component_t *component);
|
||||||
|
|
||||||
int interact_component_interact(component_t *component);
|
int interact_component_interact(component_t *component);
|
||||||
int interact_component_modify_topic_id(component_t *component, size_t id);
|
|
||||||
|
|
||||||
#endif // TRANSFORM_COMPONENT_H
|
#endif // TRANSFORM_COMPONENT_H
|
||||||
|
|
@ -28,9 +28,6 @@ inline int interact_component_init(component_t *component)
|
||||||
};
|
};
|
||||||
|
|
||||||
component_data->topic_id = 0;
|
component_data->topic_id = 0;
|
||||||
|
|
||||||
if(event_bus_new_topic(component_data->topic_id)) return_failure_int;
|
|
||||||
|
|
||||||
component_data->activated = true;
|
component_data->activated = true;
|
||||||
|
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
|
|
@ -90,14 +87,3 @@ inline int interact_component_interact(component_t *component)
|
||||||
|
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline int interact_component_modify_topic_id(component_t *component, size_t id)
|
|
||||||
{
|
|
||||||
interact_component_data_t *component_data = component->data;
|
|
||||||
|
|
||||||
if(event_bus_change_topic_id(component_data->topic_id, id)) return_failure_int;
|
|
||||||
|
|
||||||
component_data->topic_id = id;
|
|
||||||
|
|
||||||
return EXIT_SUCCESS;
|
|
||||||
}
|
|
||||||
12
src/game.c
12
src/game.c
|
|
@ -15,9 +15,9 @@ int game_init(void)
|
||||||
game.is_running = false;
|
game.is_running = false;
|
||||||
|
|
||||||
if(display_init()) return_failure_int;
|
if(display_init()) return_failure_int;
|
||||||
if(asset_manager_init()) return_failure_int;
|
|
||||||
event_bus_init();
|
event_bus_init();
|
||||||
entity_manager_init();
|
entity_manager_init();
|
||||||
|
if(asset_manager_init()) return_failure_int;
|
||||||
|
|
||||||
if(!asset_manager_load_asset("tileset", ASSET_TEXTURE)) return_failure_int;
|
if(!asset_manager_load_asset("tileset", ASSET_TEXTURE)) return_failure_int;
|
||||||
|
|
||||||
|
|
@ -145,16 +145,20 @@ int game_render(void)
|
||||||
return_failure_int;
|
return_failure_int;
|
||||||
}
|
}
|
||||||
|
|
||||||
display_update();
|
if(display_update())
|
||||||
|
{
|
||||||
|
game.is_running = false;
|
||||||
|
return_failure_int;
|
||||||
|
}
|
||||||
|
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
int game_exit(void)
|
int game_exit(void)
|
||||||
{
|
{
|
||||||
entity_manager_exit();
|
|
||||||
event_bus_exit();
|
|
||||||
if(asset_manager_exit()) return_failure_int;
|
if(asset_manager_exit()) return_failure_int;
|
||||||
|
if(entity_manager_exit()) return_failure_int;
|
||||||
|
if(event_bus_exit()) return_failure_int;
|
||||||
display_exit();
|
display_exit();
|
||||||
|
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue