Compare commits
No commits in common. "bc5c88beb7bbfa08d73e10ebd3611f2dc14426fb" and "c8e297265f2b048c313ef46d903ebfef69e974f6" have entirely different histories.
bc5c88beb7
...
c8e297265f
10
main.c
10
main.c
|
@ -64,9 +64,9 @@ int main(void)
|
|||
load_sfx(&engine, "snd_launch", ARROW_RELEASE_SFX);
|
||||
load_sfx(&engine, "snd_launch", BOMB_RELEASE_SFX);
|
||||
|
||||
OptionScene_t options_scene;
|
||||
options_scene.scene.engine = &engine;
|
||||
init_options_scene(&options_scene);
|
||||
LevelScene_t sandbox_scene;
|
||||
sandbox_scene.scene.engine = &engine;
|
||||
init_sandbox_scene(&sandbox_scene);
|
||||
|
||||
LevelScene_t level_scene;
|
||||
level_scene.scene.engine = &engine;
|
||||
|
@ -99,7 +99,7 @@ int main(void)
|
|||
scenes[MAIN_MENU_SCENE] = &menu_scene.scene;
|
||||
scenes[LEVEL_SELECT_SCENE] = &level_sel_scene.scene;
|
||||
scenes[GAME_SCENE] = &level_scene.scene;
|
||||
scenes[OPTIONS_SCENE] = &options_scene.scene;
|
||||
scenes[SANDBOX_SCENE] = &sandbox_scene.scene;
|
||||
change_scene(&engine, MAIN_MENU_SCENE);
|
||||
|
||||
const float DT = 1.0f/60.0f;
|
||||
|
@ -130,7 +130,7 @@ int main(void)
|
|||
sc_queue_clear(&key_buffer);
|
||||
}
|
||||
}
|
||||
free_options_scene(&options_scene);
|
||||
free_sandbox_scene(&sandbox_scene);
|
||||
free_game_scene(&level_scene);
|
||||
free_level_select_scene(&level_sel_scene);
|
||||
free_menu_scene(&menu_scene);
|
||||
|
|
|
@ -79,7 +79,6 @@ else:
|
|||
fileparts[-1] = "lvldata"
|
||||
converted_filename = '.'.join(fileparts)
|
||||
|
||||
max_n_tiles = 0
|
||||
# Each level should be packed as: [width, 2 bytes][height, 2 bytes][tile_type,entity,water,padding 1,1,1,1 bytes][tile_type,entity,water,padding 1,1,1,1 bytes]...
|
||||
with open(converted_filename, 'wb+') as out_file:
|
||||
out_file.write(struct.pack("<I", n_levels))
|
||||
|
@ -114,7 +113,6 @@ with open(converted_filename, 'wb+') as out_file:
|
|||
width = level_layout["__cWid"]
|
||||
height = level_layout["__cHei"]
|
||||
print(f"Dim.: {width}x{height}. N Tiles: {width * height}")
|
||||
max_n_tiles = max(max_n_tiles, width*height)
|
||||
# Create a W x H array of tile information
|
||||
n_tiles = width * height
|
||||
tiles_info = [[0,0,0] for _ in range(n_tiles)]
|
||||
|
@ -156,4 +154,3 @@ with open(converted_filename, 'wb+') as out_file:
|
|||
# print(tiles_info[y*width + x], end=" ")
|
||||
# print()
|
||||
|
||||
print("Largest number of tiles:", max_n_tiles)
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
#!/bin/bash
|
||||
source venv/bin/activate
|
||||
python ldtk_repacker.py $1.ldtk && zstd $1.lvldata
|
||||
python ldtk_repacker.py $1.ldtk && zstd $1.lvldata && python level_render.py $1.ldtk
|
||||
|
|
|
@ -5,7 +5,6 @@ add_library(lib_scenes STATIC
|
|||
water_flow.c
|
||||
editor_scene.c
|
||||
menu_scene.c
|
||||
options_scene.c
|
||||
level_select_scene.c
|
||||
game_scene.c
|
||||
game_systems.c
|
||||
|
|
|
@ -44,7 +44,7 @@ typedef enum SceneType {
|
|||
MAIN_MENU_SCENE = 0,
|
||||
LEVEL_SELECT_SCENE,
|
||||
GAME_SCENE,
|
||||
OPTIONS_SCENE,
|
||||
SANDBOX_SCENE,
|
||||
}SceneType_t;
|
||||
|
||||
#endif
|
||||
|
|
|
@ -23,7 +23,7 @@ static void menu_scene_render_func(Scene_t* scene)
|
|||
};
|
||||
DrawTextEx(*menu_font, "Bunny's Spelunking Adventure", title_pos, 56, 0, BLACK);
|
||||
|
||||
const char* OPTIONS[3] = {"Start", "Options", "Exit"};
|
||||
const char* OPTIONS[3] = {"Start", "Credits", "Exit"};
|
||||
for (uint8_t i = 0; i < 3; ++i)
|
||||
{
|
||||
Vector2 pos = (Vector2){data->buttons[i].bbox.x, data->buttons[i].bbox.y};
|
||||
|
@ -55,9 +55,6 @@ static void exec_component_function(Scene_t* scene, int sel)
|
|||
case 0:
|
||||
change_scene(scene->engine, LEVEL_SELECT_SCENE);
|
||||
break;
|
||||
case 1:
|
||||
change_scene(scene->engine, OPTIONS_SCENE);
|
||||
break;
|
||||
case 2:
|
||||
scene->state = 0;
|
||||
break;
|
||||
|
|
|
@ -1,72 +0,0 @@
|
|||
#include "scene_impl.h"
|
||||
#include "assets_tag.h"
|
||||
#include <stdio.h>
|
||||
|
||||
static void options_scene_render_func(Scene_t* scene)
|
||||
{
|
||||
//OptionSceneData_t* data = &(CONTAINER_OF(scene, OptionScene_t, scene)->data);
|
||||
|
||||
int key;
|
||||
ActionType_t action;
|
||||
char buffer[16];
|
||||
int y_offset = 16;
|
||||
|
||||
BeginTextureMode(scene->layers.render_layers[0].layer_tex);
|
||||
sc_map_foreach(&scene->engine->keybinds, action, key) {
|
||||
sprintf(buffer, "Action %d : %d", action, key);
|
||||
DrawText(buffer, 32, y_offset, 12, WHITE);
|
||||
y_offset += 12;
|
||||
}
|
||||
float vol = GetMasterVolume();
|
||||
sprintf(buffer, "Volume : %.1f", vol);
|
||||
DrawText(buffer, 32, y_offset, 12, WHITE);
|
||||
EndTextureMode();
|
||||
}
|
||||
|
||||
static void options_do_action(Scene_t* scene, ActionType_t action, bool pressed)
|
||||
{
|
||||
switch(action)
|
||||
{
|
||||
case ACTION_EXIT:
|
||||
if (!pressed)
|
||||
{
|
||||
if(scene->engine != NULL)
|
||||
{
|
||||
change_scene(scene->engine, MAIN_MENU_SCENE);
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void init_options_scene(OptionScene_t* scene)
|
||||
{
|
||||
init_scene(&scene->scene, &options_do_action, 0);
|
||||
scene->scene.bg_colour = BLACK;
|
||||
add_scene_layer(
|
||||
&scene->scene, scene->scene.engine->intended_window_size.x,
|
||||
scene->scene.engine->intended_window_size.y,
|
||||
(Rectangle){
|
||||
0, 0,
|
||||
scene->scene.engine->intended_window_size.x,
|
||||
scene->scene.engine->intended_window_size.y
|
||||
}
|
||||
);
|
||||
sc_array_add(&scene->scene.systems, &options_scene_render_func);
|
||||
|
||||
sc_map_put_64(&scene->scene.action_map, get_keybind_or_default(scene->scene.engine, ACTION_UP, KEY_UP), ACTION_UP);
|
||||
sc_map_put_64(&scene->scene.action_map, get_keybind_or_default(scene->scene.engine, ACTION_DOWN, KEY_DOWN), ACTION_DOWN);
|
||||
sc_map_put_64(&scene->scene.action_map, get_keybind_or_default(scene->scene.engine, ACTION_LEFT, KEY_LEFT), ACTION_LEFT);
|
||||
sc_map_put_64(&scene->scene.action_map, get_keybind_or_default(scene->scene.engine, ACTION_RIGHT, KEY_RIGHT), ACTION_RIGHT);
|
||||
sc_map_put_64(&scene->scene.action_map, get_keybind_or_default(scene->scene.engine, ACTION_JUMP, KEY_ENTER), ACTION_CONFIRM);
|
||||
sc_map_put_64(&scene->scene.action_map, get_keybind_or_default(scene->scene.engine, ACTION_EXIT, KEY_Q), ACTION_EXIT);
|
||||
|
||||
sc_map_put_64(&scene->scene.action_map, KEY_BACKSPACE, ACTION_EXIT);
|
||||
}
|
||||
|
||||
void free_options_scene(OptionScene_t* scene)
|
||||
{
|
||||
free_scene(&scene->scene);
|
||||
}
|
|
@ -134,25 +134,9 @@ typedef struct LevelSelectScene {
|
|||
Scene_t scene;
|
||||
LevelSelectSceneData_t data;
|
||||
} LevelSelectScene_t;
|
||||
|
||||
enum OptionSceneMode {
|
||||
OPTIONS_NORMAL_MODE,
|
||||
OPTIONS_KEYBIND_MODE,
|
||||
};
|
||||
typedef struct OptionSceneData {
|
||||
|
||||
}OptionSceneData_t;
|
||||
|
||||
typedef struct OptionScene {
|
||||
Scene_t scene;
|
||||
OptionSceneData_t data;
|
||||
}OptionScene_t;
|
||||
|
||||
void init_menu_scene(MenuScene_t* scene);
|
||||
void free_menu_scene(MenuScene_t* scene);
|
||||
void init_level_select_scene(LevelSelectScene_t* scene);
|
||||
void free_level_select_scene(LevelSelectScene_t* scene);
|
||||
void init_options_scene(OptionScene_t* scene);
|
||||
void free_options_scene(OptionScene_t* scene);
|
||||
|
||||
#endif // __SCENE_IMPL_H
|
||||
|
|
Loading…
Reference in New Issue