Skip to content

Commit

Permalink
fix: project tree
Browse files Browse the repository at this point in the history
  • Loading branch information
AmanMenda committed May 3, 2024
1 parent 47414fc commit 4af1a7d
Show file tree
Hide file tree
Showing 492 changed files with 177,213 additions and 47 deletions.
92 changes: 45 additions & 47 deletions Stuckfish.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -20,39 +20,37 @@
</ProjectConfiguration>
</ItemGroup>
<ItemGroup>
<ClCompile Include="imgui\imgui.cpp" />
<ClCompile Include="imgui\imgui_demo.cpp" />
<ClCompile Include="imgui\imgui_draw.cpp" />
<ClCompile Include="imgui\imgui_impl_glfw.cpp" />
<ClCompile Include="imgui\imgui_impl_opengl3.cpp" />
<ClCompile Include="imgui\imgui_stdlib.cpp" />
<ClCompile Include="imgui\imgui_tables.cpp" />
<ClCompile Include="imgui\imgui_widgets.cpp" />
<ClCompile Include="Sources\App\Logic.cpp" />
<ClCompile Include="Sources\App\Stuckfish.cpp" />
<ClCompile Include="Sources\glad.cpp" />
<ClCompile Include="Sources\Main.cpp" />
<ClCompile Include="Sources\UI\Fonts.cpp" />
<ClCompile Include="Sources\UI\GamesPlayedPage.cpp" />
<ClCompile Include="Sources\UI\UserInfosPage.cpp" />
<ClCompile Include="thirdparty\imgui\imgui.cpp" />
<ClCompile Include="thirdparty\imgui\imgui_demo.cpp" />
<ClCompile Include="thirdparty\imgui\imgui_draw.cpp" />
<ClCompile Include="thirdparty\imgui\imgui_impl_glfw.cpp" />
<ClCompile Include="thirdparty\imgui\imgui_impl_opengl3.cpp" />
<ClCompile Include="thirdparty\imgui\imgui_stdlib.cpp" />
<ClCompile Include="thirdparty\imgui\imgui_tables.cpp" />
<ClCompile Include="thirdparty\imgui\imgui_widgets.cpp" />
<ClCompile Include="src\App\Logic.cpp" />
<ClCompile Include="src\App\Stuckfish.cpp" />
<ClCompile Include="src\glad.cpp" />
<ClCompile Include="src\Main.cpp" />
<ClCompile Include="src\UI\Fonts.cpp" />
<ClCompile Include="src\UI\GamesPlayedPage.cpp" />
<ClCompile Include="src\UI\UserInfosPage.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="imgui\imgui.h" />
<ClInclude Include="imgui\imgui_impl_glfw.h" />
<ClInclude Include="imgui\imgui_impl_opengl3.h" />
<ClInclude Include="imgui\imgui_internal.h" />
<ClInclude Include="imgui\imgui_stdlib.h" />
<ClInclude Include="imgui\imstb_rectpack.h" />
<ClInclude Include="imgui\imstb_textedit.h" />
<ClInclude Include="imgui\imstb_truetype.h" />
<ClInclude Include="Libraries\emscripten\emscripten_mainloop_stub.h" />
<ClInclude Include="Libraries\include\Exceptions.hpp" />
<ClInclude Include="Libraries\include\fonts.hpp" />
<ClInclude Include="Libraries\include\GamesPlayedPage.hpp" />
<ClInclude Include="Libraries\include\Logic.hpp" />
<ClInclude Include="Libraries\include\Page.hpp" />
<ClInclude Include="Libraries\include\Stuckfish.hpp" />
<ClInclude Include="Libraries\include\UserInfosPage.hpp" />
<ClInclude Include="thirdparty\imgui\imgui.h" />
<ClInclude Include="thirdparty\imgui\imgui_impl_glfw.h" />
<ClInclude Include="thirdparty\imgui\imgui_impl_opengl3.h" />
<ClInclude Include="thirdparty\imgui\imgui_internal.h" />
<ClInclude Include="thirdparty\imgui\imgui_stdlib.h" />
<ClInclude Include="thirdparty\imgui\imstb_rectpack.h" />
<ClInclude Include="thirdparty\imgui\imstb_textedit.h" />
<ClInclude Include="thirdparty\imgui\imstb_truetype.h" />
<ClInclude Include="include\UI\fonts.hpp" />
<ClInclude Include="include\UI\GamesPlayedPage.hpp" />
<ClInclude Include="include\App\Logic.hpp" />
<ClInclude Include="include\UI\Page.hpp" />
<ClInclude Include="include\App\Stuckfish.hpp" />
<ClInclude Include="include\UI\UserInfosPage.hpp" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
Expand Down Expand Up @@ -111,24 +109,24 @@
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<IncludePath>Libraries\include</IncludePath>
<LibraryPath>Libraries\lib;$(LibraryPath)</LibraryPath>
<SourcePath>Sources;Sources\App;Sources\UI;$(SourcePath)</SourcePath>
<IncludePath>C:\Users\Aman\source\repos\stuckfish\include\App;C:\Users\Aman\source\repos\stuckfish\include\UI;$(IncludePath)</IncludePath>
<LibraryPath>include\lib;$(LibraryPath)</LibraryPath>
<SourcePath>C:\Users\Aman\source\repos\stuckfish\src\UI;C:\Users\Aman\source\repos\stuckfish\src\App;C:\Users\Aman\source\repos\stuckfish\src</SourcePath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<IncludePath>Libraries\include</IncludePath>
<LibraryPath>Libraries\lib;$(LibraryPath)</LibraryPath>
<SourcePath>Sources;Sources\App;Sources\UI;$(SourcePath)</SourcePath>
<IncludePath>C:\Users\Aman\source\repos\stuckfish\include\App;C:\Users\Aman\source\repos\stuckfish\include\UI;$(IncludePath)</IncludePath>
<LibraryPath>include\lib;$(LibraryPath)</LibraryPath>
<SourcePath>C:\Users\Aman\source\repos\stuckfish\src\UI;C:\Users\Aman\source\repos\stuckfish\src\App;C:\Users\Aman\source\repos\stuckfish\src</SourcePath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<IncludePath>Libraries\include;$(IncludePath)</IncludePath>
<LibraryPath>Libraries\lib;$(LibraryPath)</LibraryPath>
<SourcePath>Sources\UI;Sources\App;Sources;$(SourcePath)</SourcePath>
<IncludePath>include\UI;include\App;$(IncludePath)</IncludePath>
<LibraryPath>include\lib;$(LibraryPath)</LibraryPath>
<SourcePath>src\UI;src\App;src;$(SourcePath)</SourcePath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<IncludePath>Libraries\include;$(IncludePath)</IncludePath>
<LibraryPath>Libraries\lib;$(LibraryPath)</LibraryPath>
<SourcePath>Sources\UI;Sources\App;Sources;$(SourcePath)</SourcePath>
<IncludePath>include\UI;include\App;$(IncludePath)</IncludePath>
<LibraryPath>include\lib;$(LibraryPath)</LibraryPath>
<SourcePath>src\UI;src\App;src;$(SourcePath)</SourcePath>
</PropertyGroup>
<PropertyGroup Label="Vcpkg" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<VcpkgUseStatic>true</VcpkgUseStatic>
Expand All @@ -142,7 +140,7 @@
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<AdditionalIncludeDirectories>imgui;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>thirdparty\imgui;thirdparty\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<LanguageStandard>stdcpp17</LanguageStandard>
</ClCompile>
<Link>
Expand All @@ -159,7 +157,7 @@
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<AdditionalIncludeDirectories>imgui;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>thirdparty\imgui;thirdparty;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<LanguageStandard>stdcpp17</LanguageStandard>
</ClCompile>
<Link>
Expand All @@ -177,7 +175,7 @@
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<AdditionalIncludeDirectories>imgui;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>thirdparty\imgui;thirdparty\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<LanguageStandard>stdcpp17</LanguageStandard>
</ClCompile>
<Link>
Expand All @@ -194,7 +192,7 @@
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<AdditionalIncludeDirectories>imgui;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>thirdparty\imgui;thirdparty;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<LanguageStandard>stdcpp17</LanguageStandard>
</ClCompile>
<Link>
Expand Down
46 changes: 46 additions & 0 deletions include/App/Logic.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/******************************************************************************
* File: Logic.hpp
* Authors: see AUTHORS file
* Date: May 3, 2024
* Description: This file contains the API requests methods
*****************************************************************************/

