-
-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from klonyyy/devel
Refactor + bugfix
- Loading branch information
Showing
197 changed files
with
27,296 additions
and
362 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/bin/bash | ||
cd .. | ||
git log --pretty=format:'#define GIT_INFO_PRESENT%n static const char* GIT_HASH = "%H";' -n 1 > src/gitversion.hpp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,20 @@ | ||
#!/usr/bin/env bash | ||
./launch/addGitVersion.sh | ||
rm -rf build | ||
mkdir -p build | ||
cd build | ||
mkdir packages | ||
|
||
mkdir -p windows | ||
cd windows | ||
cmake -DPLATFORM=WIN ../.. | ||
cmake -DPLATFORM=WIN -DPRODUCTION=TRUE ../.. | ||
make package -j16 | ||
cp *win64.exe ../packages | ||
cd - | ||
|
||
mkdir -p linux | ||
cd linux | ||
cmake ../.. | ||
cmake -DPRODUCTION=TRUE ../.. | ||
make package -j16 | ||
cp *.deb ../packages | ||
cd - |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#ifndef _FILEHANDLER_HPP | ||
#define _FILEHANDLER_HPP | ||
|
||
#include <string> | ||
#include <utility> | ||
|
||
class IFileHandler | ||
{ | ||
public: | ||
virtual ~IFileHandler() = default; | ||
virtual bool init() = 0; | ||
virtual bool deinit() = 0; | ||
virtual std::string openFile(std::pair<std::string, std::string>&& filterFileNameFileExtension) = 0; | ||
virtual std::string saveFile(std::pair<std::string, std::string>&& filterFileNameFileExtension) = 0; | ||
}; | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#include <NFDFileHandler.hpp> | ||
#include <algorithm> | ||
|
||
#include "nfd.h" | ||
|
||
bool NFDFileHandler::init() | ||
{ | ||
return NFD_Init() != NFD_ERROR; | ||
} | ||
bool NFDFileHandler::deinit() | ||
{ | ||
NFD_Quit(); | ||
return true; | ||
} | ||
std::string NFDFileHandler::openFile(std::pair<std::string, std::string>&& filterFileNameFileExtension) | ||
{ | ||
return handleFile(handleType::OPEN, filterFileNameFileExtension); | ||
} | ||
std::string NFDFileHandler::saveFile(std::pair<std::string, std::string>&& filterFileNameFileExtension) | ||
{ | ||
return handleFile(handleType::SAVE, filterFileNameFileExtension); | ||
} | ||
|
||
std::string NFDFileHandler::handleFile(handleType type, std::pair<std::string, std::string>& filterFileNameFileExtension) | ||
{ | ||
nfdchar_t* outPath = nullptr; | ||
nfdfilteritem_t filterItem[1] = {{filterFileNameFileExtension.first.c_str(), filterFileNameFileExtension.second.c_str()}}; | ||
|
||
nfdresult_t result = NFD_ERROR; | ||
|
||
if (type == handleType::SAVE) | ||
result = NFD_SaveDialog(&outPath, filterItem, 1, NULL, NULL); | ||
else if (type == handleType::OPEN) | ||
result = NFD_OpenDialog(&outPath, filterItem, 1, NULL); | ||
|
||
if (result == NFD_OKAY) | ||
{ | ||
std::string path = std::string(outPath); | ||
std::replace(path.begin(), path.end(), '\\', '/'); | ||
NFD_FreePath(outPath); | ||
return path; | ||
} | ||
return std::string(""); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#ifndef _NFDFILEHANDLER_HPP | ||
#define _NFDFILEHANDLER_HPP | ||
|
||
#include <IFileHandler.hpp> | ||
|
||
class NFDFileHandler : public IFileHandler | ||
{ | ||
public: | ||
bool | ||
init() override; | ||
bool deinit() override; | ||
std::string openFile(std::pair<std::string, std::string>&& filterFileNameFileExtension) override; | ||
std::string saveFile(std::pair<std::string, std::string>&& filterFileNameFileExtension) override; | ||
|
||
private: | ||
enum class handleType | ||
{ | ||
SAVE, | ||
OPEN | ||
}; | ||
std::string handleFile(handleType type, std::pair<std::string, std::string>& filterFileNameFileExtension); | ||
}; | ||
|
||
#endif |
Oops, something went wrong.