#include "demo_init.h"
#include "demo_run.h"
#include "demo_screen.h"
#include "demo_init_gl.h"

#include "fwzSetup.h"

bool fullscreen = false;
bool vsync = false;

// ==============
// ==== Main ====
// ==============

void rundemo(int scr_width, int scr_height, int fs, int vs)
{
	if (fs==0)
		fullscreen = true;
	if (vs==1)
		vsync = true;

	ScreenWidth = scr_width;
	ScreenHeight = scr_height;

    Init();
	setVSync(vs);
	Run();
}

#define demomenu
#ifdef demomenu

INT WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, INT nCmdShow)
{
	fwzSettings setup;

	setup.hInstance = hInstance;

	setup.scrBPP = 32;
	setup.nVsync = 1;

	setup.nAlwaysOnTop = 0;
	setup.scrWidth = 1024;
	setup.scrHeight = 768;
	setup.nWindowed = 1;

	if (!OpenSetupDialog(&setup)) return -1;
	rundemo(setup.scrWidth, setup.scrHeight, setup.nWindowed, setup.nVsync);
	return 0;
}
#else

int main(int argc, char* argv[])
{
	rundemo(1024, 768, 1, 0);
}

#endif