#pragma once

#include <iostream>
#include <algorithm>
#include <cpr/cpr.h>
#include "rapidjson/document.h"
#include "rapidjson/error/en.h"

using namespace rapidjson;

namespace Stuckfish
{
// consider creating a C-style structure to hold games data and a vector of this structure in Logic.
struct GamesData
{
std::string pgn;
std::string timeClass;
std::string gameResult;
std::string whiteRating;
std::string blackRating;
std::string whiteUsername;
std::string blackUsername;
};

class Logic
{
public:
Logic() : _gamesData()
{};

bool IsChessDotComUser(const std::string& username);
void GamesPlayedWithinPeriod(const std::string& username, const std::string& year, const std::string& month);
void GetInfosFromListOfGamesPlayed(const std::string& username, const Document& doc);

private:
std::vector<GamesData> _gamesData;
};
}

96 changes: 96 additions & 0 deletions include/App/Stuckfish.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
/******************************************************************************
* File: Stuckfish.hpp
* Authors: see AUTHORS file
* Date: May 3, 2024
* Description: This file contains the Core class and setup methods
*****************************************************************************/

#pragma once

#include <string>
#include <memory>
#include <stdio.h>
#include <iostream>

#include "imgui.h"
#include "imgui_impl_glfw.h"
#include "imgui_impl_opengl3.h"
#include "imgui_stdlib.h"

