- Puta, no hi ha forma de dedicar-li temps a açò

This commit is contained in:
2025-10-29 22:03:58 +01:00
parent 107d370bfe
commit 953db90fda
6 changed files with 89 additions and 67 deletions

View File

@@ -1,5 +1,5 @@
libs = -lSDL3 libs = -lSDL3 -lGL
cppflags = -g cppflags = -g
executable = dilemmaker executable = dilemmaker
sourcepath = source sourcepath = source source/japi
buildpath = build buildpath = build

View File

@@ -67,7 +67,7 @@ int main(int argc, char *argv[])
static unsigned int current_ticks = SDL_GetTicks(); static unsigned int current_ticks = SDL_GetTicks();
bool should_exit=false; bool should_exit = !game::loop;
SDL_Event e; SDL_Event e;
while (!should_exit) while (!should_exit)
{ {

View File

@@ -1,64 +0,0 @@
#include "rooms.h"
#include <stdint.h>
#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()
{
}
}

11
source/main.cpp Normal file
View File

@@ -0,0 +1,11 @@
#include "rooms.h"
namespace game
{
int init()
{
rooms::load();
return 0;
}
}

21
source/rooms.cpp Normal file
View File

@@ -0,0 +1,21 @@
#include "rooms.h"
#include <stdint.h>
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;
}
}

View File

@@ -1,5 +1,59 @@
#pragma once #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 namespace rooms
{ {
void load(); void load();