39#include <emscripten.h>
43#ifdef SDL2_PLAIN_INCLUDE
90#define UNITS_TIMER_INTERVAL 128
91#define MAP_SCROLL_TIMER_INTERVAL 500
166#define SPECLIST_TAG callback
167#define SPECLIST_TYPE struct callback
182 _(
" -f, --fullscreen\tStart Client in Fullscreen mode\n"));
184 _(
" -F, --Font SIZE\tUse SIZE as the base font size\n"));
235 static struct widget *pwidget;
431 #define SCROLL_MAP_AREA 8
433 #define SCROLL_MAP_AREA 1
442 static struct widget *pwidget;
571 event.user.data1 =
NULL;
572 event.user.data2 =
NULL;
584 static int x = 0,
y = 0;
972#define option_var_set_callback(var, callback) \
973 if ((poption = optset_option_by_name(client_optset, \
974 GUI_SDL_OPTION_STR(var)))) { \
975 option_set_changed_callback(poption, callback); \
977 log_error("Didn't find option %s!", GUI_SDL_OPTION_STR(var)); \
982#undef option_var_set_callback
1016 log_normal(
_(
"Migrating options from sdl to sdl2 client"));
1018#define MIGRATE_OPTION(opt) gui_options.gui_sdl2_##opt = gui_options.gui_sdl_##opt;
1026#undef MIGRATE_OPTION
1291#define CHECK_FONT(client_font, action) \
1293 if (strcmp(#client_font, font_name) == 0) { \
1295 long size = strtol(font_value, &end, 10); \
1296 if (end && *end == '\0' && size > 0) { \
1297 *client_font_sizes[client_font] = size; \
#define city_owner(_pcity_)
void popup_city_dialog(struct city *pcity)
double real_timer_callback(void)
int client_main(int argc, char *argv[], bool postpone_tileset)
enum client_states client_state(void)
void send_report_request(enum report_type type)
void start_quitting(void)
void set_client_state(enum client_states newstate)
void center_on_something(void)
double try_to_autoconnect(void)
void input_from_server(int fd)
@ REPORT_WONDERS_OF_THE_WORLD
struct unit_list * get_units_in_focus(void)
struct unit * head_of_units_in_focus(void)
void control_mouse_cursor(struct tile *ptile)
struct unit struct city struct unit struct tile struct extra_type const struct act_prob *act_probs int actor_unit_id struct unit struct unit * punit
editgui_notify_object_changed
bool is_option(const char *option_name, char *option)
char * get_option_malloc(const char *option_name, char **argv, int *i, int argc, bool gc)
void fc_fprintf(FILE *stream, const char *format,...) fc__attribute((__format__(__printf__
void city_report_dialog_popup(bool raise)
void diplomacy_dialog_init(void)
void diplomacy_dialog_done(void)
int ui_main(int argc, char **argv)
const char * client_string
static void print_usage(void)
#define option_var_set_callback(var, callback)
enum gui_type get_gui_type(void)
int main(int argc, char **argv)
void add_idle_callback(void(callback)(void *), void *data)
void options_extra_init(void)
void insert_client_build_info(char *outbuf, size_t outlen)
void remove_net_input(void)
const char *const gui_character_encoding
void add_net_input(int sock)
static bool parse_options(int argc, char **argv)
#define MIGRATE_OPTION(opt)
const bool gui_use_transliteration
void intel_dialog_done(void)
void intel_dialog_init(void)
void update_info_label(void)
void update_unit_info_label(struct unit_list *punits)
void update_city_descriptions(void)
void update_mouse_cursor(enum cursor_type new_cursor_type)
void meswin_dialog_popdown(void)
void meswin_dialog_popup(bool raise)
bool meswin_dialog_is_open(void)
void units_report_dialog_popup(bool raise)
void popup_spaceship_dialog(struct player *pplayer)
void popup_input_line(void)
bool set_video_mode(unsigned width, unsigned height, unsigned flags_in)
int main_window_width(void)
void update_main_screen(void)
bool is_in_rect_area(int x, int y, const SDL_Rect *rect)
struct sdl2_data main_data
bool create_surfaces(int width, int height)
int main_window_height(void)
static int city_names_font_size
static Uint16 main_key_down_handler(SDL_Keysym key, void *data)
static SDL_Event __anim_user_event
static void migrate_options_from_sdl(void)
static SDL_Event * net_user_event
static void resize_window_callback(struct option *poption)
static void fullscreen_callback(struct option *poption)
void editgui_popup_properties(const struct tile_list *tiles, int objtype)
void editgui_notify_object_created(int tag, int id)
#define CHECK_FONT(client_font, action)
static struct mouse_button_behavior button_behavior
bool is_unit_move_blocked
static SDL_Event __info_user_event
static SDL_Event __flush_user_event
int FilterMouseMotionEvents(void *data, SDL_Event *event)
static SDL_Event * info_user_event
static Uint16 main_mouse_button_down_handler(SDL_MouseButtonEvent *button_event, void *data)
static SDL_Event __net_user_event
void enable_focus_animation(void)
void editgui_popdown_all(void)
#define MAP_SCROLL_TIMER_INTERVAL
static void real_resize_window_callback(void *data)
bool draw_goto_patrol_lines
#define UNITS_TIMER_INTERVAL
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))
static void update_button_hold_state(void)
static bool is_map_scrolling
static SDL_Event * map_scroll_user_event
static Uint16 main_finger_down_handler(SDL_TouchFingerEvent *touch_event, void *data)
Uint32 widget_info_counter
static Uint16 main_mouse_motion_handler(SDL_MouseMotionEvent *motion_event, void *data)
static SDL_Event * anim_user_event
static bool check_scroll_area(int x, int y)
static Uint16 main_finger_up_handler(SDL_TouchFingerEvent *touch_event, void *data)
void update_font_from_theme(int theme_font_size)
static int city_productions_font_size
unsigned default_font_size(struct theme *act_theme)
static void clear_double_messages_call(void)
void force_exit_from_event_loop(void)
void disable_focus_animation(void)
static enum direction8 scroll_dir
static unsigned font_size_parameter
int * client_font_sizes[FONT_COUNT]
void editgui_refresh(void)
static SDL_Event __map_scroll_user_event
static SDL_Event * flush_user_event
struct callback_list * callbacks
static Uint16 main_key_up_handler(SDL_Keysym key, void *data)
void editgui_tileset_changed(void)
static Uint16 main_mouse_button_up_handler(SDL_MouseButtonEvent *button_event, void *data)
#define CF_FOCUS_ANIMATION
#define CF_DRAW_PLAYERS_ALLIANCE_STATUS
#define CF_DRAW_PLAYERS_CEASEFIRE_STATUS
#define CF_DRAW_PLAYERS_PEACE_STATUS
#define MB_MEDIUM_HOLD_DELAY
struct widget * selected_widget
#define CF_DRAW_PLAYERS_NEUTRAL_STATUS
#define DEFAULT_MOVE_STEP
#define MB_LONG_HOLD_DELAY
#define CF_DRAW_PLAYERS_WAR_STATUS
#define GUI_SDL_OPTION(optname)
void animate_mouse_cursor(void)
void unload_cursors(void)
void draw_mouse_cursor(void)
void free_font_system(void)
void setup_auxiliary_tech_icons(void)
void draw_intro_gfx(void)
void free_auxiliary_tech_icons(void)
void button_down_on_map(struct mouse_button_behavior *button_behavior)
void button_up_on_map(struct mouse_button_behavior *button_behavior)
void finger_up_on_map(struct finger_behavior *finger_behavior)
bool map_event_handler(SDL_Keysym key)
void set_new_minimap_window_pos(void)
void set_new_unitinfo_window_pos(void)
void city_map_canvas_free(void)
void theme_free(struct theme *ftheme)
int theme_default_font_size(const struct theme *t)
struct theme * active_theme
#define log_debug(message,...)
#define log_normal(message,...)
void update_line(int canvas_x, int canvas_y)
void scroll_mapview(enum direction8 gui_dir)
void init_mapcanvas_and_overview(void)
struct tile * canvas_pos_to_tile(float canvas_x, float canvas_y, float zoom)
void free_mapcanvas_and_overview(void)
bool map_canvas_resized(int width, int height)
#define fc_calloc(n, esz)
int fc_select(int n, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, fc_timeval *timeout)
struct timeval fc_timeval
int messages_where[E_COUNT]
struct client_options gui_options
#define VIDEO_MODE(ARG_width, ARG_height)
bool str_to_uint(const char *str, unsigned int *pint)
void(* callback)(void *data)
bool gui_sdl2_migrated_from_sdl
SDL_TouchFingerEvent event
enum mouse_button_hold_state hold_state
int fc_snprintf(char *str, size_t n, const char *format,...)
#define sz_strlcpy(dest, src)
struct city * tile_city(const struct tile *ptile)
void tileset_load_tiles(struct tileset *t)
void tileset_use_preferred_theme(const struct tileset *t)
void tileset_init(struct tileset *t)
void update_queue_add(uq_callback_t callback, void *data)