#include "fonts.hpp"
#include "Page.hpp"

#include <vector>

#if defined(IMGUI_IMPL_OPENGL_ES2)
#include <GLES2/gl2.h>
#endif

#include <GLFW/glfw3.h> // Will drag system OpenGL headers


#ifdef __EMSCRIPTEN__
#include "../emscripten/emscripten_mainloop_stub.h"
#endif

#define GLSL_VERSION "#version 330"


namespace Stuckfish
{
struct WindowSpecs
{
std::string name = "Stuckfish";
uint32_t width = 1500;
uint32_t height = 800;
};

class Core
{
public:
Core(const WindowSpecs& win_specs = WindowSpecs());
~Core();

void Run(void);

static Core& Get(void);

template<typename T, typename... Args>
void PushLayer(Args&&... args) {
static_assert(std::is_base_of<Page, T>::value, "Pushed type is not subclass of Page!");
_pageStack.emplace_back(std::make_shared<T>(std::forward<Args>(args)...));
}

/*template<typename T>
T& GetLayer() {
return dynamic_cast<T&>(*(_pageStack.front()));
}*/

std::vector<std::shared_ptr<Page>>& GetPageStack(void)
{
return _pageStack;
}

void DisplayErrorPopup(const char *error_message);
void RemoveErrorPopup(void);

public:
ImFont* _robotoFontHeader = nullptr;
ImFont* _robotoFontBody = nullptr;
ImFont* _robotoFontBodyMedium = nullptr;

WindowSpecs _specs;
Logic _appLogic;
UserData _userData;
private:
void Init(void);
void Quit(void);

private:
GLFWwindow* _window = nullptr;

std::vector<std::shared_ptr<Page>> _pageStack;
};

std::unique_ptr<Core> CreateApplication(void);
};
32 changes: 32 additions & 0 deletions include/UI/GamesPlayedPage.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/******************************************************************************
* File: GamesPlayedPage.hpp
* Authors: see AUTHORS file
* Date: May 3, 2024
* Description: This file contains the required method to render the 2nd Page
*****************************************************************************/

#pragma once

#include "Stuckfish.hpp"

namespace Stuckfish
{
class GamesPlayedPage : public Page
{
public:
GamesPlayedPage(Core& app, Logic& logic, UserData& userData) : _app(app), _logic(logic), _userdata(userData)
{};

void OnUpdate() override;
void OnUIRender() override;
void OnAttach() override;
void OnDetach() override;

private:
Core& _app;
Logic& _logic;
UserData& _userdata;

bool _hasRetrievedGames = false;
};
}
Loading

0 comments on commit 4af1a7d

Please sign in to comment.