Fri, 18 Jul 2025 18:01:41 +0200
remove global active font and color (also fixes #693)
48 | 1 | /* |
2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. | |
3 | * Copyright 2024 Mike Becker. All rights reserved. | |
4 | * | |
5 | * Redistribution and use in source and binary forms, with or without | |
6 | * modification, are permitted provided that the following conditions are met: | |
7 | * | |
8 | * 1. Redistributions of source code must retain the above copyright | |
9 | * notice, this list of conditions and the following disclaimer. | |
10 | * | |
11 | * 2. Redistributions in binary form must reproduce the above copyright | |
12 | * notice, this list of conditions and the following disclaimer in the | |
13 | * documentation and/or other materials provided with the distribution. | |
14 | * | |
15 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | |
16 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
17 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
18 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE | |
19 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
20 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
21 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
24 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
25 | * POSSIBILITY OF SUCH DAMAGE. | |
26 | */ | |
27 | ||
28 | #ifndef ASCENSION_UI_H | |
29 | #define ASCENSION_UI_H | |
30 | ||
155
b598b4eb4b44
add new ui.c where several UI functions are now moved to
Mike Becker <universe@uap-core.de>
parents:
154
diff
changeset
|
31 | #ifndef ASCENSION_UI_IMPLEMENTATION |
198
916d2d125ecf
remove ui subdir in includes
Mike Becker <universe@uap-core.de>
parents:
155
diff
changeset
|
32 | #include "text.h" |
155
b598b4eb4b44
add new ui.c where several UI functions are now moved to
Mike Becker <universe@uap-core.de>
parents:
154
diff
changeset
|
33 | #endif |
b598b4eb4b44
add new ui.c where several UI functions are now moved to
Mike Becker <universe@uap-core.de>
parents:
154
diff
changeset
|
34 | |
b598b4eb4b44
add new ui.c where several UI functions are now moved to
Mike Becker <universe@uap-core.de>
parents:
154
diff
changeset
|
35 | /** |
b598b4eb4b44
add new ui.c where several UI functions are now moved to
Mike Becker <universe@uap-core.de>
parents:
154
diff
changeset
|
36 | * Sets the UI scaling factor for the active window. |
b598b4eb4b44
add new ui.c where several UI functions are now moved to
Mike Becker <universe@uap-core.de>
parents:
154
diff
changeset
|
37 | * |
b598b4eb4b44
add new ui.c where several UI functions are now moved to
Mike Becker <universe@uap-core.de>
parents:
154
diff
changeset
|
38 | * @param scale the scaling factor |
b598b4eb4b44
add new ui.c where several UI functions are now moved to
Mike Becker <universe@uap-core.de>
parents:
154
diff
changeset
|
39 | */ |
b598b4eb4b44
add new ui.c where several UI functions are now moved to
Mike Becker <universe@uap-core.de>
parents:
154
diff
changeset
|
40 | void asc_ui_scale(float scale); |
b598b4eb4b44
add new ui.c where several UI functions are now moved to
Mike Becker <universe@uap-core.de>
parents:
154
diff
changeset
|
41 | |
b598b4eb4b44
add new ui.c where several UI functions are now moved to
Mike Becker <universe@uap-core.de>
parents:
154
diff
changeset
|
42 | /** |
b598b4eb4b44
add new ui.c where several UI functions are now moved to
Mike Becker <universe@uap-core.de>
parents:
154
diff
changeset
|
43 | * Returns the current UI scaling factor for the active window. |
b598b4eb4b44
add new ui.c where several UI functions are now moved to
Mike Becker <universe@uap-core.de>
parents:
154
diff
changeset
|
44 | * |
b598b4eb4b44
add new ui.c where several UI functions are now moved to
Mike Becker <universe@uap-core.de>
parents:
154
diff
changeset
|
45 | * @return the scaling factor |
b598b4eb4b44
add new ui.c where several UI functions are now moved to
Mike Becker <universe@uap-core.de>
parents:
154
diff
changeset
|
46 | */ |
b598b4eb4b44
add new ui.c where several UI functions are now moved to
Mike Becker <universe@uap-core.de>
parents:
154
diff
changeset
|
47 | float asc_ui_get_scale(void); |
b598b4eb4b44
add new ui.c where several UI functions are now moved to
Mike Becker <universe@uap-core.de>
parents:
154
diff
changeset
|
48 | |
b598b4eb4b44
add new ui.c where several UI functions are now moved to
Mike Becker <universe@uap-core.de>
parents:
154
diff
changeset
|
49 | /** |
b598b4eb4b44
add new ui.c where several UI functions are now moved to
Mike Becker <universe@uap-core.de>
parents:
154
diff
changeset
|
50 | * Automatically chooses a UI scaling factor depending on display resolution. |
b598b4eb4b44
add new ui.c where several UI functions are now moved to
Mike Becker <universe@uap-core.de>
parents:
154
diff
changeset
|
51 | * |
b598b4eb4b44
add new ui.c where several UI functions are now moved to
Mike Becker <universe@uap-core.de>
parents:
154
diff
changeset
|
52 | * @note you need to call this function again when the window changes the display |
b598b4eb4b44
add new ui.c where several UI functions are now moved to
Mike Becker <universe@uap-core.de>
parents:
154
diff
changeset
|
53 | * // TODO: check if there is an SDL event when the window changes the display and implement a reaction |
b598b4eb4b44
add new ui.c where several UI functions are now moved to
Mike Becker <universe@uap-core.de>
parents:
154
diff
changeset
|
54 | */ |
b598b4eb4b44
add new ui.c where several UI functions are now moved to
Mike Becker <universe@uap-core.de>
parents:
154
diff
changeset
|
55 | void asc_ui_scale_auto(void); |
b598b4eb4b44
add new ui.c where several UI functions are now moved to
Mike Becker <universe@uap-core.de>
parents:
154
diff
changeset
|
56 | |
b598b4eb4b44
add new ui.c where several UI functions are now moved to
Mike Becker <universe@uap-core.de>
parents:
154
diff
changeset
|
57 | /** |
b598b4eb4b44
add new ui.c where several UI functions are now moved to
Mike Becker <universe@uap-core.de>
parents:
154
diff
changeset
|
58 | * Adds a node to the active window's UI. |
b598b4eb4b44
add new ui.c where several UI functions are now moved to
Mike Becker <universe@uap-core.de>
parents:
154
diff
changeset
|
59 | * |
b598b4eb4b44
add new ui.c where several UI functions are now moved to
Mike Becker <universe@uap-core.de>
parents:
154
diff
changeset
|
60 | * @param node the node to add |
b598b4eb4b44
add new ui.c where several UI functions are now moved to
Mike Becker <universe@uap-core.de>
parents:
154
diff
changeset
|
61 | */ |
b598b4eb4b44
add new ui.c where several UI functions are now moved to
Mike Becker <universe@uap-core.de>
parents:
154
diff
changeset
|
62 | void asc_ui_add_node(AscSceneNode *node); |
48 | 63 | |
64 | #endif /* ASCENSION_UI_H */ | |
65 |