#include "testApp.h"

//#include "multimon.h"

//--------------------------------------------------------------
void testApp::setup(){	 
	
	//set background to black
	ofBackground(0, 0, 0);	
	
	//for smooth animation
	ofSetVerticalSync(true);
	
	appCtrl.setup();
	
	ofSetWindowTitle("laser tag server");

	/*
	LPCTSTR 		lpDevice 		= NULL;
	DISPLAY_DEVICE  DisplayDevice;
	
	HINSTANCE hInstUser32 = LoadLibrary("User32.DLL");
	
	ZeroMemory(&DisplayDevice, sizeof(DISPLAY_DEVICE));
    DisplayDevice.cb = sizeof(DISPLAY_DEVICE); 
	
	int deviceCount	= 0;
	
	//loop for each adapter available
	while( EnumDisplayDevices((void *)lpDevice, deviceCount, &DisplayDevice, (unsigned long)NULL) ){
		
		lpDevice 			= DisplayDevice.DeviceName;
		int monitorCount 	= 0;
		
		//for each adapter loop through the interfaces
		while( EnumDisplayDevices((void *)lpDevice, monitorCount, &DisplayDevice, NULL) ){
			printf("%s - display %i\n", DisplayDevice.DeviceName, monitorCount);
			monitorCount++;
		}
		
		lpDevice = NULL;
		
		deviceCount++;
	}
	*/
}

//--------------------------------------------------------------
void testApp::update(){
	appCtrl.mainLoop();
}

//--------------------------------------------------------------
void testApp::draw(){
	ofSetupScreen();
	appCtrl.draw();
}


//--------------------------------------------------------------
void testApp::keyPressed  (int key){ 
	if(key == 'f'){
		ofBeginCustomFullscreen(0,0,2048, 768);
	}else if(key =='w'){
		ofEndCustomFullscreen();
	}
	else appCtrl.keyPress(key);
}

//--------------------------------------------------------------
void testApp::keyReleased (int key){ 

	appCtrl.keyRelease(key);
}


//--------------------------------------------------------------
void testApp::mouseMoved(int x, int y ){		
	
}

//--------------------------------------------------------------
void testApp::mouseDragged(int x, int y, int button){
	appCtrl.dragPoint(x,y);
}

//--------------------------------------------------------------
void testApp::mousePressed(int x, int y, int button){
	appCtrl.selectPoint(x,y);
}

//--------------------------------------------------------------
void testApp::mouseReleased(){
	appCtrl.releasePoint();

}
