summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorrealtradam <[email protected]>2023-07-04 21:16:55 -0400
committerrealtradam <[email protected]>2023-07-04 21:16:55 -0400
commit75055dad88170fc40bd86d36eb2017f8370db06f (patch)
tree83a446fcfa50324cbaa9a7662982a8abe7513096
parentdd23de338c504b18ca1fe572772fd046096607eb (diff)
downloadrodeo_sample_game-75055dad88170fc40bd86d36eb2017f8370db06f.tar.gz
rodeo_sample_game-75055dad88170fc40bd86d36eb2017f8370db06f.zip
initial non-working rmlui attemptrmlui
-rw-r--r--assets/DigitalDisco.ttfbin0 -> 44088 bytes
-rw-r--r--assets/demo.html71
-rwxr-xr-xbuild2
m---------external/RodeoKit0
-rw-r--r--src/main.c118
5 files changed, 138 insertions, 53 deletions
diff --git a/assets/DigitalDisco.ttf b/assets/DigitalDisco.ttf
new file mode 100644
index 0000000..303cf6c
--- /dev/null
+++ b/assets/DigitalDisco.ttf
Binary files 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 @@
+<rml>
+<head>
+<title>Example</title>
+<style>
+ body
+ {
+ position: absolute;
+ width: 100%;
+ height: 100%;
+ font-family: DigitalDisco;
+ }
+@keyframes animate {
+ 0% {
+ transform: rotateX(0deg);
+ background-color: orange;
+ }
+ 10% {
+ transform: rotateX(0deg);
+ background-color: orange;
+ }
+ 50% {
+ transform: rotateX(-30deg);
+ background-color: blue;
+ }
+ 90% {
+ transform: rotateX(0deg);
+ background-color: orange;
+ }
+ 100% {
+ transform: rotateX(0deg);
+ background-color: orange;
+ }
+}
+ div
+ {
+ font-family: DigitalDisco;
+ display: block;
+ background-color: #f00;
+ font-size: 16px;
+ border: 1px;
+ border-radius: 30px;
+ border-color: red;
+ }
+ p
+ {
+ font-family: DigitalDisco;
+ color: #fff;
+ font-size: 16px;
+ }
+ button {
+ font-size: 16px;
+ font-family: DigitalDisco;
+ color: black;
+ background-color: orange;
+ }
+ button:hover {background-color: #3e8e41}
+ button:active {background-color: #41ff41}
+</style>
+<!-- animation: 2s linear infinite animate; -->
+</head>
+<body>
+ <div>
+ <button>
+ Play
+ </button>
+ <button id="reset">
+ Reset
+ </button>
+ </div>
+</body>
+</rml>
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
-Subproject c322c17a69fc756b494124d4deab6909ee9134c
+Subproject 8c2ef4e65b80aa6da080e68b64776d7c1a088d2
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 <inttypes.h>
#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;