52 lines
1.5 KiB
C++
52 lines
1.5 KiB
C++
#define SDL_MAIN_HANDLED
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <iostream>
|
|
#include <string.h>
|
|
#include <stdint.h>
|
|
#include <SDL.h>
|
|
#include <SDL_video.h>
|
|
#include "game.h"
|
|
|
|
int main( int argc, const char* argv[] )
|
|
{
|
|
SDL_Renderer *renderer = NULL;
|
|
SDL_Texture *texture = NULL;
|
|
SDL_Window *win;
|
|
SDL_Rect srcR, destR;
|
|
const char name[] = "Game";
|
|
if (SDL_Init(SDL_INIT_EVERYTHING) != 0)
|
|
{
|
|
SDL_Log("Unable to initialize SDL: %s", SDL_GetError());
|
|
return 1;
|
|
}
|
|
|
|
win = SDL_CreateWindow(name, 0, 0, 800, 800, SDL_WINDOW_RESIZABLE);
|
|
if (win == NULL)
|
|
{
|
|
// In the case that the window could not be made...
|
|
printf("Could not create window: %s\n", SDL_GetError());
|
|
return 1;
|
|
}
|
|
renderer = SDL_CreateRenderer(win, -1, SDL_RENDERER_ACCELERATED);
|
|
SDL_SetRenderDrawColor(renderer, 255, 255, 255, 255);
|
|
SDL_Rect rectangle;
|
|
|
|
rectangle.x = 0;
|
|
rectangle.y = 0;
|
|
rectangle.w = 50;
|
|
rectangle.h = 50;
|
|
SDL_RenderFillRect(renderer, &rectangle);
|
|
texture = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_RGBA8888, SDL_TEXTUREACCESS_TARGET, 800, 800);
|
|
|
|
(void)begin_game(renderer, win);
|
|
|
|
SDL_DestroyTexture(texture);
|
|
SDL_DestroyRenderer(renderer);
|
|
SDL_DestroyWindow(win);
|
|
return 0;
|
|
}
|
|
//g++ main.cpp -o blah `sdl2-config --cflags --libs`
|
|
/*
|
|
g++ main.cpp -IC:\Users\Daniel\Documents\Projects\i686-w64-mingw32\include\SDL2 -LC:\Users\Daniel\Documents\Projects\i686-w64-mingw32\lib -w -Wl,-subsystem,windows -lmingw32 -lSDL2main -lSDL2 -o SDLMain
|
|
*/ |