|
|
|
@ -1,4 +1,3 @@
@@ -1,4 +1,3 @@
|
|
|
|
|
|
|
|
|
|
#include <stdio.h> |
|
|
|
|
#include <stdlib.h> |
|
|
|
|
#include <string.h> |
|
|
|
@ -88,7 +87,6 @@ typedef struct {
@@ -88,7 +87,6 @@ typedef struct {
|
|
|
|
|
static sdl_abstract cleanup_queue[100]; |
|
|
|
|
static int cleanup_queue_length = 0; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void queue_for_cleanup(void * SDL_thing, sdl_types kind) { |
|
|
|
|
sdl_abstract obj; |
|
|
|
|
obj.kind = kind; |
|
|
|
@ -154,7 +152,7 @@ struct SDL_Window* make_window(void) {
@@ -154,7 +152,7 @@ struct SDL_Window* make_window(void) {
|
|
|
|
|
return SDL_CreateWindow("sdl_tester",
|
|
|
|
|
SDL_WINDOWPOS_CENTERED,
|
|
|
|
|
SDL_WINDOWPOS_CENTERED,
|
|
|
|
|
screen_width, screen_height, 0);
|
|
|
|
|
800, 600, 0);
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void step(void) { |
|
|
|
@ -202,23 +200,21 @@ SDL_Texture * load_image(SDL_Renderer * ren, char fname[]) {
@@ -202,23 +200,21 @@ SDL_Texture * load_image(SDL_Renderer * ren, char fname[]) {
|
|
|
|
|
void draw_pictures(struct SDL_Renderer * ren) { |
|
|
|
|
// display an initial splash screen
|
|
|
|
|
|
|
|
|
|
const char file[] = "image.bmp"; |
|
|
|
|
SDL_Surface* surface = SDL_LoadBMP(file); |
|
|
|
|
SDL_Texture * texture = SDL_CreateTextureFromSurface(ren,surface); |
|
|
|
|
char png_file[] = "trans.PNG";
|
|
|
|
|
|
|
|
|
|
const char png_file[] = "trans.PNG";
|
|
|
|
|
/*
|
|
|
|
|
*SDL_Surface * png_surface = IMG_Load(png_file) ; |
|
|
|
|
*if(!png_surface) { |
|
|
|
|
* printf("IMG_Load: %s\n", IMG_GetError()); |
|
|
|
|
* // handle error
|
|
|
|
|
*} |
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
SDL_Surface * png_surface = IMG_Load(png_file) ; |
|
|
|
|
if(!png_surface) { |
|
|
|
|
printf("IMG_Load: %s\n", IMG_GetError()); |
|
|
|
|
// handle error
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
SDL_Texture * png_image = SDL_CreateTextureFromSurface(ren, png_surface); |
|
|
|
|
SDL_Texture * png_image = load_image(ren, png_file); //SDL_CreateTextureFromSurface(ren, png_surface);
|
|
|
|
|
|
|
|
|
|
// remove the surface from memory as no longer needed
|
|
|
|
|
cleanup(png_surface, SURFACE); |
|
|
|
|
cleanup(surface, SURFACE); |
|
|
|
|
//cleanup(png_surface, SURFACE);
|
|
|
|
|
//cleanup(surface, SURFACE);
|
|
|
|
|
// check this actually does stuff
|
|
|
|
|
|
|
|
|
|
SDL_RenderClear(ren); |
|
|
|
|