int WINAPI WinMain(HINSTANCE hInstance,	//Main windows function
	HINSTANCE hPrevInstance, 
	LPSTR lpCmdLine,
	int nShowCmd)
{

	if(!InitializeWindow(hInstance, nShowCmd, Width, Height, true))
	{
		MessageBox(0, L"Window Initialization - Failed",
			L"Error", MB_OK);
		return 0;
	}

	if(!InitializeDirect3d11App(hInstance))	//Initialize Direct3D
	{
		MessageBox(0, L"Direct3D Initialization - Failed",
			L"Error", MB_OK);
		return 0;
	}

	if(!InitScene())	//Initialize our scene
	{
		MessageBox(0, L"Scene Initialization - Failed",
			L"Error", MB_OK);
		return 0;
	}

	messageloop();

	CleanUp();    

	return 0;
}
예제 #2
0
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR pCmdLine, int nCmdShow)
{
	g_hInstance = hInstance;

	InitializeContext();
	InitializeWindow();

	g_VkSwapchain.Initialize();
	g_VkSwapchain.InitializeSwapchain(kScreenWidth, kScreenHeight, false);

	InitializeRenderSettings();

	while (true)
	{
		PollEvents();

		if (g_CloseRequest)
		{
			break;
		}

		DrawScene();
	}

	DestroyRenderSettings();
	g_VkSwapchain.Destroy();
	DestroyWindow();
	DestroyContext();
	return 0;
}
예제 #3
0
파일: Main.cpp 프로젝트: m1h4/Xetrix
INT WINAPI WinMain(HINSTANCE /*hInstance*/,HINSTANCE /*hPrevInstance*/,LPSTR /*lpCmdLine*/,INT /*nCmdShow*/)
{
	SetUnhandledExceptionFilter(Debug::DumpException);

	srand(GetTickCount());

	InitCommonControls();

	if(!InitializeWindow(800,600))
		return 0;

	MSG	msg = {0};

	while(msg.message != WM_QUIT)
	{
		if(PeekMessage(&msg,NULL,0,0,PM_REMOVE))
		{
			TranslateMessage(&msg);
			DispatchMessage(&msg);
		}
		
		if(!Update())
			PostQuitMessage(0);
		else if(!Draw())
			PostQuitMessage(0);
		else if(!SwapBuffers(mainDC))
			TRACE(TEXT("Failed to swap buffers.\n"));
	}

	KillGame();
	KillTimer();
	KillWindow();

	return msg.wParam;
}
Window::Window(unsigned int _width, unsigned int _height, const std::wstring& name) :
    width(_width),
    height(_height),
    title(name)
{
    InitializeWindow();
}
예제 #5
0
bool SystemClass::Initialize()
{
	int screenWidth, screenHeight;
	bool result;

	// initialize screen dimension variables to 0.
	screenWidth = screenHeight = 0;

	// initialize the windows API - pass in references to screen dimension variables to get them set.
	InitializeWindow(screenWidth, screenHeight);

	input = new InputClass();
	if (!input)
		return false;

	input->Initialize();

	graphics = new GraphicsClass();

	if (!graphics)
		return false;

	result = graphics->Initialize(screenWidth, screenHeight, hWnd);
	if (!result)
		return false;

	return result;
}
예제 #6
0
void main(int argc, char **argv)
{
	glutInit(&argc, argv);	//Initialize toolkit
	glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);	//set the display mode
	InitializeWindow();
	registerCallBackFunctions();
	initializeDrawingGraphics();
	glutMainLoop();	//Go into a perpetual loop
}
예제 #7
0
// Ensures everything is properly initialized
bool Game::Initialize(void)
{
	if (!InitializeWindow())
		return false;
	if (!InitializeDirect3D())
		return false;

	return true;
}
예제 #8
0
EditorWindow::EditorWindow(QWidget *parent, Qt::WindowFlags flags)
    : QMainWindow(parent, flags)
{
    setWindowTitle(tr("Vector Graphics Editor"));
    setGeometry(200, 100, 1200, 700);

    InitializeWindow();
    InitMenuBar();
}
예제 #9
0
Window * InitializeMenuWindow(const char *name, WindowHandler init, WindowHandler deinit, WindowHandler appear, WindowHandler disappear)
{
	Window *window = InitializeWindow(name);
	WindowHandlers handlers = {.load = init, .unload = deinit, .appear = appear, .disappear = disappear};
	window_set_window_handlers(window,handlers);
	
	SetMenuClickConfigProvider(window);
	return window;
}
예제 #10
0
/*!
 * - Set random seed
 * - Initialize all SDL systems
 * - Initialize SDL true type fonts
 * - Initialize the window
 * - Load viewports
 * - Load Texture file
 * - Load Debugger file
 */
