-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPCmain.cpp
More file actions
59 lines (46 loc) · 1.36 KB
/
PCmain.cpp
File metadata and controls
59 lines (46 loc) · 1.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
// CrossPiProject.cpp : This file contains the PC 'main' function. Program execution begins and ends there.
//
#include "Input.h"
#include <iostream>
#include <glad/glad.h>
#include <GLFW/glfw3.h>
#include <glm/common.hpp>
#include "Game.h"
#include "WindowsGraphics.h"
#include "WindowsInput.h"
#include "WindowsAssetManager.h"
#ifdef _DEBUG
#include "vld.h"
#endif
#ifdef WINDOWS_BUILD
// in case of a laptop with poor on board GPU, lets make sure we switch on any power gpu's we have to get max compatability
extern "C"
{
__declspec(dllexport) unsigned long NvOptimusEnablement = 0x00000001;
}
extern "C"
{
__declspec(dllexport) int AmdPowerXpressRequestHighPerformance = 1;
}
#endif
//
WindowsGraphics* WinGraphics;
Input* input;
Game* game;
// Mains only purpose is to set up OGL and then jump to general game code
int main()
{
WinGraphics = new WindowsGraphics();
glfwSwapInterval(1); // stop the windows build updating without vblank so its the same speed as pi
input = new Input(new WindowsKeyboard(WinGraphics->Window()), new WindowsMouse(WinGraphics->Window()));
game = new Game(input, WinGraphics, Game::Platform::Windows);
game->m_assetManager = std::make_unique<WindowsAssetManager>();
game->Start();
delete game;
delete input;
return 0;
}
void framebufferSizeCallback(GLFWwindow* /*window*/, int width, int height)
{
glViewport(0, 0, width, height);
}