diff --git a/lagueirtofile b/lagueirtofile index 5beb0e6..4d7a2e9 100644 --- a/lagueirtofile +++ b/lagueirtofile @@ -1,5 +1,5 @@ -libs = -lSDL3 +libs = -lSDL3 -lGL cppflags = -g executable = dilemmaker -sourcepath = source +sourcepath = source source/japi buildpath = build diff --git a/source/japi/game.cpp b/source/japi/game.cpp index 51a6736..d31e585 100644 --- a/source/japi/game.cpp +++ b/source/japi/game.cpp @@ -67,7 +67,7 @@ int main(int argc, char *argv[]) static unsigned int current_ticks = SDL_GetTicks(); - bool should_exit=false; + bool should_exit = !game::loop; SDL_Event e; while (!should_exit) { diff --git a/source/japi/rooms.cpp b/source/japi/rooms.cpp deleted file mode 100644 index bc56896..0000000 --- a/source/japi/rooms.cpp +++ /dev/null @@ -1,64 +0,0 @@ -#include "rooms.h" -#include - -#define COLOR_BLACK 0 -#define COLOR_BRIGHT_BLACK 1 -#define COLOR_BLUE 2 -#define COLOR_BRIGHT_BLUE 3 -#define COLOR_RED 4 -#define COLOR_BRIGHT_RED 5 -#define COLOR_MAGENTA 6 -#define COLOR_BRIGHT_MAGENTA 7 -#define COLOR_GREEN 8 -#define COLOR_BRIGHT_GREEN 9 -#define COLOR_CYAN 10 -#define COLOR_BRIGHT_CYAN 11 -#define COLOR_YELLOW 12 -#define COLOR_BRIGHT_YELLOW 13 -#define COLOR_WHITE 14 -#define COLOR_BRIGHT_WHITE 15 - -namespace rooms -{ - static const char *paletteMap[] = { - "black", "bright_black", "blue", "bright_blue", - "red", "bright_red", "magenta", "bright_magenta", - "green", "bright_green", "cyan", "bright_cyan", - "yellow", "bright_yellow", "white", "bright_white" - }; - - struct enemy_t - { - char *animation {nullptr}; - uint8_t width {0}; - uint8_t height {0}; - uint8_t x {0}; - uint8_t y {0}; - uint8_t vx {0}; - uint8_t vy {0}; - uint8_t x1 {0}; - uint8_t y1 {0}; - uint8_t x2 {0}; - uint8_t y2 {0}; - uint8_t color {COLOR_WHITE}; - }; - - struct room_t - { - char *name {nullptr}; - uint8_t bgColor {COLOR_BLACK}; - uint8_t border {COLOR_BLACK}; - char *tileMapFile {nullptr}; - char *tileSetFile {nullptr}; - uint8_t roomUp {0}; - uint8_t roomDown {0}; - uint8_t roomLeft {0}; - uint8_t roomRight {0}; - enemy_t *enemies; - }; - - void load() - { - - } -} diff --git a/source/main.cpp b/source/main.cpp new file mode 100644 index 0000000..20b4d32 --- /dev/null +++ b/source/main.cpp @@ -0,0 +1,11 @@ +#include "rooms.h" + +namespace game +{ + int init() + { + rooms::load(); + + return 0; + } +} \ No newline at end of file diff --git a/source/rooms.cpp b/source/rooms.cpp new file mode 100644 index 0000000..415ff62 --- /dev/null +++ b/source/rooms.cpp @@ -0,0 +1,21 @@ +#include "rooms.h" +#include + +namespace rooms +{ + static const char *paletteMap[] = { + "black", "bright_black", "blue", "bright_blue", + "red", "bright_red", "magenta", "bright_magenta", + "green", "bright_green", "cyan", "bright_cyan", + "yellow", "bright_yellow", "white", "bright_white" + }; + + void load() + { + //fs::path target_dir = "./data/room"; + + int room_num = 1; + + + } +} diff --git a/source/rooms.h b/source/rooms.h index 66d9ee9..ce03350 100644 --- a/source/rooms.h +++ b/source/rooms.h @@ -1,5 +1,59 @@ #pragma once +#define COLOR_BLACK 0 +#define COLOR_BRIGHT_BLACK 1 +#define COLOR_BLUE 2 +#define COLOR_BRIGHT_BLUE 3 +#define COLOR_RED 4 +#define COLOR_BRIGHT_RED 5 +#define COLOR_MAGENTA 6 +#define COLOR_BRIGHT_MAGENTA 7 +#define COLOR_GREEN 8 +#define COLOR_BRIGHT_GREEN 9 +#define COLOR_CYAN 10 +#define COLOR_BRIGHT_CYAN 11 +#define COLOR_YELLOW 12 +#define COLOR_BRIGHT_YELLOW 13 +#define COLOR_WHITE 14 +#define COLOR_BRIGHT_WHITE 15 + +struct enemy_t +{ + char *animation {nullptr}; + uint8_t x {0}; + uint8_t y {0}; + float vx {0.0f}; + float vy {0.0f}; + uint8_t x1 {0}; + uint8_t y1 {0}; + uint8_t x2 {0}; + uint8_t y2 {0}; + uint8_t color {COLOR_WHITE}; +}; + +struct item_t +{ + uint8_t tile {0}; + uint8_t x {0}; + uint8_t y {0}; + float counter {0.0f}; +}; + +struct room_t +{ + char *name {nullptr}; + uint8_t bgColor {COLOR_BLACK}; + uint8_t border {COLOR_BLACK}; + char *tileMapFile {nullptr}; + char *tileSetFile {nullptr}; + uint8_t roomUp {0}; + uint8_t roomDown {0}; + uint8_t roomLeft {0}; + uint8_t roomRight {0}; + enemy_t *enemies; + item_t *items; +}; + namespace rooms { void load();