- fixed typo
- removed SDL_GetWindowSurface from main, because the surface is not fixed and so not valid after resize -> forgoing check for availability is redundant
This commit is contained in:
+1
-9
@@ -74,7 +74,7 @@ SDL_Window* create_window(const char* title, int w, int h){
|
|||||||
|
|
||||||
SDL_Window* window = SDL_CreateWindow(title, w, h, window_flags);
|
SDL_Window* window = SDL_CreateWindow(title, w, h, window_flags);
|
||||||
if(!window) error_exit("Failed to create window!");
|
if(!window) error_exit("Failed to create window!");
|
||||||
if(SDL_SetWindowAspectRatio(window, (float)w / (float)h, (float)w / (float)h)) error_continue("Failed to set window aspect ratio! Continueing...");
|
if(SDL_SetWindowAspectRatio(window, (float)w / (float)h, (float)w / (float)h)) error_continue("Failed to set window aspect ratio! Continuing...");
|
||||||
|
|
||||||
return window;
|
return window;
|
||||||
}
|
}
|
||||||
@@ -298,14 +298,6 @@ int main(int argc, char** argv){
|
|||||||
exit(4);
|
exit(4);
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_Surface* surface = SDL_GetWindowSurface(window);
|
|
||||||
if(!surface){
|
|
||||||
printf("Failed to get surface!");
|
|
||||||
SDL_DestroyWindow(window);
|
|
||||||
free_image_pixels_buffer(&image);
|
|
||||||
exit(5);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!populate_image(window, &image)){
|
if(!populate_image(window, &image)){
|
||||||
printf("Failed to populate image!");
|
printf("Failed to populate image!");
|
||||||
free_image_pixels_buffer(&image);
|
free_image_pixels_buffer(&image);
|
||||||
|
|||||||
Reference in New Issue
Block a user