Skip to content

Commit

Permalink
Release Candidate v1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
vedangjavdekar committed Oct 23, 2023
1 parent 67b13de commit 0a76896
Show file tree
Hide file tree
Showing 56 changed files with 18,270 additions and 393 deletions.
3 changes: 2 additions & 1 deletion Dependencies.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
IncludeDirs={}

IncludeDirs["raylib"] = "%{wks.location}/Engine/vendor/raylib/src"
IncludeDirs["raylib"] = "%{wks.location}/Engine/vendor/raylib/src"
IncludeDirs["fmt"] = "%{wks.location}/Engine/vendor/fmt/include"
15 changes: 11 additions & 4 deletions Engine/premake5.lua
Original file line number Diff line number Diff line change
@@ -1,19 +1,24 @@
project "Engine"
kind "ConsoleApp"
language "C++"
cppdialect "C++17"

filter "configurations:Debug"
kind "ConsoleApp"
filter "configurations:Release"
kind "WindowedApp"
filter {}

targetdir(targetPath)
objdir(objectPath)
location(projectLocation)
debugdir(debugPath)

dependson {
"raylib"
"raylib",
}

links{
"raylib"
"raylib",
}

files {
Expand All @@ -22,12 +27,14 @@ project "Engine"
}

defines{
"BUILD_LIBTYPE_SHARED"
"BUILD_LIBTYPE_SHARED",
"FMT_HEADER_ONLY"
}

includedirs {
"src",
"%{IncludeDirs.raylib}",
"%{IncludeDirs.fmt}",
}

filter "configurations:Debug"
Expand Down
235 changes: 235 additions & 0 deletions Engine/src/Animations/Easings.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,235 @@
#pragma once
// Reference: https://github.com/nicolausYes/easing-functions/blob/master/src/easing.cpp
#include <cmath>

#ifndef PI
#define PI 3.1415926545f
#endif

