mirror of
https://github.com/HowestDAE/dae16-VerhulstBram.git
synced 2026-02-04 09:19:19 +01:00
Add window icon,
Add digging animation (Non functional)
This commit is contained in:
@@ -107,7 +107,7 @@ void BaseGame::InitializeGameEngine()
|
||||
|
||||
// Setup Dear ImGui style
|
||||
ImGui::StyleColorsDark();
|
||||
//ImGui::StyleColorsLight();
|
||||
// ImGui::StyleColorsLight();
|
||||
|
||||
// Setup Platform/Renderer backends
|
||||
ImGui_ImplSDL2_InitForOpenGL(m_pWindow, m_pContext);
|
||||
@@ -146,6 +146,10 @@ void BaseGame::InitializeGameEngine()
|
||||
return;
|
||||
}
|
||||
|
||||
m_pIcon = IMG_Load("icon.png");
|
||||
SDL_SetWindowIcon(m_pWindow, m_pIcon);
|
||||
|
||||
// delete icon;
|
||||
|
||||
//Initialize controller
|
||||
m_pGameController = nullptr;
|
||||
@@ -270,6 +274,9 @@ void BaseGame::CleanupGameEngine()
|
||||
ImGui_ImplSDL2_Shutdown();
|
||||
ImGui::DestroyContext();
|
||||
|
||||
SDL_FreeSurface(m_pIcon);
|
||||
delete m_pIcon;
|
||||
|
||||
SDL_GL_DeleteContext(m_pContext);
|
||||
|
||||
SDL_DestroyWindow(m_pWindow);
|
||||
|
||||
@@ -59,6 +59,8 @@ private:
|
||||
|
||||
SDL_GameController* m_pGameController;
|
||||
|
||||
SDL_Surface* m_pIcon;
|
||||
|
||||
// FUNCTIONS
|
||||
void InitializeGameEngine();
|
||||
void CleanupGameEngine();
|
||||
|
||||
@@ -692,6 +692,12 @@ float utils::map(float value, float start1, float stop1, float start2, float sto
|
||||
float newVal = (value - start1) / (stop1 - start1) * (stop2 - start2) + start2;
|
||||
return newVal;
|
||||
}
|
||||
float utils::clamp(float value, float min, float max) {
|
||||
return std::max(min, std::min(value, max));
|
||||
}
|
||||
Vector2f utils::clamp(const Vector2f& value, const Vector2f& min, const Vector2f& max) {
|
||||
return Vector2f { clamp(value.x, min.x, max.x), clamp(value.y, min.y, max.y) };
|
||||
}
|
||||
bool utils::isKeyDown(int keycode) {
|
||||
const Uint8* pStates = SDL_GetKeyboardState(nullptr);
|
||||
if (pStates != nullptr) {
|
||||
|
||||
@@ -111,6 +111,9 @@ namespace utils
|
||||
Vector2f lerp(const Vector2f& a, const Vector2f& b, float t);
|
||||
|
||||
float map(float value, float start1, float stop1, float start2, float stop2);
|
||||
|
||||
float clamp(float value, float min, float max);
|
||||
Vector2f clamp(const Vector2f& value, const Vector2f& min, const Vector2f& max);
|
||||
#pragma endregion CollisionFunctionality
|
||||
|
||||
bool isKeyDown(SDL_Keycode keycode);
|
||||
|
||||
Reference in New Issue
Block a user