main clean

This commit is contained in:
2024-12-12 10:47:51 +01:00
parent 331ff2b5b2
commit a7a8138a71
5 changed files with 62 additions and 51 deletions

52
main.c
View File

@@ -1,57 +1,7 @@
#include <SDL2/SDL.h>
#include <SDL2/SDL_events.h>
#include <SDL2/SDL_pixels.h>
#include <SDL2/SDL_rect.h>
#include <SDL2/SDL_render.h>
#include <SDL2/SDL_surface.h>
#include <SDL2/SDL_video.h>
#include <stdio.h>
#include <time.h>
int main()
{
SDL_Rect displayBounds;
displayBounds.w = 800;
displayBounds.h = 800;
SDL_Window *window = SDL_CreateWindow("titre test",
SDL_WINDOWPOS_CENTERED,
SDL_WINDOWPOS_CENTERED,
displayBounds.w, displayBounds.h,
SDL_WINDOW_SHOWN);
int running = 1;
SDL_Event event;
while (running)
{
while(SDL_PollEvent(&event))
{
if (event.type ==SDL_QUIT)
{
running = 0;
}
}
SDL_Renderer *renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED);
SDL_SetRenderDrawColor(renderer, 0, 0, 0, 255);
SDL_RenderClear(renderer);
SDL_SetRenderDrawColor(renderer, 255, 0, 0, 255);
SDL_Rect rect;
rect.x = 100;
rect.y = 100;
rect.h = 100;
rect.w = 150;
SDL_RenderDrawRect(renderer, &rect);
rect.x = 300;
rect.y = 300;
SDL_RenderFillRect(renderer, &rect);
SDL_UpdateWindowSurface(window);
}
SDL_DestroyWindow(window);
SDL_Quit();
puts("main");
return 0;
}