2024-03-20 00:48:21 +00:00
|
|
|
#include <stdlib.h>
|
2024-03-26 01:23:54 +00:00
|
|
|
|
|
|
|
#define SDL_MAIN_HANDLED
|
2024-03-20 00:48:21 +00:00
|
|
|
#include <SDL.h>
|
|
|
|
#include <SDL_image.h>
|
|
|
|
|
|
|
|
#include "api.h"
|
|
|
|
|
2024-03-26 01:23:54 +00:00
|
|
|
SDL_Window * purrwin;
|
|
|
|
void purrer(void) {
|
|
|
|
SDL_Init(SDL_INIT_TIMER|SDL_INIT_EVENTS|SDL_INIT_VIDEO);
|
|
|
|
purrwin = SDL_CreateWindow("PurrForce :3",
|
|
|
|
100, 100, 320,
|
|
|
|
360, SDL_WINDOW_BORDERLESS|SDL_WINDOW_ALWAYS_ON_TOP|SDL_WINDOW_SHOWN);
|
|
|
|
if(purrwin == NULL) {
|
|
|
|
puts(SDL_GetError());
|
|
|
|
} else {
|
|
|
|
SDL_DestroyWindow(purrwin);
|
|
|
|
}
|
|
|
|
SDL_Quit();
|
|
|
|
}
|
|
|
|
int main(int argc,char**argv){
|
|
|
|
puts("hello world");
|
|
|
|
SDL_SetMainReady();
|
|
|
|
print_stats(ps_startup);
|
|
|
|
purrer();
|
|
|
|
print_stats(ps_shutdown);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2024-03-20 00:48:21 +00:00
|
|
|
SDL_Window* window;
|
|
|
|
SDL_Renderer* renderer;
|
2024-03-20 06:25:29 +00:00
|
|
|
SDL_Texture* mascot_tex;
|
2024-03-26 01:23:54 +00:00
|
|
|
int zmain(int argc, char* argv[]) {
|
2024-03-20 06:25:29 +00:00
|
|
|
SDL_Surface* mascot_sur=NULL;
|
2024-03-20 00:48:21 +00:00
|
|
|
reportError("startup purrforce?");
|
|
|
|
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_EVENTS) < 0) {
|
|
|
|
reportError("Error SDL2 Initialization : %s",SDL_GetError());
|
|
|
|
return 1;
|
|
|
|
}
|
2024-03-20 06:25:29 +00:00
|
|
|
window = SDL_CreateWindow("First program", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 640, 480, SDL_WINDOW_OPENGL);
|
2024-03-20 00:48:21 +00:00
|
|
|
if (window == NULL) {
|
|
|
|
reportError("Error window creation");
|
|
|
|
return 3;
|
|
|
|
}
|
|
|
|
renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED);
|
|
|
|
if (renderer == NULL) {
|
|
|
|
reportError("Error renderer creation");
|
|
|
|
return 4;
|
|
|
|
}
|
2024-03-20 06:25:29 +00:00
|
|
|
//mascot_sur = IMG_Load("mascot.png");
|
|
|
|
if (mascot_sur == NULL) {
|
2024-03-20 00:48:21 +00:00
|
|
|
reportError("Error loading image: %s",IMG_GetError());
|
|
|
|
return 5;
|
|
|
|
}
|
2024-03-20 06:25:29 +00:00
|
|
|
mascot_tex = SDL_CreateTextureFromSurface(renderer, mascot_sur);
|
|
|
|
if (mascot_tex == NULL) {
|
2024-03-20 00:48:21 +00:00
|
|
|
reportError("Error creating texture");
|
|
|
|
return 6;
|
|
|
|
}
|
2024-03-20 06:25:29 +00:00
|
|
|
SDL_FreeSurface(mascot_sur);
|
2024-03-20 00:48:21 +00:00
|
|
|
while (1) {
|
|
|
|
SDL_Event e;
|
|
|
|
if (SDL_WaitEvent(&e)) {
|
|
|
|
if (e.type == SDL_QUIT) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
SDL_RenderClear(renderer);
|
2024-03-20 06:25:29 +00:00
|
|
|
SDL_RenderCopy(renderer, mascot_tex, NULL, NULL);
|
2024-03-20 00:48:21 +00:00
|
|
|
SDL_RenderPresent(renderer);
|
|
|
|
}
|
2024-03-20 06:25:29 +00:00
|
|
|
SDL_DestroyTexture(mascot_tex);
|
2024-03-20 00:48:21 +00:00
|
|
|
SDL_DestroyRenderer(renderer);
|
|
|
|
SDL_DestroyWindow(window);
|
2024-03-20 06:25:29 +00:00
|
|
|
// IMG_Quit();
|
2024-03-20 00:48:21 +00:00
|
|
|
SDL_Quit();
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2024-03-26 01:23:54 +00:00
|
|
|
*/
|