1+ // //////////////////////////////////////////////////////////////////////////////////////////////////
2+ // Copyright (c) 2024 RacoonStudios
3+ //
4+ // Permission is hereby granted, free of charge, to any person obtaining a copy of this
5+ // software and associated documentation files (the "Software"), to deal in the Software
6+ // without restriction, including without limitation the rights to use, copy, modify, merge,
7+ // publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
8+ // to whom the Software is furnished to do so, subject to the following conditions:
9+ //
10+ // The above copyright notice and this permission notice shall be included in all copies or
11+ // substantial portions of the Software.
12+ //
13+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
14+ // INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
15+ // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
16+ // FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
17+ // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
18+ // DEALINGS IN THE SOFTWARE.
19+ // //////////////////////////////////////////////////////////////////////////////////////////////////
20+
21+
22+ // [-------------------------------------------------------]
23+ // [ Includes ]
24+ // [-------------------------------------------------------]
25+ #include " application.h"
26+ #include " sample_window.h"
27+ #include < core/frontend/cursor_device.h>
28+ #include < core/frontend/window_device.h>
29+ #include < gui/gui/gui_server.h>
30+ #include < gui/gui/gui_window_callback.h>
31+
32+
33+ Application::Application ()
34+ : gui::GuiApplication() {
35+
36+ }
37+
38+ Application::~Application () {
39+
40+ }
41+
42+
43+
44+ core::Ptr<gui::GuiWindow> Application::create_window (const core::WindowCreateDesc& windowCreateDesc) {
45+ core::uint32 colorId = get_window_device ()->get_num_windows ();
46+ auto window = get_window_device ()->create_window (windowCreateDesc);
47+
48+ // Append gui_window_callbacks
49+ window->add_window_callback (new gui::GuiWindowCallbacks ());
50+
51+ SampleWindow* guiWindow = new SampleWindow (mGuiServer , colorId);
52+ gui::GuiWindow* mainWindow = get_gui_server ()->create_window (guiWindow, window);
53+
54+ return core::Ptr<gui::GuiWindow>(guiWindow);
55+ }
56+
57+
58+ void Application::main () {
59+ auto window = create_window ({" Some window" , core::Recti (100 , 100 , 800 , 600 ), core::EWindowStyle::WindowStyle_NoBorder});
60+ // auto window2 = create_window("Some window", core::Recti(200, 200, 800, 600), core::EWindowStyle::WindowStyle_NoBorder);
61+
62+ while (true && get_window_device ()->get_num_windows () > 0 ) {
63+ gui::GuiApplication::on_update ();
64+ gui::GuiApplication::on_draw ();
65+ }
66+ }
0 commit comments