namespace Engine::Easings
{
inline float EaseInSine(float t)
{
return sin(1.5707963f * t);
}

inline float EaseOutSine(float t)
{
return 1.0f + sin(1.5707963f * (--t));
}

inline float EaseInOutSine(float t)
{
return 0.5f * (1 + sin(3.1415926f * (t - 0.5f)));
}

inline float EaseInQuad(float t)
{
return t * t;
}

inline float EaseOutQuad(float t)
{
return t * (2.0f - t);
}

inline float EaseInOutQuad(float t)
{
return t < 0.5f ? 2.0f * t * t : t * (4.0f - 2.0f * t) - 1.0f;
}

inline float EaseInCubic(float t)
{
return t * t * t;
}

inline float EaseOutCubic(float t)
{
return 1.0f + (--t) * t * t;
}

inline float EaseInOutCubic(float t)
{
if (t < 0.5f)
{
return 4.0f * t * t * t;
}
else
{
float f = ((2 * t) - 2);
return 0.5 * f * f * f + 1;
}
}

inline float EaseInQuart(float t)
{
t *= t;
return t * t;
}

inline float EaseOutQuart(float t)
{
t = (--t) * t;
return 1 - t * t;
}

inline float EaseInOutQuart(float t)
{
if (t < 0.5f)
{
t *= t;
return 8.0f * t * t;
}
else
{
t = (--t) * t;
return 1.0f - 8.0f * t * t;
}
}

inline float EaseInQuint(float t)
{
float t2 = t * t;
return t * t2 * t2;
}

inline float EaseOutQuint(float t)
{
float t2 = (--t) * t;
return 1.0f + t * t2 * t2;
}

inline float EaseInOutQuint(float t)
{
float t2;
if (t < 0.5f)
{
t2 = t * t;
return 16.0f * t * t2 * t2;
}
else
{
t2 = (--t) * t;
return 1.0f + 16.0f * t * t2 * t2;
}
}

inline float EaseInExpo(float t)
{
return (pow(2.0f, 8.0f * t) - 1.0f) / 255.0f;
}

inline float EaseOutExpo(float t)
{
return 1.0f - pow(2.0f, -8.0f * t);
}

inline float EaseInOutExpo(float t)
{
if (t < 0.5f)
{
return (pow(2.0f, 16.0f * t) - 1.0f) / 510.0f;
}
else
{
return 1.0f - 0.5f * pow(2.0f, -16.0f * (t - 0.5f));
}
}

inline float EaseInCirc(float t)
{
return 1.0f - sqrt(1.0f - t);
}

inline float EaseOutCirc(float t)
{
return sqrt(t);
}

inline float EaseInOutCirc(float t)
{
if (t < 0.5f)
{
return (1.0f - sqrt(1.0f - 2.0f * t)) * 0.5f;
}
else
{
return (1.0f + sqrt(2.0f * t - 1.0f)) * 0.5f;
}
}

inline float EaseInBack(float t)
{
return t * t * (2.70158f * t - 1.70158f);
}

inline float EaseOutBack(float t)
{
return 1.0f + (--t) * t * (2.70158f * t + 1.70158f);
}

inline float EaseInOutBack(float t)
{
if (t < 0.5f)
{
return t * t * (7 * t - 2.5f) * 2.0f;
}
else
{
return 1.0f + (--t) * t * 2.0f * (7.0f * t + 2.5f);
}
}

inline float EaseInElastic(float t)
{
float t2 = t * t;
return t2 * t2 * sin(t * PI * 4.5f);
}

inline float EaseOutElastic(float t)
{
float t2 = (t - 1.0f) * (t - 1.0f);
return 1 - t2 * t2 * cos(t * PI * 4.5f);
}

inline float EaseInOutElastic(float t)
{
float t2;
if (t < 0.45f)
{
t2 = t * t;
return 8.0f * t2 * t2 * sin(t * PI * 9.0f);
}
else if (t < 0.55f)
{
return 0.5f + 0.75f * sin(t * PI * 4.0f);
}
else
{
t2 = (t - 1.0f) * (t - 1.0f);
return 1.0f - 8.0f * t2 * t2 * sin(t * PI * 9.0f);
}
}

inline float EaseInBounce(float t)
{
return pow(2.0f, 6.0f * (t - 1.0f)) * abs(sin(t * PI * 3.5f));
}

inline float EaseOutBounce(float t)
{
return 1.0f - pow(2.0f, -6.0f * t) * abs(cos(t * PI * 3.5f));
}

inline float EaseInOutBounce(float t)
{
if (t < 0.5f)
{
return 8.0f * pow(2.0f, 8.0f * (t - 1.0f)) * abs(sin(t * PI * 7.0f));
}
else
{
return 1.0f - 8.0f * pow(2.0f, -8.0f * t) * abs(sin(t * PI * 7.0f));
}
}
}
81 changes: 81 additions & 0 deletions Engine/src/Engine/ActionTypes.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
#pragma once
#include <stdint.h>
#define BIT(x) 1 << x

namespace Engine
{
enum class ActionType : uint8_t
{
BOARD_RESET,
SAVE_LEVEL,
TOGGLE_LEVEL_MENU,
EDITOR_MODE,
PLAY_MODE,
ALT_MODE,
NUMBER_MODE,
SELECT_LEFT,
SELECT_RIGHT,
SELECT_UP,
SELECT_DOWN,
ONE,
TWO,
THREE,
FOUR,
FIVE,
SIX,
SEVEN,
EIGHT,
NINE,
COMMIT,
CANCEL
};

enum class MappingContext : uint8_t
{
UNDEFINED = 0,
ALWAYS_ON = BIT(0),
GAME = BIT(1),
POST_GAME = BIT(2),
EDITOR = BIT(3),
LEVEL_SELECTION = BIT(4),
};

inline constexpr MappingContext operator|(MappingContext a, MappingContext b)
{
return static_cast<MappingContext>(static_cast<uint8_t>(a) | static_cast<uint8_t>(b));
}

inline constexpr MappingContext operator&(MappingContext a, MappingContext b)
{
return static_cast<MappingContext>(static_cast<uint8_t>(a) & static_cast<uint8_t>(b));
}

inline constexpr MappingContext& operator|=(MappingContext& a, MappingContext b)
{
return a = a | b;
}

inline constexpr MappingContext& operator&=(MappingContext& a, MappingContext b)
{
return a = a & b;
}

inline constexpr MappingContext operator ~(MappingContext a)
{
return static_cast<MappingContext>(~static_cast<uint8_t>(a));
}

enum class InteractionType : uint8_t
{
PRESSED,
REPEATED,
DOWN,
RELEASED,
};

enum class InputLayerOperation : int
{
POP = -1,
PUSH = 1
};
}
Loading

0 comments on commit 0a76896

Please sign in to comment.