Skip to content

Commit b3a6769

Browse files
Rebuild project
1 parent 16f400c commit b3a6769

File tree

103 files changed

+4951
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

103 files changed

+4951
-0
lines changed

AppFiles/build/freetype6.dll

-510 KB
Binary file not shown.

AppFiles/build/glew32.dll

-635 KB
Binary file not shown.

AppFiles/build/libengine.dll

-10.8 MB
Binary file not shown.

AppFiles/build/libgcc_s_dw2-1.dll

-916 KB
Binary file not shown.

AppFiles/build/libstb_image.dll

-129 KB
Binary file not shown.

AppFiles/build/libstdc++-6.dll

-1.44 MB
Binary file not shown.

AppFiles/build/terrain.exe

-257 KB
Binary file not shown.

AppFiles/build/zlib1.dll

-129 KB
Binary file not shown.

src/engine/ENGINE PLACE HERE.txt

Whitespace-only changes.

src/engine/Engine.cpp

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
/* Copyright (c) 2020 by Stan Fortoński */
2+
3+
#include "Engine.hpp"
4+
5+
namespace Engine
6+
{
7+
void Engine::initGLFW() const
8+
{
9+
glfwInit();
10+
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, Config::get().getMajorVersion());
11+
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, Config::get().getMinorVersion());
12+
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
13+
14+
#ifdef __APPLE__
15+
glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);
16+
#endif
17+
}
18+
19+
void Engine::initGLEW() const
20+
{
21+
glewExperimental = GL_TRUE;
22+
if (glewInit() != GLEW_OK)
23+
throw std::runtime_error("Can\'t init GLEW");
24+
}
25+
26+
void Engine::initDefaultOptionsGL() const
27+
{
28+
if (Config::get().getSamples() > 0)
29+
glEnable(GL_MULTISAMPLE);
30+
glEnable(GL_DEPTH_TEST);
31+
glDepthFunc(GL_LESS);
32+
glEnable(GL_CULL_FACE);
33+
glEnable(GL_BLEND);
34+
glEnable(GL_CLIP_DISTANCE0);
35+
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
36+
}
37+
38+
void Engine::initDeltaTime()
39+
{
40+
float currentTime = glfwGetTime();
41+
deltaTime = currentTime - lastTime;
42+
lastTime = currentTime;
43+
}
44+
45+
void Engine::calcFPS()
46+
{
47+
float currentTime = glfwGetTime();
48+
if ((currentTime - lastTimeFromShow) > 1)
49+
{
50+
actualFPS = std::to_string(frames)+" FPS";
51+
frames = 0;
52+
lastTimeFromShow = currentTime;
53+
}
54+
else ++frames;
55+
}
56+
57+
#if DEBUG_ENGINE == 1
58+
void Engine::showErrors()
59+
{
60+
GLenum err;
61+
while ((err = glGetError()) != GL_NO_ERROR)
62+
std::cout<<"GL error code: "<<err<<std::endl;
63+
}
64+
#endif
65+
}

0 commit comments

Comments
 (0)