Skip to content

Commit 0edd091

Browse files
committed
[update][fix][redo] moving old code and adding memory-safety new model
now EKG is actually unstable, and not viable to build, untill feature is complete
1 parent 0fd089a commit 0edd091

24 files changed

+1668
-1003
lines changed

CMakeLists.txt

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,17 +51,23 @@ elseif(EKG_EMSCRIPTEN_BUILD_TYPE)
5151
message(FATAL_ERROR "No specialized toolchain ID was found with '/Emscripten' for WASM build-type")
5252
endif()
5353

54-
if(
54+
if(EKG_EMSCRIPTEN_BUILD_TYPE)
55+
set(COMPILE_OPTIMIZATION_NUMBER -O3)
56+
elseif(
5557
CMAKE_CXX_COMPILER_ID STREQUAL "GNU"
5658
OR
5759
CMAKE_CXX_COMPILER_ID STREQUAL "Clang"
58-
OR
59-
EKG_EMSCRIPTEN_BUILD_TYPE
6060
)
61-
add_compile_options(-Wall -Wextra -g)
62-
add_compile_options(-O3)
61+
set(COMPILE_OPTIMIZATION_NUMBER -O3)
6362
endif()
6463

64+
add_compile_options(
65+
${COMPILE_OPTIMIZATION_NUMBER}
66+
-Wall
67+
-Wextra
68+
-g
69+
)
70+
6571
message(STATUS "Found compiler ID: ${CMAKE_CXX_COMPILER_ID}")
6672

6773
include_directories(./include)
@@ -102,6 +108,14 @@ set_target_properties(
102108
CXX_STANDARD 17
103109
)
104110

111+
if(EKG_EMSCRIPTEN_BUILD_TYPE)
112+
set_target_properties(
113+
ekg
114+
PROPERTIES
115+
LINK_FLAGS -sALLOW_MEMORY_GROWTH=1
116+
)
117+
endif()
118+
105119
message(STATUS "EKG native library building done")
106120

107121
if(LINUX OR EKG_FORCE_LINUX)

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
EKG is a retained UI-toolkit/UI library to create fancy high-perfmance GUIs, always looking for low-specs hardware.
44

5-
Documentation: [here](https://docs.hdoc.io/vokegpu/ekg/)
5+
Library documentation and project documentation: [here](https://docs.hdoc.io/vokegpu/ekg/)
6+
Development documentation: [here](https://github.com/vokegpu/ekg-docs)
67
Development updates: [here](https://github.com/orgs/gamedevs-do-apocalipse/discussions/5)
78

89
Please before cloning EKG, insert `--depth 1` flag, or you will clone almost 1gb (yeah this is bizzare, soon EKG MUST fix it filtering the repository).

include/ekg/core/memory.hpp

Lines changed: 0 additions & 7 deletions
This file was deleted.

include/ekg/core/oldruntime.hpp

Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
/**
2+
* MIT License
3+
*
4+
* Copyright (c) 2022-2024 Rina Wilk / [email protected]
5+
*
6+
* Permission is hereby granted, free of charge, to any person obtaining a copy
7+
* of this software and associated documentation files (the "Software"), to deal
8+
* in the Software without restriction, including without limitation the rights
9+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
* copies of the Software, and to permit persons to whom the Software is
11+
* furnished to do so, subject to the following conditions:
12+
*
13+
* The above copyright notice and this permission notice shall be included in all
14+
* copies or substantial portions of the Software.
15+
*
16+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22+
* SOFTWARE.
23+
*/
24+
25+
#ifndef EKG_CORE_H
26+
#define EKG_CORE_H
27+
28+
#include <unordered_map>
29+
30+
#include "ekg/ui/abstract/ui_abstract_widget.hpp"
31+
#include "ekg/service/handler.hpp"
32+
#include "ekg/draw/font_renderer.hpp"
33+
#include "ekg/service/theme.hpp"
34+
#include "ekg/service/input.hpp"
35+
#include "ekg/util/io.hpp"
36+
#include "ekg/util/gui.hpp"
37+
#include "ekg/gpu/api.hpp"
38+
#include "ekg/layout/docknize.hpp"
39+
40+
namespace ekg {
41+
extern struct current_hovered_state {
42+
public:
43+
int32_t id {};
44+
int32_t up {};
45+
int32_t down {};
46+
ekg::type type {};
47+
ekg::type down_type {};
48+
ekg::type up_type {};
49+
int32_t swap {};
50+
int32_t last {};
51+
} hovered;
52+
53+
class runtime {
54+
private:
55+
static ekg::stack collect;
56+
static ekg::stack back;
57+
static ekg::stack front;
58+
private:
59+
std::unordered_map<int32_t, ekg::ui::abstract_widget*> widget_map {};
60+
61+
std::vector<ekg::ui::abstract_widget*> update_widget_list {};
62+
std::vector<ekg::ui::abstract_widget*> loaded_widget_list {};
63+
std::vector<ekg::ui::abstract_widget*> refresh_widget_list {};
64+
65+
std::vector<ekg::ui::abstract_widget*> reload_widget_list {};
66+
uint64_t reload_widget_counter {};
67+
68+
std::vector<ekg::ui::abstract_widget*> synclayout_widget_list {};
69+
uint64_t synclayout_widget_counter {};
70+
71+
ekg::ui::abstract *p_current_ui_container {};
72+
ekg::ui::abstract_widget *p_abs_activity_widget {};
73+
ekg::stack *p_current_stack {};
74+
75+
int32_t token_id {};
76+
bool enable_high_priority_frequency {};
77+
public:
78+
ekg::service::input service_input {};
79+
ekg::service::theme service_theme {};
80+
ekg::service::handler service_handler {};
81+
public:
82+
ekg::draw::font_renderer f_renderer_small {};
83+
ekg::draw::font_renderer f_renderer_normal {};
84+
ekg::draw::font_renderer f_renderer_big {};
85+
86+
ekg::timing ui_scroll_timing {};
87+
ekg::timing ui_timing {};
88+
ekg::os::io_event_serial io_event_serial {};
89+
90+
ekg::os::platform *p_os_platform {};
91+
ekg::gpu::api *p_gpu_api {};
92+
ekg::gpu::allocator gpu_allocator {};
93+
94+
ekg::layout::mask mask {};
95+
protected:
96+
void prepare_tasks();
97+
98+
void prepare_ui_env();
99+
100+
void erase(int32_t id);
101+
public:
102+
void set_current_stack(ekg::stack *p_stack);
103+
104+
ekg::ui::abstract_widget *get_fast_widget_by_id(int32_t id);
105+
106+
void gen_widget(ekg::ui::abstract *p_ui);
107+
108+
void do_task_reload(ekg::ui::abstract_widget *widget);
109+
110+
void do_task_synclayout(ekg::ui::abstract_widget *widget);
111+
112+
void do_task_refresh(ekg::ui::abstract_widget *widget);
113+
114+
void set_update_high_frequency(ekg::ui::abstract_widget *widget);
115+
116+
bool has_bind_group_flag();
117+
118+
void end_group_flag();
119+
120+
void end_group_parent_flag();
121+
122+
void update_size_changed();
123+
124+
void init();
125+
126+
void quit();
127+
128+
void process_event();
129+
130+
void process_update();
131+
132+
void process_render();
133+
};
134+
};
135+
136+
#endif

include/ekg/core/runtime.hpp

Lines changed: 20 additions & 123 deletions
Original file line numberDiff line numberDiff line change
@@ -1,136 +1,33 @@
1-
/**
2-
* MIT License
3-
*
4-
* Copyright (c) 2022-2024 Rina Wilk / [email protected]
5-
*
6-
* Permission is hereby granted, free of charge, to any person obtaining a copy
7-
* of this software and associated documentation files (the "Software"), to deal
8-
* in the Software without restriction, including without limitation the rights
9-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10-
* copies of the Software, and to permit persons to whom the Software is
11-
* furnished to do so, subject to the following conditions:
12-
*
13-
* The above copyright notice and this permission notice shall be included in all
14-
* copies or substantial portions of the Software.
15-
*
16-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22-
* SOFTWARE.
23-
*/
1+
#ifndef EKG_CORE_RUNTIME_HPP
2+
#define EKG_CORE_RUNTIME_HPP
243

25-
#ifndef EKG_CORE_H
26-
#define EKG_CORE_H
27-
28-
#include <unordered_map>
29-
30-
#include "ekg/ui/abstract/ui_abstract_widget.hpp"
4+
#include "ekg/ui/abstract.hpp"
315
#include "ekg/service/handler.hpp"
32-
#include "ekg/draw/font_renderer.hpp"
33-
#include "ekg/service/theme.hpp"
34-
#include "ekg/service/input.hpp"
35-
#include "ekg/util/io.hpp"
36-
#include "ekg/util/gui.hpp"
37-
#include "ekg/gpu/api.hpp"
38-
#include "ekg/layout/docknize.hpp"
396

40-
namespace ekg {
41-
extern struct current_hovered_state {
42-
public:
43-
int32_t id {};
44-
int32_t up {};
45-
int32_t down {};
46-
ekg::type type {};
47-
ekg::type down_type {};
48-
ekg::type up_type {};
49-
int32_t swap {};
50-
int32_t last {};
51-
} hovered;
7+
#include <memory>
528

9+
namespace ekg {
5310
class runtime {
54-
private:
55-
static ekg::stack collect;
56-
static ekg::stack back;
57-
static ekg::stack front;
58-
private:
59-
std::unordered_map<int32_t, ekg::ui::abstract_widget*> widget_map {};
60-
61-
std::vector<ekg::ui::abstract_widget*> update_widget_list {};
62-
std::vector<ekg::ui::abstract_widget*> loaded_widget_list {};
63-
std::vector<ekg::ui::abstract_widget*> refresh_widget_list {};
64-
65-
std::vector<ekg::ui::abstract_widget*> reload_widget_list {};
66-
uint64_t reload_widget_counter {};
67-
68-
std::vector<ekg::ui::abstract_widget*> synclayout_widget_list {};
69-
uint64_t synclayout_widget_counter {};
70-
71-
ekg::ui::abstract *p_current_ui_container {};
72-
ekg::ui::abstract_widget *p_abs_activity_widget {};
73-
ekg::stack *p_current_stack {};
74-
75-
int32_t token_id {};
76-
bool enable_high_priority_frequency {};
7711
public:
78-
ekg::service::input service_input {};
79-
ekg::service::theme service_theme {};
80-
ekg::service::handler service_handler {};
81-
public:
82-
ekg::draw::font_renderer f_renderer_small {};
83-
ekg::draw::font_renderer f_renderer_normal {};
84-
ekg::draw::font_renderer f_renderer_big {};
85-
86-
ekg::timing ui_scroll_timing {};
87-
ekg::timing ui_timing {};
88-
ekg::os::io_event_serial io_event_serial {};
89-
90-
ekg::os::platform *p_os_platform {};
91-
ekg::gpu::api *p_gpu_api {};
92-
ekg::gpu::allocator gpu_allocator {};
93-
94-
ekg::layout::mask mask {};
95-
protected:
96-
void prepare_tasks();
97-
98-
void prepare_ui_env();
12+
std::vector<std::unique_ptr<ekg::ui::abstract>> loaded_widget_list {};
13+
ekg::id global_id {};
9914

100-
void erase(int32_t id);
15+
std::vector<ekg::ui::abstract*> context_widget_list {};
16+
ekg::io::target_collector_t swap_target_collector {};
10117
public:
102-
void set_current_stack(ekg::stack *p_stack);
103-
104-
ekg::ui::abstract_widget *get_fast_widget_by_id(int32_t id);
105-
106-
void gen_widget(ekg::ui::abstract *p_ui);
107-
108-
void do_task_reload(ekg::ui::abstract_widget *widget);
109-
110-
void do_task_synclayout(ekg::ui::abstract_widget *widget);
111-
112-
void do_task_refresh(ekg::ui::abstract_widget *widget);
113-
114-
void set_update_high_frequency(ekg::ui::abstract_widget *widget);
115-
116-
bool has_bind_group_flag();
117-
118-
void end_group_flag();
119-
120-
void end_group_parent_flag();
121-
122-
void update_size_changed();
123-
124-
void init();
125-
126-
void quit();
127-
128-
void process_event();
18+
ekg::service::handler handler {};
19+
public:
20+
void do_init();
21+
void do_quit();
22+
void do_update();
23+
void do_render();
12924

130-
void process_update();
25+
ekg::ui::abstract *push_back_new_widget_safety(
26+
ekg::ui::abstract *p_widget
27+
);
13128

132-
void process_render();
29+
ekg::id generate_unique_id();
13330
};
134-
};
31+
}
13532

13633
#endif

0 commit comments

Comments
 (0)