Compare commits

..

No commits in common. "cec0f40bcf3d7391c3b0c80c43bf4605743c6c51" and "b8a542f60101c4dfece56ab8ade2fa813ee06fce" have entirely different histories.

13 changed files with 15 additions and 110 deletions

56
.vscode/tasks.json vendored
View File

@ -3,7 +3,7 @@
"tasks": [ "tasks": [
{ {
"label": "Configure", "label": "Configure",
"detail": "Configure project for current host", "detail": "Configure project",
"type": "shell", "type": "shell",
"command": "${workspaceFolder}/configure", "command": "${workspaceFolder}/configure",
"args": [ "args": [
@ -18,60 +18,6 @@
"clear": true "clear": true
} }
}, },
{
"label": "Configure for Linux",
"detail": "Configure project for Linux host",
"type": "shell",
"command": "${workspaceFolder}/configure",
"args": [
"--target-host=linux"
],
"group": "build",
"presentation": {
"echo": true,
"reveal": "always",
"focus": true,
"panel": "shared",
"showReuseMessage": true,
"clear": true
}
},
{
"label": "Configure for Windows",
"detail": "Configure project for Windows host",
"type": "shell",
"command": "${workspaceFolder}/configure",
"args": [
"--target-host=windows"
],
"group": "build",
"presentation": {
"echo": true,
"reveal": "always",
"focus": true,
"panel": "shared",
"showReuseMessage": true,
"clear": true
}
},
{
"label": "Configure for Casio Graph 90+",
"detail": "Configure project for Casio Graph 90+ host",
"type": "shell",
"command": "${workspaceFolder}/configure",
"args": [
"--target-host=fxcg50"
],
"group": "build",
"presentation": {
"echo": true,
"reveal": "always",
"focus": true,
"panel": "shared",
"showReuseMessage": true,
"clear": true
}
},
{ {
"label": "Build", "label": "Build",
"detail": "Build project", "detail": "Build project",

View File

@ -30,14 +30,14 @@ ASSET_OUTPUT = game.data
ifneq ($(DEBUG),) ifneq ($(DEBUG),)
TARGET_HOST_CFLAGS += -O1 -g -DDEBUG=$(DEBUG) -Wextra -Wall --pedantic -Wno-missing-braces \ TARGET_HOST_CFLAGS += -O1 -g -DDEBUG=$(DEBUG) -Wextra -Wall --pedantic -Wno-missing-braces \
-Wno-missing-field-initializers -Wformat=2 -Wswitch-default -Wswitch \ -Wno-missing-field-initializers -Wformat=2 -Wswitch-default -Wswitch \
-Wcast-align -Wpointer-arith -Wbad-function-cast \ -Wcast-align -Wpointer-arith -Wbad-function-cast -Wstrict-overflow=5 \
-Wstrict-prototypes -Winline -Wundef -Wnested-externs -Wcast-qual \ -Wstrict-prototypes -Winline -Wundef -Wnested-externs -Wcast-qual \
-Wshadow -Wunreachable-code -Wlogical-op -Wfloat-equal -Wstrict-aliasing=2 \ -Wshadow -Wunreachable-code -Wlogical-op -Wfloat-equal -Wstrict-aliasing=2 \
-Wredundant-decls -Wold-style-definition -Wredundant-decls -Wold-style-definition
ASSET_BUILDER_CFLAGS += -O1 -g -DDEBUG=$(DEBUG) -Wextra -Wall --pedantic -Wno-missing-braces \ ASSET_BUILDER_CFLAGS += -O1 -g -DDEBUG=$(DEBUG) -Wextra -Wall --pedantic -Wno-missing-braces \
-Wno-missing-field-initializers -Wformat=2 -Wswitch-default -Wswitch \ -Wno-missing-field-initializers -Wformat=2 -Wswitch-default -Wswitch \
-Wcast-align -Wpointer-arith -Wbad-function-cast \ -Wcast-align -Wpointer-arith -Wbad-function-cast -Wstrict-overflow=5 \
-Wstrict-prototypes -Winline -Wundef -Wnested-externs -Wcast-qual \ -Wstrict-prototypes -Winline -Wundef -Wnested-externs -Wcast-qual \
-Wshadow -Wunreachable-code -Wlogical-op -Wfloat-equal -Wstrict-aliasing=2 \ -Wshadow -Wunreachable-code -Wlogical-op -Wfloat-equal -Wstrict-aliasing=2 \
-Wredundant-decls -Wold-style-definition -Wredundant-decls -Wold-style-definition

View File

@ -19,11 +19,3 @@ Changer entre réalité et esprit, voir la construction d'un esprit critique,
l'enfant absorbe tout au début, questionne rien, et avance en se posant des questions, en cherchant des réponses, en faisant ses propres opinions, etc... l'enfant absorbe tout au début, questionne rien, et avance en se posant des questions, en cherchant des réponses, en faisant ses propres opinions, etc...
Que se soit un peu énigmes peut être, des choses à résoudre dans son esprit pour qu'il puisse s'en sortir dans la vraie vie, provoquant des scénarios différents, des réactions différentes face à ce qu'il peut vivre. Que se soit un peu énigmes peut être, des choses à résoudre dans son esprit pour qu'il puisse s'en sortir dans la vraie vie, provoquant des scénarios différents, des réactions différentes face à ce qu'il peut vivre.
Ce qu'il vit ne changerait pas mais uniquement ce qu'il en retient en quelque sorte. Ce qu'il vit ne changerait pas mais uniquement ce qu'il en retient en quelque sorte.
## Moyenne
- Routes:
- Destruction de la technologie
- Mort
- Ignorer
-

View File

@ -13,10 +13,7 @@
- [ ] Make camera use acceleration - [ ] Make camera use acceleration
- [ ] Create sub entity (parent - child)
- [ ] Create lua component - [ ] Create lua component
-[ ] Create engine lua bindings
###### Bugs ###### Bugs
@ -25,8 +22,6 @@
- [ ] Fix door component and other components (?) loading from map - [ ] Fix door component and other components (?) loading from map
- [ ] Fix map tileset texture loading
### In progress ### In progress
- [ ] Add support for fxcg50 - [ ] Add support for fxcg50

5
configure vendored
View File

@ -252,9 +252,8 @@ case "${TARGET_HOST}" in
OUTPUT_EXT="" OUTPUT_EXT=""
STATIC_LIB_OUTPUT_EXT=".a" STATIC_LIB_OUTPUT_EXT=".a"
POST_BUILD_COMMAND="sh-elf-objcopy -O binary -R .bss -R .gint_bss \$(OUTPUT) \$(OUTPUT).bin && fxgxa --g3a --name=\$(notdir \$(OUTPUT)) --icon-uns=\$(ROOT)/assets/icons/fxcg50-icon-uns.png --icon-sel=\$(ROOT)/assets/icons/fxcg50-icon-sel.png \$(OUTPUT).bin -o \$(OUTPUT).g3a" POST_BUILD_COMMAND="sh-elf-objcopy -O binary -R .bss -R .gint_bss \$(OUTPUT) \$(OUTPUT).bin && fxgxa --g3a -n 2D_Engine --icon-uns=\$(ROOT)/assets/icons/fxcg50-icon-uns.png --icon-sel=\$(ROOT)/assets/icons/fxcg50-icon-sel.png \$(OUTPUT).bin -o \$(OUTPUT).g3a"
# RUN_COMMAND="fxlink -isw \$(OUTPUT).g3a \$(ASSET_OUTPUT)" RUN_COMMAND="fxlink -isw \$(OUTPUT).g3a \$(ASSET_OUTPUT)"
RUN_COMMAND="cd \$(BUILD_DIR) && mq \$(OUTPUT).g3a"
ASSET_BUILDER_CFLAGS+=( ASSET_BUILDER_CFLAGS+=(
"-DBIGENDIAN" "-D_DEFAULT_SOURCE" "-DBIGENDIAN" "-D_DEFAULT_SOURCE"

View File

@ -8,8 +8,8 @@ void camera_init(void)
game.camera.view_rect = (rect_t) { game.camera.view_rect = (rect_t) {
.x = 0, .x = 0,
.y = 0, .y = 0,
.w = DISPLAY_WIDTH / DISPLAY_SCALE, .w = DISPLAY_WIDTH / 2,
.h = DISPLAY_HEIGHT / DISPLAY_SCALE .h = DISPLAY_HEIGHT / 2
}; };
game.camera.tracking_pos = NULL; game.camera.tracking_pos = NULL;
@ -17,19 +17,17 @@ void camera_init(void)
.x = 0, .x = 0,
.y = 0 .y = 0
}; };
game.camera.mode = CAMERA_TRACKING;
} }
void camera_update(void) void camera_update(void)
{ {
if(game.camera.mode & CAMERA_TRACKING) if(game.camera.tracking_pos)
{ {
game.camera.view_rect.x = (int)game.camera.tracking_pos->x + game.camera.tracking_center_offset.x - game.camera.view_rect.w / 2; game.camera.view_rect.x = (int)game.camera.tracking_pos->x + game.camera.tracking_center_offset.x - game.camera.view_rect.w / 2;
game.camera.view_rect.y = (int)game.camera.tracking_pos->y + game.camera.tracking_center_offset.y - game.camera.view_rect.h / 2; game.camera.view_rect.y = (int)game.camera.tracking_pos->y + game.camera.tracking_center_offset.y - game.camera.view_rect.h / 2;
} }
if(game.camera.mode & CAMERA_BOUND_MAP) if(game.map)
{ {
if(game.camera.view_rect.w > game.map->width * TILE_SIZE) if(game.camera.view_rect.w > game.map->width * TILE_SIZE)
{ {

View File

@ -3,17 +3,10 @@
#include "vector2d.h" #include "vector2d.h"
typedef enum camera_mode_t {
CAMERA_STATIC = 0x0000,
CAMERA_TRACKING = 0x0001,
CAMERA_BOUND_MAP = 0x0010,
} camera_mode_t;
typedef struct camera_t { typedef struct camera_t {
rect_t view_rect; rect_t view_rect;
fvector2d_t *tracking_pos; fvector2d_t *tracking_pos;
vector2d_t tracking_center_offset; vector2d_t tracking_center_offset;
camera_mode_t mode;
} camera_t; } camera_t;
void camera_init(void); void camera_init(void);

View File

@ -33,29 +33,12 @@ inline int display_update(void)
inline int display_draw_texture(texture_t *texture, const rect_t *src_rect, const rect_t *dst_rect, bool flip) inline int display_draw_texture(texture_t *texture, const rect_t *src_rect, const rect_t *dst_rect, bool flip)
{ {
rect_t display_rect; dsubimage_rgb16_effect((int)dst_rect->x, (int)dst_rect->y, texture, (int)src_rect->x, (int)src_rect->y, (int)src_rect->w, (int)src_rect->h, flip ? IMAGE_HFLIP : DIMAGE_NONE);
if(dst_rect) display_rect = (rect_t) {
.x = (dst_rect->x - game.camera.view_rect.x) * (DISPLAY_WIDTH / game.camera.view_rect.w),
.y = (dst_rect->y - game.camera.view_rect.y) * (DISPLAY_HEIGHT / game.camera.view_rect.h),
.w = dst_rect->w * (DISPLAY_WIDTH / game.camera.view_rect.w),
.h = dst_rect->h * (DISPLAY_HEIGHT / game.camera.view_rect.h)
};
dsubimage_rgb16_effect(dst_rect ? display_rect.x : 0, dst_rect ? display_rect.y : 0, texture, (int)src_rect->x, (int)src_rect->y, (int)src_rect->w, (int)src_rect->h, flip ? IMAGE_HFLIP : DIMAGE_NONE);
return SUCCESS; return SUCCESS;
} }
inline int display_draw_frect(const frect_t *frect, unsigned int r, unsigned int g, unsigned int b, unsigned int a) inline int display_draw_frect(const frect_t *frect, unsigned int r, unsigned int g, unsigned int b, unsigned int a)
{ {
rect_t display_rect = { drect((int)frect->x, (int)frect->y, (int)(frect->x + frect->w), (int)(frect->y + frect->h), (r >> 3 ) | (g >> 2) | (g >> 3));
.x = (frect->x - game.camera.view_rect.x) * (DISPLAY_WIDTH / game.camera.view_rect.w),
.y = (frect->y - game.camera.view_rect.y) * (DISPLAY_HEIGHT / game.camera.view_rect.h),
.w = frect->w * (DISPLAY_WIDTH / game.camera.view_rect.w),
.h = frect->h * (DISPLAY_HEIGHT / game.camera.view_rect.h)
};
drect_border(display_rect.x, display_rect.y, (display_rect.x + display_rect.w), (display_rect.y + display_rect.h), C_NONE, 1, a ? C_RGB(r, g, b) : C_NONE);
return SUCCESS; return SUCCESS;
} }

View File

@ -13,7 +13,6 @@
#define DISPLAY_WIDTH DWIDTH #define DISPLAY_WIDTH DWIDTH
#define DISPLAY_HEIGHT DHEIGHT #define DISPLAY_HEIGHT DHEIGHT
#define DISPLAY_SCALE 1
typedef int display_t; typedef int display_t;

View File

@ -154,7 +154,8 @@ int display_draw_texture(texture_t *texture, const rect_t *src_rect, const rect_
if(src_rect) rect_to_frect(src_rect, &src_frect); if(src_rect) rect_to_frect(src_rect, &src_frect);
frect_t dst_frect; frect_t dst_frect;
if(dst_rect) dst_frect = (frect_t) { if(dst_rect)
dst_frect = (frect_t) {
.x = (dst_rect->x - game.camera.view_rect.x) * (DISPLAY_WIDTH / game.camera.view_rect.w), .x = (dst_rect->x - game.camera.view_rect.x) * (DISPLAY_WIDTH / game.camera.view_rect.w),
.y = (dst_rect->y - game.camera.view_rect.y) * (DISPLAY_HEIGHT / game.camera.view_rect.h), .y = (dst_rect->y - game.camera.view_rect.y) * (DISPLAY_HEIGHT / game.camera.view_rect.h),
.w = dst_rect->w * (DISPLAY_WIDTH / game.camera.view_rect.w), .w = dst_rect->w * (DISPLAY_WIDTH / game.camera.view_rect.w),

View File

@ -13,7 +13,6 @@
#define DISPLAY_WIDTH 720 #define DISPLAY_WIDTH 720
#define DISPLAY_HEIGHT 480 #define DISPLAY_HEIGHT 480
#define DISPLAY_SCALE 2
typedef struct display_t { typedef struct display_t {
SDL_Window *window; SDL_Window *window;

View File

@ -471,6 +471,6 @@ int map_display_hitboxes(void)
} }
} }
return SUCCESS; return EXIT_SUCCESS;
} }
#endif // DEBUG > 1 #endif // DEBUG > 1

View File

@ -55,7 +55,7 @@ inline int interact_component_draw(const component_t *component)
if(display_draw_frect(&component_data->bounds, COLOR_GREEN, 128)) return_failure_int; if(display_draw_frect(&component_data->bounds, COLOR_GREEN, 128)) return_failure_int;
return SUCCESS; return EXIT_SUCCESS;
} }
#endif // DEBUG >= 2 #endif // DEBUG >= 2