bool START()
{
    //Initialise objects needed for schema validation
    xercesc::XMLPlatformUtils::Initialize();

    //Initiate globals
    global::IMAGE_MANAGER = new ImageManager();
    global::TEXTURE_MANAGER = new TextureManager();
    global::MESH_MANAGER = new Mesh_List();
    global::SETTINGS = new SettingsParser();

    //Parse settings file
    global::SETTINGS->Load("setup.ini");

    if (!GameDatabase::GlobalInit())
    {
      return false;
    }

	//Seed the random number generator
	SimpleRNG::SetSeedFromSystemTime();

	//Initialize all SDL subsystems
    if (SDL_Init(SDL_INIT_EVERYTHING) == -1)
    {
        std::cerr << "@START() -> Fail: SDL_Init(SDL_INIT_EVERYTHING)" << std::endl;
        return false;
    }

	//Initialize window 
    if (!InitializeWindow())
    {
        std::cerr << "@START() -> Fail: InitializeWindow()" << std::endl;
        return false;
    }

	//Load Viewports
	ViewportHandler::LoadResources(global::WINDOW->w(), global::WINDOW->h());
	
	//Initialize SDL_ttf
    if (TTF_Init() == -1)
    {
        std::cerr << "@START() -> Fail: TTF_Init()" << std::endl;
        return false;
    }

	//Load texture document
	global::TEXTURE_MANAGER->LoadDocument("Images.xml");

	//Load in debug file
	DEBUGGER.Load("debug_text.xml");

	return true;

}	//End: START()
예제 #11
0
Window * InitializeMenuWindow(void *menuWindow, const char *name, bool animated, WindowHandler init, WindowHandler deinit, WindowHandler appear, WindowHandler disappear)
{
	Window *window = InitializeWindow(name, animated);
	WindowHandlers handlers = {.load = init, .unload = deinit, .appear = appear, .disappear = disappear};
	window_set_window_handlers(window,handlers);
	
	SetMenuClickConfigProvider(window);
	window_set_user_data(window,menuWindow);
	window_stack_push(window, animated);
	return window;
}
예제 #12
0
Search::Search()
:m_hWnd(0)
,m_ClientWidth(300)
,m_ClientHeight(200)
{
	InitializeWindow();

	// Set de new WNDPROC for the button, and store the old one
	m_procOld = (WNDPROC) SetWindowLong(m_hWnd, GWL_WNDPROC, (LONG) ProcStatic);

	// Store 'this' as data for the Button object so that the static PROC can call the member proc
	SetWindowLong(m_hWnd, GWL_USERDATA, (LONG) this);
}
예제 #13
0
void InitializeMenuWindow(Window *window, const char *name, bool animated, WindowHandler init, WindowHandler deinit, WindowHandler appear, WindowHandler disappear)
{
	InitializeWindow(window, name, animated);
	window->window_handlers.load = init;
	window->window_handlers.unload = deinit;
	window->window_handlers.appear = appear;
	window->window_handlers.disappear = disappear;
#if OVERRIDE_BACK_BUTTON	
	window->overrides_back_button = true;
#endif
	
	SetMenuClickConfigProvider(window);
}
예제 #14
0
	bool Framework::Initialize()
	{
		Time::Reset();
		if( false == InitializeWindow(_T("Prototype"), GetScreenWidth(), GetScreenHeight() ) ) return false;

		if( false == InitializeGraphicSystem( GetScreenWidth(), GetScreenHeight() ) ) return false;

		if( false == InitializeInputSystem() ) return false;

		m_rpFrameRate = new FrameRate();

		DebugFont::GetInstance().Initialize();
		return true;
	}
