62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
|
}
snprintf(buf,8,"%2dx%2d",pfwidth,pfheight);
draw_text(8,32,buf,0xF0,0xFD);
draw_text(24,32,"x",0xF0,0xF5);
SDL_UnlockSurface(screen);
SDL_Flip(screen);
}
static int game_command(int prev,int cmd,int number,int argc,sqlite3_stmt*args,void*aux) {
switch(cmd) {
case '\' ': // Play a move
return number;
case '^E': // Edit
return -2;
case '^L': // Select level
load_level(number);
return 1;
case '^Q': // Quit
return -1;
default:
return prev;
}
}
|
>
>
>
>
>
>
>
>
>
>
>
|
|
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
|
}
snprintf(buf,8,"%2dx%2d",pfwidth,pfheight);
draw_text(8,32,buf,0xF0,0xFD);
draw_text(24,32,"x",0xF0,0xF5);
SDL_UnlockSurface(screen);
SDL_Flip(screen);
}
static void begin_level(int id) {
const char*t;
t=load_level(id)?:init_level();
if(t) {
gameover=-1;
screen_message(t);
} else {
gameover=0;
}
}
static int game_command(int prev,int cmd,int number,int argc,sqlite3_stmt*args,void*aux) {
switch(cmd) {
case '\' ': // Play a move
return number;
case '^E': // Edit
return -2;
case '^L': // Select level
begin_level(number);
return 1;
case '^Q': // Quit
return -1;
default:
return prev;
}
}
|
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
|
sqlite3_free(s);
}
void run_game(void) {
int i;
SDL_Event ev;
set_caption();
load_level(level_id);
redraw_game();
while(SDL_WaitEvent(&ev)) {
switch(ev.type) {
case SDL_VIDEOEXPOSE:
redraw_game();
break;
case SDL_QUIT:
|
|
|
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
|
sqlite3_free(s);
}
void run_game(void) {
int i;
SDL_Event ev;
set_caption();
begin_level(level_id);
redraw_game();
while(SDL_WaitEvent(&ev)) {
switch(ev.type) {
case SDL_VIDEOEXPOSE:
redraw_game();
break;
case SDL_QUIT:
|