aboutsummaryrefslogtreecommitdiff
path: root/windows.c
diff options
context:
space:
mode:
authorSimon Tatham <anakin@pobox.com>2005-05-30 16:15:34 +0000
committerSimon Tatham <anakin@pobox.com>2005-05-30 16:15:34 +0000
commit90560462c4842dccc0288eb408f15539acc0ab83 (patch)
treed32e6a40e8f20409f2fe4709ff85607a217e9d1f /windows.c
parent7ddaa1382f064466f158315198788daf33b05052 (diff)
downloadpuzzles-90560462c4842dccc0288eb408f15539acc0ab83.zip
puzzles-90560462c4842dccc0288eb408f15539acc0ab83.tar.gz
puzzles-90560462c4842dccc0288eb408f15539acc0ab83.tar.bz2
puzzles-90560462c4842dccc0288eb408f15539acc0ab83.tar.xz
First cut at a game timer. Yet another backend function which
indicates whether a particular game state should have the timer going (for Mines the initial indeterminate state does not have this property, and neither does a dead or won state); a midend function that optionally (on request from the game) prepends a timer to the front of the status bar text; some complicated midend timing code. It's not great. It's ugly; it's probably slightly inaccurate; it's got no provision for anyone but the game author decreeing whether a game is timed or not. But Mines can't be taken seriously without a timer, so it's a start. [originally from svn r5866]
Diffstat (limited to 'windows.c')
-rw-r--r--windows.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/windows.c b/windows.c
index 383b742..0a61f3c 100644
--- a/windows.c
+++ b/windows.c
@@ -118,6 +118,7 @@ struct frontend {
HFONT cfgfont;
char *help_path;
int help_has_contents;
+ char *laststatus;
};
void fatal(char *fmt, ...)
@@ -144,7 +145,14 @@ void get_random_seed(void **randseed, int *randseedsize)
void status_bar(frontend *fe, char *text)
{
- SetWindowText(fe->statusbar, text);
+ char *rewritten = midend_rewrite_statusbar(fe->me, text);
+ if (!fe->laststatus || strcmp(rewritten, fe->laststatus)) {
+ SetWindowText(fe->statusbar, rewritten);
+ sfree(fe->laststatus);
+ fe->laststatus = rewritten;
+ } else {
+ sfree(rewritten);
+ }
}
void frontend_default_colour(frontend *fe, float *output)
@@ -437,6 +445,8 @@ static frontend *new_window(HINSTANCE inst, char *game_id, char **error)
fe->fonts = NULL;
fe->nfonts = fe->fontsize = 0;
+ fe->laststatus = NULL;
+
{
int i, ncolours;
float *colours;