projects
/
rocksndiamonds.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
added detection of global (common/system-wide) scores directory
[rocksndiamonds.git]
/
src
/
libgame
/
system.c
diff --git
a/src/libgame/system.c
b/src/libgame/system.c
index df401b5a57a6ebea20d8f539f6eedff4be5076b9..00e9c7295edde77c0f1f3fd117c39a29bb69c72a 100644
(file)
--- a/
src/libgame/system.c
+++ b/
src/libgame/system.c
@@
-33,6
+33,7
@@
struct OptionInfo options;
struct VideoSystemInfo video;
struct AudioSystemInfo audio;
struct GfxInfo gfx;
struct VideoSystemInfo video;
struct AudioSystemInfo audio;
struct GfxInfo gfx;
+struct OverlayInfo overlay;
struct ArtworkInfo artwork;
struct JoystickInfo joystick;
struct SetupInfo setup;
struct ArtworkInfo artwork;
struct JoystickInfo joystick;
struct SetupInfo setup;
@@
-97,6
+98,16
@@
void InitProgramInfo(char *argv0, char *config_filename, char *userdata_subdir,
program.log_file[LOG_ERR_ID] = program.log_file_default[LOG_ERR_ID] = stderr;
}
program.log_file[LOG_ERR_ID] = program.log_file_default[LOG_ERR_ID] = stderr;
}
+void InitScoresInfo()
+{
+ char *global_scores_dir = getPath2(getCommonDataDir(), SCORES_DIRECTORY);
+
+ program.global_scores = directoryExists(global_scores_dir);
+ program.many_scores_per_name = !program.global_scores;
+
+ free(global_scores_dir);
+}
+
void SetWindowTitle()
{
program.window_title = program.window_title_function();
void SetWindowTitle()
{
program.window_title = program.window_title_function();
@@
-270,6
+281,21
@@
void InitGfxOtherSettings()
gfx.cursor_mode = CURSOR_DEFAULT;
}
gfx.cursor_mode = CURSOR_DEFAULT;
}
+void InitOverlayInfo()
+{
+ overlay.active = FALSE;
+}
+
+void SetOverlayActive(boolean active)
+{
+ overlay.active = active;
+}
+
+boolean GetOverlayActive()
+{
+ return overlay.active;
+}
+
void SetDrawDeactivationMask(int draw_deactivation_mask)
{
gfx.draw_deactivation_mask = draw_deactivation_mask;
void SetDrawDeactivationMask(int draw_deactivation_mask)
{
gfx.draw_deactivation_mask = draw_deactivation_mask;
@@
-363,6
+389,9
@@
void LimitScreenUpdates(boolean enable)
void InitVideoDisplay(void)
{
SDLInitVideoDisplay();
void InitVideoDisplay(void)
{
SDLInitVideoDisplay();
+#if defined(TARGET_SDL2)
+ SDLSetDisplaySize();
+#endif
}
void CloseVideoDisplay(void)
}
void CloseVideoDisplay(void)
@@
-378,6
+407,11
@@
void InitVideoBuffer(int width, int height, int depth, boolean fullscreen)
video.height = height;
video.depth = GetRealDepth(depth);
video.height = height;
video.depth = GetRealDepth(depth);
+ video.screen_width = width;
+ video.screen_height = height;
+ video.screen_xoffset = 0;
+ video.screen_yoffset = 0;
+
video.fullscreen_available = FULLSCREEN_STATUS;
video.fullscreen_enabled = FALSE;
video.fullscreen_available = FULLSCREEN_STATUS;
video.fullscreen_enabled = FALSE;
@@
-387,6
+421,10
@@
void InitVideoBuffer(int width, int height, int depth, boolean fullscreen)
video.frame_delay_value = GAME_FRAME_DELAY;
video.shifted_up = FALSE;
video.frame_delay_value = GAME_FRAME_DELAY;
video.shifted_up = FALSE;
+ video.shifted_up_pos = 0;
+ video.shifted_up_pos_last = 0;
+ video.shifted_up_delay = 0;
+ video.shifted_up_delay_value = ONE_SECOND_DELAY / 4;
SDLInitVideoBuffer(fullscreen);
SDLInitVideoBuffer(fullscreen);
@@
-1397,16
+1435,6
@@
void SetAudioMode(boolean enabled)
/* event functions */
/* ========================================================================= */
/* event functions */
/* ========================================================================= */
-void InitEventFilter(EventFilter filter_function)
-{
- /* set event filter to filter out certain events */
-#if defined(TARGET_SDL2)
- SDL_SetEventFilter(filter_function, NULL);
-#else
- SDL_SetEventFilter(filter_function);
-#endif
-}
-
boolean PendingEvent(void)
{
return (SDL_PollEvent(NULL) ? TRUE : FALSE);
boolean PendingEvent(void)
{
return (SDL_PollEvent(NULL) ? TRUE : FALSE);
@@
-1513,14
+1541,18
@@
KeyMod GetKeyModStateFromEvents()
return HandleKeyModState(KSYM_UNDEFINED, 0);
}
return HandleKeyModState(KSYM_UNDEFINED, 0);
}
-void StartTextInput(int x, int y)
+void StartTextInput(int x, int y
, int width, int height
)
{
#if defined(TARGET_SDL2)
SDL_StartTextInput();
#if defined(HAS_SCREEN_KEYBOARD)
{
#if defined(TARGET_SDL2)
SDL_StartTextInput();
#if defined(HAS_SCREEN_KEYBOARD)
- if (y > video.height / 2)
+ if (y + height > SCREEN_KEYBOARD_POS(video.height))
+ {
+ video.shifted_up_pos = y + height - SCREEN_KEYBOARD_POS(video.height);
+ video.shifted_up_delay = SDL_GetTicks();
video.shifted_up = TRUE;
video.shifted_up = TRUE;
+ }
#endif
#endif
}
#endif
#endif
}
@@
-1531,7
+1563,12
@@
void StopTextInput()
SDL_StopTextInput();
#if defined(HAS_SCREEN_KEYBOARD)
SDL_StopTextInput();
#if defined(HAS_SCREEN_KEYBOARD)
- video.shifted_up = FALSE;
+ if (video.shifted_up)
+ {
+ video.shifted_up_pos = 0;
+ video.shifted_up_delay = SDL_GetTicks();
+ video.shifted_up = FALSE;
+ }
#endif
#endif
}
#endif
#endif
}