Added shared library support.
This commit is contained in:
@@ -4,7 +4,7 @@ namespace ehs
|
||||
{
|
||||
const char Base64::ascii[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
||||
|
||||
Str_8 Base64::Encode(const Str_8 input)
|
||||
Str_8 Base64::Encode(const Str_8 &input)
|
||||
{
|
||||
UInt_64 input_length = input.Size();
|
||||
|
||||
@@ -42,7 +42,7 @@ namespace ehs
|
||||
return result;
|
||||
}
|
||||
|
||||
Str_8 Base64::Decode(const Str_8 input)
|
||||
Str_8 Base64::Decode(const Str_8 &input)
|
||||
{
|
||||
UInt_64 in_len = input.Size();
|
||||
int i = 0;
|
||||
|
115
src/EHS.cpp
115
src/EHS.cpp
@@ -31,6 +31,64 @@ namespace ehs
|
||||
Str_8 appVerId;
|
||||
Version appVer;
|
||||
|
||||
void Initialize(Str_8 appName, Str_8 appVerId, const Version &appVer)
|
||||
{
|
||||
ehs::appName = (Str_8 &&)appName;
|
||||
ehs::appVerId = (Str_8 &&)appVerId;
|
||||
ehs::appVer = appVer;
|
||||
|
||||
ehs::Console::Attach();
|
||||
|
||||
ehs::Audio::AddCodec({
|
||||
"Waveform Audio",
|
||||
"wav",
|
||||
ehs::Endianness::LE,
|
||||
nullptr,
|
||||
ehs::DecodeWAV
|
||||
});
|
||||
|
||||
ehs::Audio::AddCodec({
|
||||
"Event Horizon Audio",
|
||||
"eha",
|
||||
ehs::Endianness::LE,
|
||||
ehs::EncodeEHA,
|
||||
ehs::DecodeEHA
|
||||
});
|
||||
|
||||
ehs::Img::AddCodec({
|
||||
"Portable Network Graphic",
|
||||
"png",
|
||||
ehs::Endianness::BE,
|
||||
nullptr,
|
||||
ehs::DecodePNG
|
||||
});
|
||||
|
||||
ehs::Img::AddCodec({
|
||||
"Quite OK Image",
|
||||
"qoi",
|
||||
ehs::Endianness::BE,
|
||||
ehs::EncodeQOI,
|
||||
ehs::DecodeQOI
|
||||
});
|
||||
|
||||
ehs::Mdl::AddCodec({
|
||||
"Event Horizon Model",
|
||||
"ehm",
|
||||
ehs::Endianness::LE,
|
||||
ehs::EncodeEHM,
|
||||
ehs::DecodeEHM
|
||||
});
|
||||
|
||||
ehs::GC::Start();
|
||||
}
|
||||
|
||||
void Uninitialize()
|
||||
{
|
||||
ehs::GC::Stop();
|
||||
|
||||
ehs::Log::OnExit();
|
||||
}
|
||||
|
||||
const Char_32* GetName_32()
|
||||
{
|
||||
return name_32;
|
||||
@@ -95,61 +153,4 @@ namespace ehs
|
||||
{
|
||||
return appVer;
|
||||
}
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
ehs::Console::Attach();
|
||||
|
||||
ehs::Audio::AddCodec({
|
||||
"Waveform Audio",
|
||||
"wav",
|
||||
ehs::Endianness::LE,
|
||||
nullptr,
|
||||
ehs::DecodeWAV
|
||||
});
|
||||
|
||||
ehs::Audio::AddCodec({
|
||||
"Event Horizon Audio",
|
||||
"eha",
|
||||
ehs::Endianness::LE,
|
||||
ehs::EncodeEHA,
|
||||
ehs::DecodeEHA
|
||||
});
|
||||
|
||||
ehs::Img::AddCodec({
|
||||
"Portable Network Graphic",
|
||||
"png",
|
||||
ehs::Endianness::BE,
|
||||
nullptr,
|
||||
ehs::DecodePNG
|
||||
});
|
||||
|
||||
ehs::Img::AddCodec({
|
||||
"Quite OK Image",
|
||||
"qoi",
|
||||
ehs::Endianness::BE,
|
||||
ehs::EncodeQOI,
|
||||
ehs::DecodeQOI
|
||||
});
|
||||
|
||||
ehs::Mdl::AddCodec({
|
||||
"Event Horizon Model",
|
||||
"ehm",
|
||||
ehs::Endianness::LE,
|
||||
ehs::EncodeEHM,
|
||||
ehs::DecodeEHM
|
||||
});
|
||||
|
||||
ehs::GC::Start();
|
||||
|
||||
const ehs::SInt_32 code = Main(&ehs::appName, &ehs::appVerId, &ehs::appVer);
|
||||
if (code)
|
||||
EHS_LOG_INT(ehs::LogType::WARN, 0, "Executable exited with code #" + ehs::Str_8::FromNum(code) + ".");
|
||||
|
||||
ehs::GC::Stop();
|
||||
|
||||
ehs::Log::OnExit();
|
||||
|
||||
return code;
|
||||
}
|
@@ -2,11 +2,9 @@
|
||||
#include <ehs/Str.h>
|
||||
#include <ehs/io/Console.h>
|
||||
|
||||
ehs::Int_32 Main(ehs::Str_8* appName, ehs::Str_8* appVerId, ehs::Version* appVer)
|
||||
int main()
|
||||
{
|
||||
*appName = "StrToHash";
|
||||
*appVerId = "Release";
|
||||
*appVer = {1, 0, 0};
|
||||
ehs::Initialize("StrToHash", "Release", {1, 0, 0});
|
||||
|
||||
ehs::Vector<ehs::Str_8> args = ehs::Console::GetArgs_8();
|
||||
|
||||
@@ -26,5 +24,7 @@ ehs::Int_32 Main(ehs::Str_8* appName, ehs::Str_8* appVerId, ehs::Version* appVer
|
||||
|
||||
ehs::Console::Free();
|
||||
|
||||
ehs::Uninitialize();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@@ -1,6 +1,6 @@
|
||||
#include "ehs/db/Database.h"
|
||||
|
||||
#include "ehs/io/Directory_LNX.h"
|
||||
#include "ehs/io/Directory.h"
|
||||
#include "ehs/io/File.h"
|
||||
|
||||
namespace ehs
|
||||
|
@@ -2,7 +2,7 @@
|
||||
#include "ehs/db/DbTable.h"
|
||||
#include "ehs/Serializer.h"
|
||||
#include "ehs/db/Database.h"
|
||||
#include "ehs/io/Directory_LNX.h"
|
||||
#include "ehs/io/Directory.h"
|
||||
#include "ehs/io/File.h"
|
||||
|
||||
namespace ehs
|
||||
|
@@ -1,7 +1,7 @@
|
||||
#include "ehs/db/DbTable.h"
|
||||
#include "ehs/db/Database.h"
|
||||
#include "ehs/io/Directory.h"
|
||||
#include "ehs/io/File_UNX.h"
|
||||
#include "ehs/io/File.h"
|
||||
|
||||
namespace ehs
|
||||
{
|
||||
|
@@ -4,7 +4,7 @@
|
||||
|
||||
namespace ehs
|
||||
{
|
||||
Array<Str_8> GetAllFiles(const Str_8 &dir)
|
||||
Array<Str_8> Directory::GetAllFiles(const Str_8 &dir)
|
||||
{
|
||||
Array<Str_8> result;
|
||||
|
||||
@@ -44,7 +44,7 @@ namespace ehs
|
||||
return result;
|
||||
}
|
||||
|
||||
void CreateRecursive(Str_8 dir)
|
||||
void Directory::CreateRecursive(Str_8 dir)
|
||||
{
|
||||
dir = dir.ReplaceAll("\\", "/");
|
||||
|
||||
@@ -71,7 +71,7 @@ namespace ehs
|
||||
EHS_LOG_SUCCESS();
|
||||
}
|
||||
|
||||
void Create(const Str_8 &dir)
|
||||
void Directory::Create(const Str_8 &dir)
|
||||
{
|
||||
if (!CreateDirectoryW(UTF::To_16(dir), nullptr))
|
||||
{
|
||||
|
@@ -611,7 +611,11 @@ namespace ehs
|
||||
return {(Int_32)tmp.left, (Int_32)tmp.top};
|
||||
}
|
||||
|
||||
void Window::SetClientSize(const Vec2<UInt_32>& size)
|
||||
void Window::OnResized(const Vec2<UInt_32>& newSize)
|
||||
{
|
||||
}
|
||||
|
||||
void Window::SetScale(const Vec2_u32& newScale)
|
||||
{
|
||||
if (!created)
|
||||
return;
|
||||
@@ -619,8 +623,8 @@ namespace ehs
|
||||
RECT rect = {
|
||||
0,
|
||||
0,
|
||||
static_cast<LONG>(size[0]),
|
||||
static_cast<LONG>(size[1])
|
||||
static_cast<LONG>(newScale[0]),
|
||||
static_cast<LONG>(newScale[1])
|
||||
};
|
||||
|
||||
DWORD exStyle = (DWORD)GetWindowLongPtr(hdl, GWL_EXSTYLE);
|
||||
@@ -631,35 +635,13 @@ namespace ehs
|
||||
SetWindowPos(hdl, nullptr, 0, 0, rect.right - rect.left, rect.bottom - rect.top, SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE);
|
||||
}
|
||||
|
||||
Vec2<UInt_32> Window::GetClientSize()
|
||||
{
|
||||
RECT rect = {};
|
||||
|
||||
if (!GetClientRect(hdl, &rect))
|
||||
EHS_LOG_INT(LogType::ERR, 0, "Failed to retrieve client size with error #" + Str_8::FromNum(GetLastError()) + ".");
|
||||
|
||||
return {(UInt_32)rect.right, (UInt_32)rect.bottom};
|
||||
}
|
||||
|
||||
void Window::OnResized(const Vec2<UInt_32>& newSize)
|
||||
{
|
||||
}
|
||||
|
||||
void Window::SetScale(const Vec2_u32& newScale)
|
||||
{
|
||||
if (!created)
|
||||
return;
|
||||
|
||||
SetWindowPos(hdl, nullptr, 0, 0, (int)newScale.x, (int)newScale.y, SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE);
|
||||
}
|
||||
|
||||
Vec2_u32 Window::GetScale() const
|
||||
{
|
||||
if (!created)
|
||||
return {};
|
||||
|
||||
RECT tmp = {};
|
||||
GetWindowRect(hdl, &tmp);
|
||||
GetClientRect(hdl, &tmp);
|
||||
|
||||
return {(UInt_32)(tmp.right - tmp.left), (UInt_32)(tmp.bottom - tmp.top)};
|
||||
}
|
||||
|
Reference in New Issue
Block a user