From 75055dad88170fc40bd86d36eb2017f8370db06f Mon Sep 17 00:00:00 2001 From: realtradam Date: Tue, 4 Jul 2023 21:16:55 -0400 Subject: initial non-working rmlui attempt --- assets/DigitalDisco.ttf | Bin 0 -> 44088 bytes assets/demo.html | 71 +++++++++++++++++++++++++++++ build | 2 +- external/RodeoKit | 2 +- src/main.c | 118 +++++++++++++++++++++++++++--------------------- 5 files changed, 139 insertions(+), 54 deletions(-) create mode 100644 assets/DigitalDisco.ttf create mode 100644 assets/demo.html diff --git a/assets/DigitalDisco.ttf b/assets/DigitalDisco.ttf new file mode 100644 index 0000000..303cf6c Binary files /dev/null and b/assets/DigitalDisco.ttf differ diff --git a/assets/demo.html b/assets/demo.html new file mode 100644 index 0000000..86903e1 --- /dev/null +++ b/assets/demo.html @@ -0,0 +1,71 @@ + + +Example + + + + +
+ + +
+ +
diff --git a/build b/build index 2e2e93e..2561e92 100755 --- a/build +++ b/build @@ -1,3 +1,3 @@ #! /bin/sh -cd build_dir/tux ; make +cd build_dir/tux ; make -j4 #cd build_dir/web ; emmake make diff --git a/external/RodeoKit b/external/RodeoKit index c322c17..8c2ef4e 160000 --- a/external/RodeoKit +++ b/external/RodeoKit @@ -1 +1 @@ -Subproject commit c322c17a69fc756b494124d4deab6909ee9134cb +Subproject commit 8c2ef4e65b80aa6da080e68b64776d7c1a088d2d diff --git a/src/main.c b/src/main.c index 0148844..c0a8295 100644 --- a/src/main.c +++ b/src/main.c @@ -1,5 +1,6 @@ #include "rodeo.h" +#include "rodeo/rmlui.h" #include #include "input.h" @@ -9,6 +10,8 @@ float time_var; rodeo_audio_sound_t scratch = {0}; rodeo_audio_music_t music = {0}; +rodeo_rmlui_document_t rml_doc = {0}; + rodeo_gfx_camera_2d_t camera = { .target = (rodeo_math_vec2_t){ .val.x = -640.0f/2, .val.y = -480.0f/2 }, //.target = (rodeo_math_vec2_t){ .val.x = 0, .val.y = 0 }, @@ -387,6 +390,10 @@ main_loop(void) num_of_units ); */ + + rodeo_rmlui_update(); + rodeo_rmlui_render(); + rodeo_rectangle_t letter_first = rodeo_gfx_letterbox_first_get(); rodeo_rectangle_t letter_second = rodeo_gfx_letterbox_second_get(); @@ -414,58 +421,65 @@ main(void) ); mrodeo_do(640, 480, cstr_lit("Rodeo Window"), 4) { - renderer = rodeo_gfx_renderer_name_get(); - rodeo_gfx_frame_limit_set(60); - - //texture = rodeo_texture_2d_create_from_RGBA8( - // 2, - // 2, - // texture_memory - //); - - world_orc = rodeo_collision_2d_collection_create(1); - world_other = rodeo_collision_2d_collection_create(2); - - rodeo_collision_2d_item_data_t orc_collision_params = { - .rect = { - .x = summon_position.x, - .y = summon_position.y, - .width = orc_size[0], - .height = orc_size[1] - } - }; - orc_collision_id = (*rodeo_collision_2d_item_create(world_orc, orc_collision_params).data_handle)->id; - - rodeo_collision_2d_item_data_t test_collision_params = { - .rect = { - .x = 320, - .y = 240, - .width = orc_size[0], - .height = orc_size[1] - } - }; - box_collision_ids[0] = (*rodeo_collision_2d_item_create(world_orc, test_collision_params).data_handle)->id; - rodeo_collision_2d_item_data_t test2_collision_params = { - .rect = { - .x = 0, - .y = 240, - .width = orc_size[0], - .height = orc_size[1] - } - }; - box_collision_ids[1] = (*rodeo_collision_2d_item_create(world_orc, test2_collision_params).data_handle)->id; - - texture = rodeo_gfx_texture_2d_create_from_path(cstr_lit("assets/orc.png")); - //scratch = rodeo_audio_sound_create_from_path(cstr_lit("assets/sample.wav")); - //music = rodeo_audio_music_create_from_path(cstr_lit("assets/music.ogg")); - - rodeo_mainLoop_run( - main_loop - ); - - rodeo_gfx_texture_2d_destroy(texture); - rodeo_collision_2d_collection_destroy(world_orc); - rodeo_collision_2d_collection_destroy(world_other); + mrodeo_rmlui_do() + { + //rodeo_rmlui_font_load(cstr_lit("assets/DigitalDisco.ttf")); + rml_doc = rodeo_rmlui_document_load(cstr_lit("assets/demo.html")); + rodeo_rmlui_document_show(rml_doc); + + renderer = rodeo_gfx_renderer_name_get(); + rodeo_gfx_frame_limit_set(60); + + //texture = rodeo_texture_2d_create_from_RGBA8( + // 2, + // 2, + // texture_memory + //); + + world_orc = rodeo_collision_2d_collection_create(1); + world_other = rodeo_collision_2d_collection_create(2); + + rodeo_collision_2d_item_data_t orc_collision_params = { + .rect = { + .x = summon_position.x, + .y = summon_position.y, + .width = orc_size[0], + .height = orc_size[1] + } + }; + orc_collision_id = (*rodeo_collision_2d_item_create(world_orc, orc_collision_params).data_handle)->id; + + rodeo_collision_2d_item_data_t test_collision_params = { + .rect = { + .x = 320, + .y = 240, + .width = orc_size[0], + .height = orc_size[1] + } + }; + box_collision_ids[0] = (*rodeo_collision_2d_item_create(world_orc, test_collision_params).data_handle)->id; + rodeo_collision_2d_item_data_t test2_collision_params = { + .rect = { + .x = 0, + .y = 240, + .width = orc_size[0], + .height = orc_size[1] + } + }; + box_collision_ids[1] = (*rodeo_collision_2d_item_create(world_orc, test2_collision_params).data_handle)->id; + + texture = rodeo_gfx_texture_2d_create_from_path(cstr_lit("assets/orc.png")); + //scratch = rodeo_audio_sound_create_from_path(cstr_lit("assets/sample.wav")); + //music = rodeo_audio_music_create_from_path(cstr_lit("assets/music.ogg")); + + rodeo_mainLoop_run( + main_loop + ); + + rodeo_gfx_texture_2d_destroy(texture); + rodeo_collision_2d_collection_destroy(world_orc); + rodeo_collision_2d_collection_destroy(world_other); + } } } return 0; -- cgit v1.2.3