Freeciv-3.3
Loading...
Searching...
No Matches
gui_main.h
Go to the documentation of this file.
1/***********************************************************************
2 Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License as published by
5 the Free Software Foundation; either version 2, or (at your option)
6 any later version.
7
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
12***********************************************************************/
13
14/***********************************************************************
15 gui_main.h - description
16 -------------------
17 begin : Sep 6 2002
18 copyright : (C) 2002 by Rafał Bursig
19 email : Rafał Bursig <bursig@poczta.fm>
20***********************************************************************/
21
22#ifndef FC__GUI_MAIN_H
23#define FC__GUI_MAIN_H
24
25/* SDL3 */
26#include <SDL3/SDL.h>
27
28/* client/include */
29#include "gui_main_g.h"
30
31struct theme;
32
33#define GUI_SDL_OPTION(optname) gui_options.gui_sdl3_##optname
34#define GUI_SDL_OPTION_STR(optname) "gui_sdl3_" #optname
35
36/* Enable this to adjust sizes for 320x240 resolution */
37/* #define GUI_SDL3_SMALL_SCREEN */
38
39/* SDL3 client Flags */
40#define CF_NONE 0
41#define CF_ORDERS_WIDGETS_CREATED (1<<0)
42#define CF_MAP_UNIT_W_CREATED (1<<1)
43#define CF_UNITINFO_SHOWN (1<<2)
44#define CF_OVERVIEW_SHOWN (1<<3)
45#define CF_GAME_JUST_STARTED (1<<6)
46
47#define CF_FOCUS_ANIMATION (1<<9)
48#define CF_CHANGED_PROD (1<<10)
49#define CF_CHANGED_CITY_NAME (1<<11)
50#define CF_CITY_STATUS_SPECIAL (1<<12)
51#define CF_CHANGE_TAXRATE_LUX_BLOCK (1<<13)
52#define CF_CHANGE_TAXRATE_SCI_BLOCK (1<<14)
53#define CF_DRAW_CITY_GRID (1<<17)
54#define CF_DRAW_CITY_WORKER_GRID (1<<18)
55#define CF_DRAW_PLAYERS_WAR_STATUS (1<<19)
56#define CF_DRAW_PLAYERS_CEASEFIRE_STATUS (1<<20)
57#define CF_DRAW_PLAYERS_PEACE_STATUS (1<<21)
58#define CF_DRAW_PLAYERS_ALLIANCE_STATUS (1<<22)
59#define CF_DRAW_PLAYERS_NEUTRAL_STATUS (1<<23)
60
61/* Mouse button behavior */
62#define MB_MEDIUM_HOLD_DELAY 500 /* Medium hold: 500ms */
63#define MB_LONG_HOLD_DELAY 2000 /* Long hold: 2000ms */
64
65/* Predicate for detecting basic widget activation events. */
66#define PRESSED_EVENT(event) ( \
67 (event).type == SDL_EVENT_KEY_DOWN \
68 || (event).type == SDL_EVENT_FINGER_DOWN \
69 || ((event).type == SDL_EVENT_MOUSE_BUTTON_DOWN \
70 && (event).button.button == SDL_BUTTON_LEFT))
71
77
78struct finger_behavior {
79 bool counting;
83 struct tile *ptile;
84};
85
87 bool counting;
91 struct tile *ptile;
92};
93
94extern struct widget *selected_widget;
96extern bool LSHIFT;
97extern bool RSHIFT;
98extern bool LCTRL;
99extern bool RCTRL;
100extern bool LALT;
101extern int *client_font_sizes[]; /* indexed by enum client_font */
102
104void enable_focus_animation(void);
105void disable_focus_animation(void);
106
107
108#define DEFAULT_MOVE_STEP 5
111
112Uint16 gui_event_loop(void *data, void (*loop_action)(void *data),
115 Uint16 (*textinput_handler)(const char *text, void *data),
119 void *data),
121 void *data),
123 void *data),
125 void *data));
126
127unsigned default_font_size(struct theme *act_theme);
129
130bool flush_event(void);
131
132/* Shrink sizes for 320x240 screen */
133#ifdef GUI_SDL3_SMALL_SCREEN
134 #define adj_size(size) ((size) / 2)
135#else
136 #define adj_size(size) (size)
137#endif
138
139#endif /* FC__GUI_MAIN_H */
char * incite_cost
Definition comments.c:76
enum event_type event
Definition events.c:81
bool LSHIFT
Definition gui_main.c:109
int FilterMouseMotionEvents(void *data, SDL_Event *event)
Definition gui_main.c:582
void enable_focus_animation(void)
Definition gui_main.c:1201
bool flush_event(void)
Definition gui_main.c:1346
mouse_button_hold_state
Definition gui_main.h:77
@ MB_HOLD_LONG
Definition gui_main.h:80
@ MB_HOLD_MEDIUM
Definition gui_main.h:79
@ MB_HOLD_SHORT
Definition gui_main.h:78
Uint16 gui_event_loop(void *data, void(*loop_action)(void *data), Uint16(*key_down_handler)(SDL_Keysym key, void *data), Uint16(*key_up_handler)(SDL_Keysym key, void *data), Uint16(*textinput_handler)(const char *text, void *data), Uint16(*finger_down_handler)(SDL_TouchFingerEvent *touch_event, void *data), Uint16(*finger_up_handler)(SDL_TouchFingerEvent *touch_event, void *data), Uint16(*finger_motion_handler)(SDL_TouchFingerEvent *touch_event, void *data), Uint16(*mouse_button_down_handler)(SDL_MouseButtonEvent *button_event, void *data), Uint16(*mouse_button_up_handler)(SDL_MouseButtonEvent *button_event, void *data), Uint16(*mouse_motion_handler)(SDL_MouseMotionEvent *motion_event, void *data))
Definition gui_main.c:603
bool RSHIFT
Definition gui_main.c:110
int MOVE_STEP_Y
Definition gui_main.h:114
struct widget * selected_widget
Definition widget.c:48
void update_font_from_theme(int theme_font_size)
Definition gui_main.c:1329
bool LALT
Definition gui_main.c:113
bool LCTRL
Definition gui_main.c:111
unsigned default_font_size(struct theme *act_theme)
Definition gui_main.c:1319
void force_exit_from_event_loop(void)
Definition gui_main.c:566
void disable_focus_animation(void)
Definition gui_main.c:1210
int * client_font_sizes[]
Definition gui_main.c:116
int MOVE_STEP_X
Definition gui_main.c:105
bool RCTRL
Definition gui_main.c:112
Uint32 sdl3_client_flags
Definition gui_main.c:98
Uint32 finger_down_ticks
Definition gui_main.h:85
struct tile * ptile
Definition gui_main.h:88
SDL_TouchFingerEvent event
Definition gui_main.h:87
enum mouse_button_hold_state hold_state
Definition gui_main.h:86
enum mouse_button_hold_state hold_state
Definition gui_main.h:94
SDL_MouseButtonEvent * event
Definition gui_main.h:95
struct tile * ptile
Definition gui_main.h:96
Definition tile.h:50
SDL_Keycode key
Definition widget.h:153
union widget::@223 data