27 #include "eng3d/state.hpp"
28 #include "eng3d/string.hpp"
29 #include "eng3d/event.hpp"
30 #include "eng3d/profiler.hpp"
31 #include "eng3d/interface.hpp"
32 #include "eng3d/ui/ui.hpp"
33 #include "eng3d/ui/components.hpp"
36 GameState(
const std::vector<std::string>& pkg_paths)
53 if(this->profiler_view) {
54 this->profiler_view->
kill();
66 int main(
int argc,
char** argv) {
67 std::vector<std::string> pkg_paths;
68 for(
int i = 1; i < argc; i++) {
69 std::string arg = std::string(argv[i]);
74 arg = std::string(argv[i]);
75 pkg_paths.push_back(arg);
82 new UI::Image(0, 0, gs.width, gs.height,
"gfx/sky.png",
nullptr);
84 auto* info_win =
new UI::Window(32, 32, 512, 256 + 96);
85 info_win->set_text(
"Economics");
86 auto& chart = info_win->make_widget<
UI::Chart>(0, 0, 256, 128);
88 chart.set_data({ 1.f, 2.5f, 5.f, 4.f });
90 auto& candlechart = info_win->make_widget<
UI::CandleChart>(0, 150, 256, 128);
91 candlechart.
set_text(
"soil composition (very soil)");
93 std::vector<UI::CandleData> candles;
94 auto prev_close = 0.f;
95 for(
size_t i = 0; i < 10; i++)
98 candle.
open = prev_close;
99 candle.close = candle.open + i;
100 candle.max = glm::max(candle.open, candle.close) + i;
101 candle.min = glm::min(candle.open, candle.close) - i;
103 prev_close = candle.close;
104 candles.push_back(candle);
106 candlechart.set_data(candles);
108 auto& piechart = info_win->make_widget<
UI::PieChart>(256, 0, 128, 128);
111 gs.
ui_ctx.
prompt(
"شست بلسجليدلطظﻻىرﻻزؤرظءؤزةوئىءؤئمحيبسخ4ه2صثهقعسيبىسب",
"σξδφσေိျုူိက့်ိုျ့ငသ်ဆသစနငငသ့ိထာလဘာခလုူ γνακδ ασνし結十と岡統百防能οχψωηδ ασηξφ ξογφφσηγερς");
112 gs.
ui_ctx.
prompt(
"Hello world",
"This is a demo of Eng3D ^_^");
114 auto* parliament_win =
new UI::Window(320, 32, 256 + 64, 256 + 64);
115 parliament_win->set_text(
"parliamento");
116 auto& waffle_chart = parliament_win->make_widget<
UI::WaffleChart>(0, 0, 256, 256);
117 waffle_chart.
set_text(
"Seat row candidates?");
118 waffle_chart.set_data({
124 gs.
do_run([&gs](){
return gs.
run ==
true; },
136 std::cout <<
"Test passed" << std::endl;
State(const std::vector< std::string > &pkg_paths)
void do_run(std::function< bool(void)> cond, std::function< void(void)> event, std::function< void(void)> render)
Perform the main game loop.
std::atomic< bool > run
Variable telling if the game should quit, honored by most event loops but should be used explicitly i...
UI::Widget * profiler_view
GameState(const std::vector< std::string > &pkg_paths)
void handle_key(const Eng3D::Event::Key &e) override
Generalized chart data, used mostly by chart widgets, however it's not specific to any widget.
void prompt(const std::string &title, const std::string &text)
Image widget, can display pictures or effects on the screen.
void set_data(std::vector< ChartData > data)
Window widget, this widget is similar to a Group widget, the key difference is that this one can be m...
std::string translate(const std::string_view str)
Eng3D::Event::Key::Type type
bool hold
Whetever the key is being held.
void stop(const std::string &name)
void start(const std::string &name)
int main(int argc, char **argv)
#define CXX_THROW(class,...)