Compare commits

..

No commits in common. "6bd85dfb8f10ce0fecb11db7af78f920b0432762" and "a63096e6299bca41c3ffb87188d14dc2396373a9" have entirely different histories.

3 changed files with 14 additions and 19 deletions

View File

@ -20,8 +20,7 @@ CXXFLAGS = -std=c++17 -g -I.
LDFLAGS =
# Deduce objects
OBJECTS = $(SOURCES:%.cpp=$(BUILD_DIR)/%.o)
ASSETS_OBJECTS = $(ASSETS:%=$(BUILD_DIR)/%.o)
OBJECTS = $(SOURCES:%.cpp=$(BUILD_DIR)/%.o) $(ASSETS:%=$(BUILD_DIR)/%.o)
# Verbose mode
ifeq ($(VERBOSE), 1)
@ -40,16 +39,16 @@ TOTAL_FILES := $(shell echo $$(($(words $(SOURCES))+1)))
CURRENT_FILE := 0
# Default targets
all: build_dir $(OUTPUT) end
all: $(BUILD_DIR) $(OUTPUT) end
# Create build directory
build_dir:
$(Q)mkdir -p $(dir $(OBJECTS)) $(dir $(ASSETS_OBJECTS))
$(BUILD_DIR):
$(Q)mkdir -p $(dir $(OBJECTS))
# Link target
$(OUTPUT): $(OBJECTS) $(ASSETS_OBJECTS)
$(OUTPUT): $(OBJECTS)
@echo "[100%] $(YELLOW)Linking $(OUTPUT)$(RESET)"
$(Q)$(CXX) $(LDFLAGS) -o $@ $(OBJECTS) $(ASSETS_OBJECTS)
$(Q)$(CXX) $(LDFLAGS) -o $@ $(OBJECTS)
# Build .o files from .cpp
$(BUILD_DIR)/%.o: %.cpp
@ -59,13 +58,9 @@ $(BUILD_DIR)/%.o: %.cpp
$(Q)mkdir -p $(dir $@)
$(Q)$(CXX) $(CXXFLAGS) -MMD -MP -c $< -o $@
# Arch and BFD header version
ARCH := $(shell arch)
BFD_VER := $(shell objcopy --info 2>/dev/null | grep -m1 '^elf')
# Convert .png.o from .png
$(BUILD_DIR)/%.o: %
fxconv --cg --toolchain= --arch=$(ARCH) --outputtarget=$(BFD_VER) $< -o $@
$(BUILD_DIR)/%.png.o: %.png
fxconv --toolchain= --cg $< -o $@
# Source files dependencies
-include $(OBJECTS:.o=.d)

View File

@ -6,8 +6,8 @@
#include "game_data.hpp"
struct texture_t builtin_textures[NB_TEXTURES] = {
{"player_idle_sheet", &img_player_idle_sheet},
{"player_run_sheet", &img_player_run_sheet}
{"player_idle_sheet", &player_idle_sheet},
{"player_run_sheet", &player_run_sheet}
};
void load_json_into_game_data(json *json_input, game_data_t *bin_output)
@ -20,4 +20,4 @@ void write_game_data_as_bin_into_file(game_data_t *game_data, std::ofstream *bin
void free_game_data(game_data_t *game_data)
{
}
}

View File

@ -7,8 +7,8 @@
using nlohmann::json;
extern bopti_image_t img_player_idle_sheet;
extern bopti_image_t img_player_run_sheet;
extern bopti_image_t player_idle_sheet;
extern bopti_image_t player_run_sheet;
typedef struct texture_t {
const char *name;
@ -28,4 +28,4 @@ void write_game_data_as_bin_into_file(game_data_t *game_data, std::ofstream *bin
void free_game_data(game_data_t *game_data);
#endif // GAME_DATA_HPP
#endif // GAME_DATA_HPP