예제 #15
0
INT WINAPI wWinMain(HINSTANCE,HINSTANCE,LPWSTR,INT)
{
    (void)HeapSetInformation(NULL, HeapEnableTerminationOnCorruption, NULL, 0);

    HWND hwnd = 0;

    if (InitializeApp() && InitializeWindow(&hwnd))
    {
        MessageLoop(hwnd);
    }

    CleanUp();

    return 0;
}
예제 #16
0
// Creates the window needed for popup menu, then registers a tray icon, as well as
// making sure to receive WM_POEPRICERMESSAGE whenever icon is rightclicked.
void ShowTrayIcon(){
	//Get a window for our tray
	InitializeWindow(); // Exits if it fails
	//Load icon image
	HICON hIcon;
	hIcon = LoadImage(NULL, "data/icon.ico", IMAGE_ICON, 64, 64, LR_LOADFROMFILE);
	//hIcon = LoadImage(NULL, IDI_INFORMATION, IMAGE_ICON, 16, 16, LR_SHARED);
	//Initialize Icon
	nIconData.cbSize = sizeof(NOTIFYICONDATA);
    nIconData.hWnd = hwnd;
    nIconData.uID = 100;
    nIconData.uCallbackMessage = WM_POEPRICERMESSAGE;
    nIconData.hIcon = hIcon;
	strcpy(nIconData.szTip, "PoEPricer");
    nIconData.uFlags = NIF_MESSAGE | NIF_ICON | NIF_TIP;
	Shell_NotifyIcon(NIM_ADD, &nIconData);
}
예제 #17
0
void InitializeConfirmationWindow(Window *window, TextLayer *exitText, TextLayer *yesText, TextLayer *noText)
{
	InitializeWindow(window, "Exit", true);

	InitializeTextLayer(exitText, exitFrame, fonts_get_system_font(FONT_KEY_GOTHIC_24_BOLD));
	text_layer_set_text(exitText, "Exit?");
	text_layer_set_text_alignment(exitText, GTextAlignmentCenter);
	layer_add_child(&window->layer, &exitText->layer);

	InitializeTextLayer(yesText, yesFrame, fonts_get_system_font(FONT_KEY_GOTHIC_18_BOLD));
	text_layer_set_text(yesText, "Yes");
	layer_add_child(&window->layer, &yesText->layer);

	InitializeTextLayer(noText, noFrame, fonts_get_system_font(FONT_KEY_GOTHIC_18_BOLD));
	text_layer_set_text(noText, "No");
	layer_add_child(&window->layer, &noText->layer);
}
예제 #18
0
파일: App.cpp 프로젝트: hawncho/zombiegame
int main(int argc, char** argv)
{
	App app;

	// Create a GLUT window
	InitializeWindow(argc, argv, WINDOW_WIDTH, WINDOW_HEIGHT, WINDOW_TITLE, &app);

	// Initialize that app
	if (!app.Init())
	{
		fprintf(stderr, "Failed to initialize app.\n");
		system("pause");
		return 17;
	}

	return 0;
}
예제 #19
0
파일: Client.cpp 프로젝트: opatut/chars
void Client::StartupOgre() {
	Ogre::LogManager* logMgr = OGRE_NEW Ogre::LogManager;
	logMgr->createLog("DefaultLog", true, false, false);

	mOgreRoot = new Ogre::Root("../data/config/plugins.cfg");

	// setup resources
	// Load resource paths from config file
	Ogre::ConfigFile cf;
	cf.load("../data/config/resources.cfg");

	// Go through all sections & settings in the file
	Ogre::ConfigFile::SectionIterator seci = cf.getSectionIterator();
	Ogre::String secName, typeName, archName;
	while(seci.hasMoreElements()) {
		secName = seci.peekNextKey();
		Ogre::ConfigFile::SettingsMultiMap *settings = seci.getNext();
		Ogre::ConfigFile::SettingsMultiMap::iterator i;
		for(i = settings->begin(); i != settings->end(); ++i) {
			typeName = i->first;
			archName = i->second;
			Ogre::ResourceGroupManager::getSingleton().addResourceLocation(
				archName, typeName, secName);
		}
	}

	// configure
	// Show the configuration dialog and initialise the system
	if(!(mOgreRoot->restoreConfig() || mOgreRoot->showConfigDialog())) {
		exit(0);
	}
	mWindow = mOgreRoot->initialise(true, "Client Window");


	// Set default mipmap level (NB some APIs ignore this)
	Ogre::TextureManager::getSingleton().setDefaultNumMipmaps(5);
	// initialise all resource groups
	// Ogre::ResourceGroupManager::getSingleton().initialiseAllResourceGroups();

	Ogre::ResourceGroupManager::getSingleton().initialiseResourceGroup("Basics");
	Ogre::ResourceGroupManager::getSingleton().initialiseResourceGroup("GUI");

	InitializeWindow();
	// ogre loaded
}
예제 #20
0
MixedApp::MixedApp(HINSTANCE instance)
    : Window(nullptr)
{
#if HACK_GENERATE_GAUSSIAN_KERNEL // Move this somewhere else!
    float o = 0.9f;     // scale
    float matrix[7]{};  // -3 to 3
    float sum = 0.f;
    for (int i = -3; i <= 3; ++i)
    {
        matrix[i + 3] = exp(-(i * i) / (2 * o * o)) / sqrtf(2 * XM_PI * (o * o));
        sum += matrix[i + 3];
    }

    // Normalize
    for (int i = -3; i <= 3; ++i)
    {
        matrix[i + 3] = matrix[i + 3] / sum;
    }
#endif

    CoInitializeEx(nullptr, COINIT_MULTITHREADED);

    HRESULT hr = CoCreateInstance(CLSID_WICImagingFactory, nullptr, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&WicFactory));
    CHECKHR(hr, L"Failed to create WIC factory. hr = 0x%08x.", hr);

    InitializeWindow(instance);
    Renderer.reset(new ::Renderer(Window));

    uint32_t width = 0, height = 0;
    std::unique_ptr<uint8_t[]> pixels = LoadImageFile(L"car2.jpg", &width, &height);

    Color = Renderer->CreateColorImage(width, height, (const uint32_t*)pixels.get());
    Lum = Renderer->CreateLuminanceImage(width, height, nullptr);
    Norm = Renderer->CreateNormalsImage(width, height, nullptr);
    Blurred = Renderer->CreateColorImage(width, height, nullptr);
    Edges1 = Renderer->CreateLuminanceImage(width, height, nullptr);
    Edges2 = Renderer->CreateLuminanceImage(width, height, nullptr);

    Renderer->ColorToLum(Color, Lum);
    Renderer->LumToNormals(Lum, Norm);
    Renderer->Gaussian(Color, Blurred);
    Renderer->EdgeDetect(Color, Edges1);
    Renderer->EdgeDetect(Blurred, Edges2);
}
예제 #21
0
파일: Main.cpp 프로젝트: Garrowni/ARevenge
		int WINAPI WinMain(HINSTANCE hInstance,
			HINSTANCE hPrevInstance,
			LPSTR lpCmdLine,
			int nShowCmd)
		{
			// Initialisiere und Registriere das Fenster.
			if (!InitializeWindow(hInstance, nShowCmd, Width, Height, true))
			{
				MessageBox(0, L"Window Initialization - Failed",
					L"Error", MB_OK);
				return 0;
			}
		
			//Initialisiere Direct3D
			if (!InitializeDirect3d11App(hInstance))
			{
				MessageBox(0, L"Direct3D Initialization - Failed",
					L"Error", MB_OK);
				return 0;
			}
		
			//Initialisiere die Szene
			if (!InitScene())
			{
				MessageBox(0, L"Scene Initialization - Failed",
					L"Error", MB_OK);
				return 0;
			}
		
			// im der messageloop() Schleife läuft das eigentliche Programm ab.
			messageloop();
		
			//Räume auf
			ReleaseObjects();
		
			return 0;
		
		}
