@@ -35,53 +35,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
3535#include < utki/util.hpp>
3636
3737#include " config.hpp"
38+ #include " window.hpp"
3839
3940namespace ruisapp {
4041
41- /* *
42- * @brief Desired window parameters.
43- */
44- struct window_params {
45- /* *
46- * @brief Desired dimensions of the window
47- */
48- r4::vector2<unsigned > dims;
49-
50- /* *
51- * @brief Window title.
52- */
53- std::string title = " ruisapp" ;
54-
55- /* *
56- * @brief Graphics buffer kind.
57- * Color buffer is always present, so no enum entry for color buffer is needed.
58- */
59- enum class buffer {
60- depth,
61- stencil,
62-
63- enum_size
64- };
65-
66- /* *
67- * @brief Flags describing desired buffers for rendering context.
68- * Color buffer is always there implicitly.
69- */
70- utki::flags<buffer> buffers = false ;
71-
72- // version 0.0 means default version
73- // clang-format off
74- utki::version_duplet graphics_api_version = {
75- .major = 0 ,
76- .minor = 0
77- };
78- // clang-format on
79-
80- window_params (r4::vector2<unsigned > dims) :
81- dims (dims)
82- {}
83- };
84-
8542/* *
8643 * @brief Base singleton class of application.
8744 * An application should subclass this class and return an instance from the
@@ -142,7 +99,7 @@ class application : public utki::intrusive_singleton<application>
14299 const directories directory;
143100
144101private:
145- // TODO: make it window rectangle and track vieport separately,
102+ // TODO: make it window rectangle and track viewport separately,
146103 // use top-left coordinate system
147104
148105 // this is a viewport rectangle in coordinates that are as follows: x grows
@@ -162,44 +119,80 @@ class application : public utki::intrusive_singleton<application>
162119
163120 void update_window_rect (const ruis::rect& rect);
164121
165- friend void update_window_rect (application& app, const ruis::rect& rect);
122+ friend void update_window_rect (
123+ application& app, //
124+ const ruis::rect& rect
125+ );
166126
167127 // pos is in usual window coordinates, y goes down.
168- void handle_mouse_move (const r4::vector2<float >& pos, unsigned id)
128+ void handle_mouse_move (
129+ const r4::vector2<float >& pos, //
130+ unsigned id
131+ )
169132 {
170- this ->gui .send_mouse_move (pos, id);
133+ this ->gui .send_mouse_move (
134+ pos, //
135+ id
136+ );
171137 }
172138
173- friend void handle_mouse_move (application& app, const r4::vector2<float >& pos, unsigned id);
139+ friend void handle_mouse_move (
140+ application& app, //
141+ const r4::vector2<float >& pos,
142+ unsigned id
143+ );
174144
175145 // pos is in usual window coordinates, y goes down.
176- void handle_mouse_button (bool is_down, const r4::vector2<float >& pos, ruis::mouse_button button, unsigned id)
146+ void handle_mouse_button (
147+ bool is_down, //
148+ const r4::vector2<float >& pos,
149+ ruis::mouse_button button,
150+ unsigned id
151+ )
177152 {
178- this ->gui .send_mouse_button (is_down, pos, button, id);
153+ this ->gui .send_mouse_button (
154+ is_down, //
155+ pos,
156+ button,
157+ id
158+ );
179159 }
180160
181161 friend void handle_mouse_button (
182- application& app,
162+ application& app, //
183163 bool is_down,
184164 const r4::vector2<float >& pos,
185165 ruis::mouse_button button,
186166 unsigned id
187167 );
188168
189- void handle_mouse_hover (bool is_hovered, unsigned id)
169+ void handle_mouse_hover (
170+ bool is_hovered, //
171+ unsigned id
172+ )
190173 {
191- this ->gui .send_mouse_hover (is_hovered, id);
174+ this ->gui .send_mouse_hover (
175+ is_hovered, //
176+ id
177+ );
192178 }
193179
194- friend void handle_mouse_hover (application& app, bool is_hovered, unsigned pointer_id);
180+ friend void handle_mouse_hover (
181+ application& app, //
182+ bool is_hovered,
183+ unsigned pointer_id
184+ );
195185
196186protected:
197187 /* *
198188 * @brief Application constructor.
199189 * @param name - name of the application.
200190 * @param requested_window_params - requested window parameters.
201191 */
202- application (std::string name, const window_params& requested_window_params);
192+ application (
193+ std::string name, //
194+ const window_params& requested_window_params
195+ );
203196
204197public:
205198 application (const application&) = delete ;
@@ -228,20 +221,33 @@ class application : public utki::intrusive_singleton<application>
228221 // The idea with unicode_resolver parameter is that we don't want to calculate
229222 // the unicode unless it is really needed, thus postpone it as much as
230223 // possible.
231- void handle_character_input (const ruis::gui::input_string_provider& string_provider, ruis::key key_code)
224+ void handle_character_input (
225+ const ruis::gui::input_string_provider& string_provider, //
226+ ruis::key key_code
227+ )
232228 {
233- this ->gui .send_character_input (string_provider, key_code);
229+ this ->gui .send_character_input (
230+ string_provider, //
231+ key_code
232+ );
234233 }
235234
236235 friend void handle_character_input (
237- application& app,
236+ application& app, //
238237 const ruis::gui::input_string_provider& string_provider,
239238 ruis::key key_code
240239 );
241240
242- void handle_key_event (bool is_down, ruis::key key_code);
241+ void handle_key_event (
242+ bool is_down, //
243+ ruis::key key_code
244+ );
243245
244- friend void handle_key_event (application& app, bool is_down, ruis::key key_code);
246+ friend void handle_key_event (
247+ application& app, //
248+ bool is_down,
249+ ruis::key key_code
250+ );
245251
246252public:
247253 /* *
@@ -290,7 +296,10 @@ class application : public utki::intrusive_singleton<application>
290296 * @param screen_size_mm - size of the display in millimeters.
291297 * @return Size of one display density pixel in pixels.
292298 */
293- static ruis::real get_pixels_per_pp (r4::vector2<unsigned > screen_size_pixels, r4::vector2<unsigned > screen_size_mm);
299+ static ruis::real get_pixels_per_pp (
300+ r4::vector2<unsigned > screen_size_pixels, //
301+ r4::vector2<unsigned > screen_size_mm
302+ );
294303};
295304
296305inline application& inst ()
0 commit comments