Original Post
Error: 0xC0000005: Access violation writing location 0x00000010. My Guess: A null pointer somewhere I missed. Can't find it though. Code: main.cpp engine.cpp
#ifdef WIN32
#pragma comment(lib, "SDL.lib")
#pragma comment(lib, "SDLmain.lib")
#endif
//#include <iostream>
//#include "Blok.h"
//#include "ColorMath.h"
//#include "Swatch.h"
#include "Engine.h"
//using namespace std;
int main(int argc, char *argv[])
{
/*Blok Block1(1,1,BLACK,false);
Blok Block2(2,2,RED,false);
cout << Block1.get_color() << endl;
cout << Block2.get_color() << endl;
mix(Block1,Block2);
cout << Block1.get_color() << endl;
cout << Block2.get_color() << endl;
cin.get();*/
Engine theEngine;
theEngine.SetTitle("SDL_Stuff");
theEngine.Init();
return 0;
}
#include "Engine.h"
Engine::Engine()
{
winWidth = 800;
winHeight = 600;
winTitle = 0;
winScreen = 0;
}
Engine::~Engine()
{
SDL_Quit();
}
void Engine::Input()
{
}
void Engine::Render()
{
}
void Engine::Logic()
{
}
void Engine::SetSize(const int& width, const int& height)
{
winWidth = width;
winHeight = height;
winScreen = SDL_SetVideoMode( width, height, 0, SDL_ANYFORMAT);
}
SDL_Surface* Engine::GetScreen()
{
return winScreen;
}
void Engine::Init()
{
if( SDL_Init(SDL_INIT_VIDEO) < 0)
{
fprintf(stderr,"SDL failed to initalize.");
SDL_Quit();
}
SetSize( winWidth, winHeight);
if( winScreen == NULL)
{
fprintf(stderr,"SDL failed to display screen.");
SDL_Quit();
}
}
void Engine::Loop()
{
}
void Engine::SetTitle(const char* title)
{
winTitle = title;
SDL_WM_SetCaption( title, 0);
}