mirror of
git://git.tartarus.org/simon/puzzles.git
synced 2025-04-20 23:51:29 -07:00
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]
This commit is contained in:
10
osx.m
10
osx.m
@ -383,7 +383,7 @@ struct frontend {
|
||||
- (void)keyDown:(NSEvent *)ev;
|
||||
- (void)activateTimer;
|
||||
- (void)deactivateTimer;
|
||||
- (void)setStatusLine:(NSString *)text;
|
||||
- (void)setStatusLine:(char *)text;
|
||||
@end
|
||||
|
||||
@implementation MyImageView
|
||||
@ -1131,9 +1131,11 @@ struct frontend {
|
||||
[self sheetEndWithStatus:NO];
|
||||
}
|
||||
|
||||
- (void)setStatusLine:(NSString *)text
|
||||
- (void)setStatusLine:(char *)text
|
||||
{
|
||||
[[status cell] setTitle:text];
|
||||
char *rewritten = midend_rewrite_statusbar(me, text);
|
||||
[[status cell] setTitle:[NSString stringWithCString:rewritten]];
|
||||
sfree(rewritten);
|
||||
}
|
||||
|
||||
@end
|
||||
@ -1267,7 +1269,7 @@ void activate_timer(frontend *fe)
|
||||
|
||||
void status_bar(frontend *fe, char *text)
|
||||
{
|
||||
[fe->window setStatusLine:[NSString stringWithCString:text]];
|
||||
[fe->window setStatusLine:text];
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
|
Reference in New Issue
Block a user