changed intptr_t in some console funcs to size_t. The SDL window is now resizable
parent
c28a62d522
commit
129440ea01
12
console.c
12
console.c
|
@ -75,13 +75,13 @@ char **consoleGetCommand(const char *string) {
|
|||
i++;
|
||||
current_char = string[i];
|
||||
}
|
||||
command_array[0] = (void*)(intptr_t)(j-1);
|
||||
command_array[0] = (void*)(size_t)(j-1);
|
||||
return command_array;
|
||||
}
|
||||
|
||||
void consoleFreeCommand(char **command_array) {
|
||||
int j;
|
||||
for (j = 1; j < (intptr_t)command_array[0]+1; j++) {
|
||||
for (j = 1; j < (size_t)command_array[0]+1; j++) {
|
||||
free(command_array[j]);
|
||||
}
|
||||
free(command_array);
|
||||
|
@ -94,13 +94,13 @@ void consoleProcessCommand(const char *command_string) {
|
|||
if (console_commands_table[command_hash]) {
|
||||
// BUG: command count has to be +10 ??? FIXME
|
||||
char test[12];
|
||||
itoa((intptr_t)command[0], test, 10);
|
||||
itoa((size_t)command[0], test, 10);
|
||||
consoleLog(test);
|
||||
if ((intptr_t)command[0] == 1) { // no arguments
|
||||
if ((size_t)command[0] == 1) { // no arguments
|
||||
(*console_commands_table[command_hash])(NULL);
|
||||
} else if ((intptr_t)command[0] == 2) { // 1 arg
|
||||
} else if ((size_t)command[0] == 2) { // 1 arg
|
||||
(*console_commands_table[command_hash])(command[2]);
|
||||
} else if ((intptr_t)command[0] == 3) { // 2 args
|
||||
} else if ((size_t)command[0] == 3) { // 2 args
|
||||
(*console_commands_table[command_hash])(command[2], command[3]);
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -142,6 +142,11 @@ void interfaceLoop() {
|
|||
break;
|
||||
}
|
||||
break;
|
||||
case SDL_VIDEORESIZE:
|
||||
video_width = event.resize.w;
|
||||
video_height = event.resize.h;
|
||||
interfaceVideoSet();
|
||||
break;
|
||||
}
|
||||
if (stop_while)
|
||||
break;
|
||||
|
@ -290,7 +295,7 @@ if(!Surface || !Width || !Height)
|
|||
}
|
||||
|
||||
int interfaceVideoSet() {
|
||||
if ((screen = SDL_SetVideoMode(video_width, video_height, 32, SDL_SWSURFACE|video_mode)) == NULL) {
|
||||
if ((screen = SDL_SetVideoMode(video_width, video_height, 32, SDL_SWSURFACE|SDL_RESIZABLE|video_mode)) == NULL) {
|
||||
return ERROR;
|
||||
}
|
||||
camera_surface = SDL_CreateRGBSurface(screen->flags, screen->w, screen->h, screen->format->BitsPerPixel, screen->format->Rmask, screen->format->Gmask, screen->format->Bmask, screen->format->Amask);
|
||||
|
|
Loading…
Reference in New Issue