예제 #22
0
int WINAPI WinMain(          HINSTANCE hInstance,
    HINSTANCE hPrevInstance,
    LPSTR lpCmdLine,
    int nCmdShow
)
{
    GameEngine engine;
    InitializeWindow(&engine);
    InitializeEngine(&engine);
    InitializeResource();

    if (engine.Initialize())
    {
        g_hWnd = engine.GethWnd();
        game->Start();
        engine.Start();
    }
    else
    {
        MessageBox(NULL, "´´½¨´°¿Úʧ°Ü", NULL, MB_OK);
    }

    return 0;
}
예제 #23
0
/**
	Initialize Window's private member variables
**/
Window::Window(int width, int height, wstring windowTitle)
	: _clientWidth(width), _clientHeight(height), _hInstance(0), _hWnd(0),
	_maximized(false), _minimized(false), _resizing(false), _windowTitle(windowTitle)
{
	InitializeWindow();
}
예제 #24
0
파일: Input.cpp 프로젝트: Vavassor/meteor
void Input::Initialize()
{
	for(int i = 0; i < MAX_PLAYERS; ++i)
		playerControllers[i] = 0;

	mousePosition[0] = mousePosition[1] = 0;

#if defined(_WIN32)
	InitializeWindow();

	keyBindings[A] = VK_SPACE;
	keyBindings[B] = 'X';
	keyBindings[X] = 'E';
	keyBindings[Y] = 'R';
	keyBindings[START] = VK_ESCAPE;
	keyBindings[SELECT] = VK_RETURN;
	keyBindings[L_SHOULDER] = VK_OEM_MINUS;
	keyBindings[R_SHOULDER] = VK_OEM_PLUS;
	keyBindings[D_RIGHT] = VK_END;
	keyBindings[D_UP] = VK_PRIOR;
	keyBindings[D_LEFT] = VK_HOME;
	keyBindings[D_DOWN] = VK_NEXT;

	keyBindings[NUM_BUTTONS + L_TRIGGER] = VK_OEM_4;
	keyBindings[NUM_BUTTONS + R_TRIGGER] = VK_OEM_6;
	keyBindings[NUM_BUTTONS + A_RIGHT] = 'D';
	keyBindings[NUM_BUTTONS + A_UP] = 'W';
	keyBindings[NUM_BUTTONS + A_LEFT] = 'A';
	keyBindings[NUM_BUTTONS + A_DOWN] = 'S';

#elif defined(__linux__)
	RegisterMonitor();
#endif

#if defined(X11)
	display = XOpenDisplay(NULL);

	window = DefaultRootWindow(display);

	// create transparent cursor for when mouse is in relative-movement mode
	{
		static char noData[] = { 0 };
		XColor black = { 0 };
		Pixmap blankBitmap = XCreateBitmapFromData(display, window, noData, 1, 1);

		invisibleCursor = XCreatePixmapCursor(display, blankBitmap, blankBitmap,
			&black, &black, 0, 0);
		XFreePixmap(display, blankBitmap);
	}

	keyBindings[A] = GetScanCode(XK_space);
	keyBindings[B] = GetScanCode('X');
	keyBindings[X] = GetScanCode('E');
	keyBindings[Y] = GetScanCode('R');
	keyBindings[START] = GetScanCode(XK_Escape);
	keyBindings[SELECT] = GetScanCode(XK_Return);
	keyBindings[L_SHOULDER] = GetScanCode(XK_minus);
	keyBindings[R_SHOULDER] = GetScanCode(XK_plus);
	keyBindings[D_RIGHT] = GetScanCode(XK_End);
	keyBindings[D_UP] = GetScanCode(XK_Prior);
	keyBindings[D_LEFT] = GetScanCode(XK_Home);
	keyBindings[D_DOWN] = GetScanCode(XK_Next);

	keyBindings[NUM_BUTTONS + L_TRIGGER] = GetScanCode(XK_bracketleft);
	keyBindings[NUM_BUTTONS + R_TRIGGER] = GetScanCode(XK_bracketright);
	keyBindings[NUM_BUTTONS + A_RIGHT] = GetScanCode('D');
	keyBindings[NUM_BUTTONS + A_UP] = GetScanCode('W');
	keyBindings[NUM_BUTTONS + A_LEFT] = GetScanCode('A');
	keyBindings[NUM_BUTTONS + A_DOWN] = GetScanCode('S');
#endif

	DetectControllers();
}
예제 #25
0
파일: main.cpp 프로젝트: schnapple/LifeSim
void Run() {

		SetKey(GLFW_KEY_ESCAPE, std::bind(&Terminate));

		deltaTime = 1.0 / 60.0;
		InitializeWindow();


		//Init values and objects

		// Build the broadphase
		btBroadphaseInterface* broadphase = new btDbvtBroadphase();

		// Set up the collision configuration and dispatcher
		btDefaultCollisionConfiguration* collisionConfiguration = new btDefaultCollisionConfiguration();
		btCollisionDispatcher* dispatcher = new btCollisionDispatcher(collisionConfiguration);

		// The actual physics solver
		btSequentialImpulseConstraintSolver* solver = new btSequentialImpulseConstraintSolver;

		// The world.
		btDiscreteDynamicsWorld* world = new btDiscreteDynamicsWorld(dispatcher, broadphase, solver, collisionConfiguration);
		world->setGravity(btVector3(0, -9.82f*METER, 0));


		Terrain testObj = Terrain(world);
		Object* terrain = &testObj;
		objects.push_back(terrain);

		Anatomy testOrg = Anatomy(world);
		Object* testOrgP = &testOrg;
		objects.push_back(testOrgP);



		//timer info for loop
		double t = 0.0f;
		double currentTime = glfwGetTime();
		double accumulator = 0.0f;

		glfwPollEvents();		//stop loop when glfw exit is called
		glfwSetCursorPos(mainThread, SCREEN_SIZE.x / 2.0f, SCREEN_SIZE.y / 2.0f);



		while (!glfwWindowShouldClose(mainThread)) {
			double newTime = glfwGetTime();
			double frameTime = newTime - currentTime;
			//std::cout << "FPS:: " <<1.0f / frameTime << std::endl;

			//setting up timers
			if (frameTime > 0.25) {
				frameTime = 0.25;
			}
			currentTime = newTime;
			accumulator += frameTime;

			//# of updates based on accumulated time

			while (accumulator >= deltaTime) {

				
				MouseInput();//update mouse change
				glfwPollEvents(); //executes all set input callbacks

				CameraInput(); //bypasses input system for direct camera manipulation
				Update(deltaTime); //updates all objects based on the constant deltaTime.

				world->stepSimulation(deltaTime, 10);

				t += deltaTime;
				accumulator -= deltaTime;
			}


			//draw
			glClearColor(1.0f, 1.0f, 1.0f, 1.0f);
			glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);


			Draw();

			glfwSwapBuffers(mainThread);
	}



	//cleanup
		delete world;
		delete solver;
		delete dispatcher;
		delete collisionConfiguration;
		delete broadphase;

}