Skip to content

Commit

Permalink
[fix][ref] to (u32 now), fixed slider issue
Browse files Browse the repository at this point in the history
  • Loading branch information
MrsRina committed Aug 17, 2024
1 parent f7ceb14 commit 6408108
Show file tree
Hide file tree
Showing 35 changed files with 209 additions and 622 deletions.
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ file(GLOB_RECURSE SOURCE_FILES "src/*.cpp")
if (EKG_ENABLE_DEBUG)
message("-- EKG debug mode on")
add_compile_options(-g)
add_compile_options(-fsanitize=address)
add_compile_options(-fno-omit-frame-pointer)
add_compile_options(-fcompare-debug-second)
elseif()
add_compile_options(-O3)

Expand Down
3 changes: 2 additions & 1 deletion CODE-OF-CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
All headers must be inside of `include`; headers-definition are allowed but must be under [1]
some strictly requirements.

The source code definitions must be inside of `src`, follow the package path, and filename case.
The source code definitions must be inside of `src`, follow the package path, and filename case.
Note: Template is not possible to do on src, then it is allowed.

```
include ->
Expand Down
3 changes: 2 additions & 1 deletion devlog/commit.txt
Original file line number Diff line number Diff line change
Expand Up @@ -192,4 +192,5 @@
-- New standart light-pinky theme scheme colors.
-- New standart dark-pinky theme scheme colors.
-- New "smooth" scrolling.
-- Deprecated `immut` widgets (I do not think we should do this for now).
-- Deprecated `immut` widgets (I do not think we should do this for now).
-- Renamed `uint16_t` (flags) to `ekg::flags`.
22 changes: 18 additions & 4 deletions include/ekg/ekg.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,10 +146,24 @@ namespace ekg {
*/
ekg::ui::checkbox *checkbox(std::string_view text, bool checked, uint16_t dock = ekg::dock::none);

/**
* Create slider UI.
*/
ekg::ui::slider *slider(std::string_view tag, float val, float min, float max, uint16_t dock = ekg::dock::none);
template<typename t>
ekg::ui::slider *slider(
std::string_view tag,
t val,
t min,
t max,
ekg::number number,
uint16_t dock = ekg::dock::none
) {
ekg::ui::slider *p_ui {new ekg::ui::slider()};
ekg::feature *p_serializer {new ekg::ui::slider::serializer_t<t>()};
p_ui->registry(p_ui);
p_ui->transfer_ownership(&p_serializer);
p_ui->unsafe_set_number(number);
p_ui->unsafe_set_type(ekg::type::slider);
ekg::core->gen_widget(p_ui);
return p_ui;
}

/**
* Create popup UI.
Expand Down
6 changes: 3 additions & 3 deletions include/ekg/layout/docknize.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ namespace ekg::layout {
struct rect {
public:
ekg::rect *p_rect {};
uint16_t flags {};
ekg::flags flags {};
};
protected:
float respective_all {};
Expand All @@ -59,8 +59,8 @@ namespace ekg::layout {
void extentnize(
float &extent,
ekg::ui::abstract_widget *p_widget,
uint16_t flag_ok,
uint16_t flag_stop,
ekg::flags flag_ok,
ekg::flags flag_stop,
int64_t &begin_and_count,
ekg::axis axis
);
Expand Down
11 changes: 6 additions & 5 deletions include/ekg/ui/abstract/ui_abstract.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#include "ekg/util/geometry.hpp"
#include "ekg/core/task.hpp"
#include "ekg/gpu/api.hpp"
#include "ekg/util/io.hpp"

namespace ekg {
enum class type {
Expand Down Expand Up @@ -94,7 +95,7 @@ namespace ekg {
bool value {};
uint32_t id {};
uint32_t linked_id {};
uint16_t attributes {};
ekg::flags attributes {};
public:
ekg::rect rect_dimension {};
ekg::rect rect_content {};
Expand All @@ -114,8 +115,8 @@ namespace ekg {
bool alive {true};
bool visible {true};

uint16_t dock_flags {};
uint16_t sync_flags {};
ekg::flags dock_flags {};
ekg::flags sync_flags {};
std::string tag {};

ekg::state state {};
Expand Down Expand Up @@ -243,9 +244,9 @@ namespace ekg {

ekg::type get_type();

uint16_t get_place_dock();
ekg::flags get_place_dock();

uint16_t &get_sync();
ekg::flags &get_sync();

/**
* Set a task to an action, possibles actions:
Expand Down
9 changes: 4 additions & 5 deletions include/ekg/ui/button/ui_button.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@
namespace ekg::ui {
class button : public ekg::ui::abstract, public ekg::value_t<bool, ekg::ui::button> {
protected:
uint16_t dock_text {};

ekg::flags dock_text {};
std::string text {};
task *callback {nullptr};
ekg::font font_size {};
Expand All @@ -43,7 +42,7 @@ namespace ekg::ui {

ekg::font get_font_size();

ekg::ui::button *set_place(uint16_t dock);
ekg::ui::button *set_place(ekg::flags dock);

ekg::ui::button *set_width(float w);

Expand All @@ -63,9 +62,9 @@ namespace ekg::ui {

std::string_view get_text();

ekg::ui::button *set_text_align(uint16_t dock);
ekg::ui::button *set_text_align(ekg::flags dock);

uint16_t get_text_align();
ekg::flags get_text_align();
};
}

Expand Down
13 changes: 7 additions & 6 deletions include/ekg/ui/checkbox/ui_checkbox.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@
namespace ekg::ui {
class checkbox : public ekg::ui::abstract, public ekg::value_t<bool, ekg::ui::checkbox> {
protected:
uint16_t dock_text {}, dock_box {};
ekg::flags dock_text {};
ekg::flags dock_box {};
std::string text {};
ekg::font font_size {};
task *callback {};
Expand All @@ -46,7 +47,7 @@ namespace ekg::ui {

ekg::font get_font_size();

ekg::ui::checkbox *set_place(uint16_t dock);
ekg::ui::checkbox *set_place(ekg::flags dock);

ekg::ui::checkbox *set_width(float w);

Expand All @@ -62,13 +63,13 @@ namespace ekg::ui {

std::string_view get_text();

ekg::ui::checkbox *set_text_align(uint16_t dock);
ekg::ui::checkbox *set_text_align(ekg::flags dock);

uint16_t get_text_align();
ekg::flags get_text_align();

ekg::ui::checkbox *set_box_align(uint16_t dock);
ekg::ui::checkbox *set_box_align(ekg::flags dock);

uint16_t get_box_align();
ekg::flags get_box_align();
};
}

Expand Down
14 changes: 7 additions & 7 deletions include/ekg/ui/frame/ui_frame.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,27 +31,27 @@
namespace ekg::ui {
class frame : public ekg::ui::abstract {
protected:
uint16_t dock_resize {};
uint16_t dock_drag {};
ekg::flags dock_resize {};
ekg::flags dock_drag {};

ekg::rect rect_initial {};
std::string tag {};
ekg::vec2 scale_factor {};
uint32_t top_level_frame_id {};
public:
ekg::ui::frame *set_place(uint16_t dock);
ekg::ui::frame *set_place(ekg::flags dock);

ekg::ui::frame *set_scale_factor(float x, float y);

ekg::vec2 get_scale_factor();

ekg::ui::frame *set_drag(uint16_t dock);
ekg::ui::frame *set_drag(ekg::flags dock);

uint16_t get_drag_dock();
ekg::flags get_drag_dock();

ekg::ui::frame *set_resize(uint16_t dock);
ekg::ui::frame *set_resize(ekg::flags dock);

uint16_t get_resize_dock();
ekg::flags get_resize_dock();

ekg::ui::frame *set_pos_initial(float x, float y);

Expand Down
4 changes: 2 additions & 2 deletions include/ekg/ui/frame/ui_frame_widget.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
namespace ekg::ui {
class frame_widget : public ekg::ui::abstract_widget {
public:
uint16_t target_dock_drag {};
uint16_t target_dock_resize {};
ekg::flags target_dock_drag {};
ekg::flags target_dock_resize {};

ekg::ui::frame_widget *p_frame_widget_top_level {};
ekg::ui::scrollbar_embedded_widget *p_scroll_embedded {};
Expand Down
8 changes: 4 additions & 4 deletions include/ekg/ui/label/ui_label.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@
namespace ekg::ui {
class label : public ekg::ui::abstract, public ekg::value_t<std::string, ekg::ui::label> {
protected:
uint16_t dock_text {};
ekg::flags dock_text {};
ekg::font font_size {};
public:
ekg::ui::label *set_font_size(ekg::font font);

ekg::font get_font_size();

ekg::ui::label *set_place(uint16_t dock);
ekg::ui::label *set_place(ekg::flags dock);

int32_t get_scaled_height();

Expand All @@ -55,9 +55,9 @@ namespace ekg::ui {

std::string get_text();

ekg::ui::label *set_text_align(uint16_t dock);
ekg::ui::label *set_text_align(ekg::flags dock);

uint16_t get_text_align();
ekg::flags get_text_align();
};
}

Expand Down
8 changes: 4 additions & 4 deletions include/ekg/ui/listbox/ui_listbox.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ namespace ekg::ui {
ekg::font column_header_font_size {};
ekg::mode current_mode {};

uint16_t column_header_dock_flags {};
ekg::flags column_header_dock_flags {};
int32_t column_header_scaled_height {1};
int32_t item_scaled_height {1};
public:
Expand All @@ -59,7 +59,7 @@ namespace ekg::ui {

float get_height();

ekg::ui::listbox *set_place(uint16_t dock);
ekg::ui::listbox *set_place(ekg::flags dock);

ekg::ui::listbox *set_mode(ekg::mode mode);

Expand All @@ -73,9 +73,9 @@ namespace ekg::ui {

int32_t get_item_scaled_height();

ekg::ui::listbox *set_column_header_align(uint16_t dock);
ekg::ui::listbox *set_column_header_align(ekg::flags dock);

uint16_t get_column_header_align();
ekg::flags get_column_header_align();
};
}

Expand Down
6 changes: 3 additions & 3 deletions include/ekg/ui/popup/ui_popup.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ namespace ekg::ui {
protected:
std::vector<ekg::ui::item> item_list {};

uint16_t text_flags {};
ekg::flags text_flags {};
int32_t scaled_height {}, token_id {};
ekg::font font_size;
public:
Expand All @@ -59,9 +59,9 @@ namespace ekg::ui {

ekg::vec2 get_pos();

ekg::ui::popup *set_text_align(uint16_t dock);
ekg::ui::popup *set_text_align(ekg::flags dock);

uint16_t get_text_align();
ekg::flags get_text_align();

ekg::ui::popup *set_width(float w);

Expand Down
Loading

0 comments on commit 6408108

Please sign in to comment.