My code is to open a window.(SDK)(dev c++, orwell)
Instead of five seconds it takes a few milliseconds. Please help solve the problem. Just few day ago it worked but now ti does'nt.
#include "SDL.h" //cool graphics API. Only works with 32 bit for me.
#include <stdio.h>
typedef struct // what is typedef?
{
int x, y;
short life;
char *name;
} Man;
int main(int a, char *b[])
{
SDL_Window *window; // Declare a window //these are structs
SDL_Renderer *renderer; // Declare a renderer
SDL_Init(SDL_INIT_VIDEO); // Initialize SDL2 //this is obviously a funtion
//Create an application window with the following settings:
window = SDL_CreateWindow("Ash First Window", // window title
SDL_WINDOWPOS_UNDEFINED, // initial x position
SDL_WINDOWPOS_UNDEFINED, // initial y position
640, // width, in pixels
480, // height, in pixels
0 // flags
);
renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED);
//set the drawing color to blue
SDL_SetRenderDrawColor(renderer, 0, 0, 255, 255);
//Clear the screen (to blue)
SDL_RenderClear(renderer);
//set the drawing color to white
SDL_SetRenderDrawColor(renderer, 255, 255, 255, 255);
SDL_Rect rect = { 220, 140, 200, 200 };
SDL_RenderFillRect(renderer, &rect);
//We are done drawing, "present" or show to the screen what we've drawn
SDL_RenderPresent(renderer);
SDL_Delay(5000);
// Close and destroy the window
SDL_DestroyWindow(window);
SDL_DestroyRenderer(renderer);
// Clean up
SDL_Quit();
return 0;
}