mirror of
https://github.com/AxioDL/metaforce.git
synced 2025-12-08 17:04:55 +00:00
Humungous refactor
This commit is contained in:
@@ -57,9 +57,9 @@ target_link_libraries(urde
|
||||
RuntimeCommonGraphics
|
||||
RuntimeCommon
|
||||
DNAMP3 DNAMP2 DNAMP1
|
||||
DNACommon Specter SpecterFonts freetype ${DATA_SPEC_LIBS}
|
||||
HECLDatabase HECLBackend HECLFrontend HECLBlender HECLRuntime HECLCommon AthenaCore NOD
|
||||
LogVisor AthenaLibYaml Boo ${PNG_LIB} squish xxhash Math
|
||||
DNACommon specter specter-fonts freetype ${DATA_SPEC_LIBS}
|
||||
hecl-database hecl-backend hecl-frontend hecl-blender hecl-runtime hecl-common athena-core nod
|
||||
logvisor AthenaLibYaml boo ${PNG_LIB} squish xxhash zeus
|
||||
${ZLIB_LIBRARIES} ${LZO_LIB}
|
||||
${BOO_SYS_LIBS})
|
||||
|
||||
|
||||
@@ -1,26 +1,26 @@
|
||||
#ifndef URDE_CAMERA_HPP
|
||||
#define URDE_CAMERA_HPP
|
||||
#include <CProjection.hpp>
|
||||
#include <CFrustum.hpp>
|
||||
#include <CQuaternion.hpp>
|
||||
#include <CVector3f.hpp>
|
||||
#include <Math.hpp>
|
||||
#include "zeus/CProjection.hpp"
|
||||
#include "zeus/CFrustum.hpp"
|
||||
#include "zeus/CQuaternion.hpp"
|
||||
#include "zeus/CVector3f.hpp"
|
||||
#include "zeus/Math.hpp"
|
||||
|
||||
namespace URDE
|
||||
{
|
||||
class Camera
|
||||
{
|
||||
Zeus::CFrustum m_frustum;
|
||||
Zeus::CProjection m_projection;
|
||||
Zeus::CVector3f m_position;
|
||||
Zeus::CQuaternion m_orientation;
|
||||
zeus::CFrustum m_frustum;
|
||||
zeus::CProjection m_projection;
|
||||
zeus::CVector3f m_position;
|
||||
zeus::CQuaternion m_orientation;
|
||||
public:
|
||||
|
||||
void setPosition(const Zeus::CVector3f& position) { m_position = position; }
|
||||
void setOrientation(const Zeus::CQuaternion& orientation) { m_orientation = orientation; }
|
||||
void setPosition(const zeus::CVector3f& position) { m_position = position; }
|
||||
void setOrientation(const zeus::CQuaternion& orientation) { m_orientation = orientation; }
|
||||
|
||||
const Zeus::CMatrix4f& projectionMatrix() const { return m_projection.getCachedMatrix(); }
|
||||
const Zeus::CProjection& projection() const { return m_projection; }
|
||||
const zeus::CMatrix4f& projectionMatrix() const { return m_projection.getCachedMatrix(); }
|
||||
const zeus::CProjection& projection() const { return m_projection; }
|
||||
|
||||
virtual void think()
|
||||
{}
|
||||
|
||||
@@ -16,13 +16,13 @@ class InformationCenter : public ViewerSpace
|
||||
|
||||
const Space::State& spaceState() const { return m_state; }
|
||||
|
||||
struct View : Specter::View
|
||||
struct View : specter::View
|
||||
{
|
||||
InformationCenter& m_ic;
|
||||
std::vector<HECL::SystemString> m_log;
|
||||
std::vector<hecl::SystemString> m_log;
|
||||
|
||||
View(InformationCenter& ic, Specter::ViewResources& res)
|
||||
: Specter::View(res, ic.m_vm.rootView()), m_ic(ic)
|
||||
View(InformationCenter& ic, specter::ViewResources& res)
|
||||
: specter::View(res, ic.m_vm.rootView()), m_ic(ic)
|
||||
{
|
||||
commitResources(res);
|
||||
}
|
||||
@@ -55,7 +55,7 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
virtual Specter::View* buildContentView(Specter::ViewResources& res)
|
||||
virtual specter::View* buildContentView(specter::ViewResources& res)
|
||||
{
|
||||
m_view.reset(new View(*this, res));
|
||||
return m_view.get();
|
||||
|
||||
@@ -5,7 +5,7 @@ namespace URDE
|
||||
|
||||
void ModelViewer::View::resized(const boo::SWindowRect& root, const boo::SWindowRect& sub)
|
||||
{
|
||||
Specter::View::resized(root, sub);
|
||||
specter::View::resized(root, sub);
|
||||
m_scissorRect = sub;
|
||||
}
|
||||
|
||||
@@ -13,10 +13,10 @@ void ModelViewer::View::draw(boo::IGraphicsCommandQueue* gfxQ)
|
||||
{
|
||||
gfxQ->setScissor(m_scissorRect);
|
||||
m_mv.m_lineRenderer->Reset();
|
||||
m_mv.m_lineRenderer->AddVertex({-0.5f, 0.f, -0.5f}, Zeus::CColor::skBlue, 1.f);
|
||||
m_mv.m_lineRenderer->AddVertex({-0.5f, 0.f, 0.5f}, Zeus::CColor::skBlue, 1.f);
|
||||
m_mv.m_lineRenderer->AddVertex({0.5f, 10.f, 0.5f}, Zeus::CColor::skRed, 3.f);
|
||||
m_mv.m_lineRenderer->AddVertex({0.5f, 0.f, -0.5f}, Zeus::CColor::skBlue, 1.f);
|
||||
m_mv.m_lineRenderer->AddVertex({-0.5f, 0.f, -0.5f}, zeus::CColor::skBlue, 1.f);
|
||||
m_mv.m_lineRenderer->AddVertex({-0.5f, 0.f, 0.5f}, zeus::CColor::skBlue, 1.f);
|
||||
m_mv.m_lineRenderer->AddVertex({0.5f, 10.f, 0.5f}, zeus::CColor::skRed, 3.f);
|
||||
m_mv.m_lineRenderer->AddVertex({0.5f, 0.f, -0.5f}, zeus::CColor::skBlue, 1.f);
|
||||
m_mv.m_lineRenderer->Render();
|
||||
gfxQ->setScissor({});
|
||||
}
|
||||
|
||||
@@ -20,20 +20,20 @@ class ModelViewer : public ViewerSpace
|
||||
};
|
||||
|
||||
Value<Mode> renderMode = Mode::Material;
|
||||
Value<Zeus::CVector3f> cameraPosition;
|
||||
Value<Zeus::CQuaternion> cameraOrientation;
|
||||
Value<zeus::CVector3f> cameraPosition;
|
||||
Value<zeus::CQuaternion> cameraOrientation;
|
||||
|
||||
} m_state;
|
||||
|
||||
const Space::State& spaceState() const { return m_state; }
|
||||
std::unique_ptr<pshag::CLineRenderer> m_lineRenderer;
|
||||
struct View : Specter::View
|
||||
std::unique_ptr<urde::CLineRenderer> m_lineRenderer;
|
||||
struct View : specter::View
|
||||
{
|
||||
ModelViewer& m_mv;
|
||||
boo::SWindowRect m_scissorRect;
|
||||
|
||||
View(ModelViewer& mv, Specter::ViewResources& res)
|
||||
: Specter::View(res, mv.m_vm.rootView()), m_mv(mv)
|
||||
View(ModelViewer& mv, specter::ViewResources& res)
|
||||
: specter::View(res, mv.m_vm.rootView()), m_mv(mv)
|
||||
{
|
||||
commitResources(res);
|
||||
}
|
||||
@@ -50,7 +50,7 @@ public:
|
||||
: ViewerSpace(vm, Class::ModelViewer, parent)
|
||||
{
|
||||
reloadState();
|
||||
m_lineRenderer.reset(new pshag::CLineRenderer(pshag::CLineRenderer::EPrimitiveMode::LineStrip, 4, nullptr, true));
|
||||
m_lineRenderer.reset(new urde::CLineRenderer(urde::CLineRenderer::EPrimitiveMode::LineStrip, 4, nullptr, true));
|
||||
}
|
||||
|
||||
ModelViewer(ViewManager& vm, Space* parent, const ModelViewer& other)
|
||||
@@ -78,7 +78,7 @@ public:
|
||||
return new ModelViewer(m_vm, parent, *this);
|
||||
}
|
||||
|
||||
virtual Specter::View* buildContentView(Specter::ViewResources& res)
|
||||
virtual specter::View* buildContentView(specter::ViewResources& res)
|
||||
{
|
||||
m_view.reset(new View(*this, res));
|
||||
return m_view.get();
|
||||
|
||||
@@ -15,13 +15,13 @@ class EffectEditor : public EditorSpace
|
||||
} m_state;
|
||||
const Space::State& spaceState() const {return m_state;}
|
||||
|
||||
struct View : Specter::View
|
||||
struct View : specter::View
|
||||
{
|
||||
View(Specter::ViewResources& res, Specter::View& parent)
|
||||
: Specter::View(res, parent) {}
|
||||
View(specter::ViewResources& res, specter::View& parent)
|
||||
: specter::View(res, parent) {}
|
||||
};
|
||||
|
||||
Specter::View* buildContentView(Specter::ViewResources& res)
|
||||
specter::View* buildContentView(specter::ViewResources& res)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -4,12 +4,12 @@
|
||||
|
||||
namespace URDE
|
||||
{
|
||||
static LogVisor::LogModule Log("URDE::ProjectManager");
|
||||
static logvisor::Module Log("URDE::ProjectManager");
|
||||
|
||||
void ProjectManager::IndexMP1Resources()
|
||||
{
|
||||
const std::vector<HECL::Database::Project::ProjectDataSpec>& specs = m_proj->getDataSpecs();
|
||||
for (const HECL::Database::Project::ProjectDataSpec& spec : m_proj->getDataSpecs())
|
||||
const std::vector<hecl::Database::Project::ProjectDataSpec>& specs = m_proj->getDataSpecs();
|
||||
for (const hecl::Database::Project::ProjectDataSpec& spec : m_proj->getDataSpecs())
|
||||
{
|
||||
if (&spec.spec == &DataSpec::SpecEntMP1)
|
||||
{
|
||||
@@ -30,17 +30,17 @@ ProjectManager::ProjectManager(ViewManager &vm)
|
||||
}
|
||||
}
|
||||
|
||||
bool ProjectManager::newProject(const HECL::SystemString& path)
|
||||
bool ProjectManager::newProject(const hecl::SystemString& path)
|
||||
{
|
||||
HECL::ProjectRootPath projPath = HECL::SearchForProject(path);
|
||||
hecl::ProjectRootPath projPath = hecl::SearchForProject(path);
|
||||
if (projPath)
|
||||
{
|
||||
Log.report(LogVisor::Warning, _S("project already exists at '%s'"), path.c_str());
|
||||
Log.report(logvisor::Warning, _S("project already exists at '%s'"), path.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
HECL::MakeDir(path.c_str());
|
||||
m_proj.reset(new HECL::Database::Project(path));
|
||||
hecl::MakeDir(path.c_str());
|
||||
m_proj.reset(new hecl::Database::Project(path));
|
||||
if (!*m_proj)
|
||||
{
|
||||
m_proj.reset();
|
||||
@@ -56,16 +56,16 @@ bool ProjectManager::newProject(const HECL::SystemString& path)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ProjectManager::openProject(const HECL::SystemString& path)
|
||||
bool ProjectManager::openProject(const hecl::SystemString& path)
|
||||
{
|
||||
HECL::ProjectRootPath projPath = HECL::SearchForProject(path);
|
||||
hecl::ProjectRootPath projPath = hecl::SearchForProject(path);
|
||||
if (!projPath)
|
||||
{
|
||||
Log.report(LogVisor::Warning, _S("project doesn't exist at '%s'"), path.c_str());
|
||||
Log.report(logvisor::Warning, _S("project doesn't exist at '%s'"), path.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
m_proj.reset(new HECL::Database::Project(projPath));
|
||||
m_proj.reset(new hecl::Database::Project(projPath));
|
||||
if (!*m_proj)
|
||||
{
|
||||
m_proj.reset();
|
||||
@@ -73,23 +73,23 @@ bool ProjectManager::openProject(const HECL::SystemString& path)
|
||||
}
|
||||
|
||||
#ifdef URDE_BINARY_CONFIGS
|
||||
HECL::ProjectPath urdeSpacesPath(*m_proj, _S(".hecl/urde_spaces.bin"));
|
||||
Athena::io::FileReader r(urdeSpacesPath.getAbsolutePath(), 32 * 1024, false);
|
||||
hecl::ProjectPath urdeSpacesPath(*m_proj, _S(".hecl/urde_spaces.bin"));
|
||||
athena::io::FileReader r(urdeSpacesPath.getAbsolutePath(), 32 * 1024, false);
|
||||
if (r.hasError())
|
||||
goto makeDefault;
|
||||
|
||||
m_vm.SetupEditorView(r);
|
||||
|
||||
#else
|
||||
HECL::ProjectPath urdeSpacesPath(*m_proj, _S(".hecl/urde_spaces.yaml"));
|
||||
FILE* fp = HECL::Fopen(urdeSpacesPath.getAbsolutePath().c_str(), _S("r"));
|
||||
hecl::ProjectPath urdeSpacesPath(*m_proj, _S(".hecl/urde_spaces.yaml"));
|
||||
FILE* fp = hecl::Fopen(urdeSpacesPath.getAbsolutePath().c_str(), _S("r"));
|
||||
|
||||
Athena::io::YAMLDocReader r;
|
||||
athena::io::YAMLDocReader r;
|
||||
if (!fp)
|
||||
goto makeDefault;
|
||||
|
||||
yaml_parser_set_input_file(r.getParser(), fp);
|
||||
if (!r.ValidateClassType(r.getParser(), "UrdeSpacesState"))
|
||||
if (!r.ValidateClassType("UrdeSpacesState"))
|
||||
{
|
||||
fclose(fp);
|
||||
goto makeDefault;
|
||||
@@ -129,7 +129,7 @@ makeDefault:
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ProjectManager::extractGame(const HECL::SystemString& path)
|
||||
bool ProjectManager::extractGame(const hecl::SystemString& path)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -140,46 +140,38 @@ bool ProjectManager::saveProject()
|
||||
return false;
|
||||
|
||||
#ifdef URDE_BINARY_CONFIGS
|
||||
HECL::ProjectPath oldSpacesPath(*m_proj, _S(".hecl/~urde_spaces.bin"));
|
||||
Athena::io::FileWriter w(oldSpacesPath.getAbsolutePath(), true, false);
|
||||
hecl::ProjectPath oldSpacesPath(*m_proj, _S(".hecl/~urde_spaces.bin"));
|
||||
athena::io::FileWriter w(oldSpacesPath.getAbsolutePath(), true, false);
|
||||
if (w.hasError())
|
||||
return false;
|
||||
|
||||
m_vm.SaveEditorView(w);
|
||||
w.close();
|
||||
|
||||
HECL::ProjectPath newSpacesPath(*m_proj, _S(".hecl/urde_spaces.bin"));
|
||||
hecl::ProjectPath newSpacesPath(*m_proj, _S(".hecl/urde_spaces.bin"));
|
||||
|
||||
#else
|
||||
HECL::ProjectPath oldSpacesPath(*m_proj, _S(".hecl/~urde_spaces.yaml"));
|
||||
FILE* fp = HECL::Fopen(oldSpacesPath.getAbsolutePath().c_str(), _S("w"));
|
||||
hecl::ProjectPath oldSpacesPath(*m_proj, _S(".hecl/~urde_spaces.yaml"));
|
||||
FILE* fp = hecl::Fopen(oldSpacesPath.getAbsolutePath().c_str(), _S("w"));
|
||||
if (!fp)
|
||||
return false;
|
||||
|
||||
Athena::io::YAMLDocWriter w("UrdeSpacesState");
|
||||
athena::io::YAMLDocWriter w("UrdeSpacesState");
|
||||
yaml_emitter_set_output_file(w.getEmitter(), fp);
|
||||
if (!w.open())
|
||||
{
|
||||
fclose(fp);
|
||||
return false;
|
||||
}
|
||||
|
||||
m_vm.SaveEditorView(w);
|
||||
if (!w.finish())
|
||||
{
|
||||
fclose(fp);
|
||||
return false;
|
||||
}
|
||||
|
||||
w.close();
|
||||
fclose(fp);
|
||||
|
||||
HECL::ProjectPath newSpacesPath(*m_proj, _S(".hecl/urde_spaces.yaml"));
|
||||
hecl::ProjectPath newSpacesPath(*m_proj, _S(".hecl/urde_spaces.yaml"));
|
||||
|
||||
#endif
|
||||
|
||||
HECL::Unlink(newSpacesPath.getAbsolutePath().c_str());
|
||||
HECL::Rename(oldSpacesPath.getAbsolutePath().c_str(),
|
||||
hecl::Unlink(newSpacesPath.getAbsolutePath().c_str());
|
||||
hecl::Rename(oldSpacesPath.getAbsolutePath().c_str(),
|
||||
newSpacesPath.getAbsolutePath().c_str());
|
||||
|
||||
m_vm.pushRecentProject(m_proj->getProjectRootPath().getAbsolutePath());
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
#ifndef URDE_PROJECT_MANAGER_HPP
|
||||
#define URDE_PROJECT_MANAGER_HPP
|
||||
|
||||
#include <HECL/Database.hpp>
|
||||
#include <Athena/DNAYaml.hpp>
|
||||
#include <hecl/Database.hpp>
|
||||
#include <athena/DNAYaml.hpp>
|
||||
#include "ProjectResourceFactory.hpp"
|
||||
#include "Runtime/CSimplePool.hpp"
|
||||
|
||||
@@ -11,20 +11,20 @@ namespace URDE
|
||||
class ViewManager;
|
||||
|
||||
#ifdef URDE_BINARY_CONFIGS
|
||||
using ConfigReader = Athena::io::IStreamReader;
|
||||
using ConfigWriter = Athena::io::IStreamWriter;
|
||||
using ConfigReader = athena::io::IStreamReader;
|
||||
using ConfigWriter = athena::io::IStreamWriter;
|
||||
#else
|
||||
using ConfigReader = Athena::io::YAMLDocReader;
|
||||
using ConfigWriter = Athena::io::YAMLDocWriter;
|
||||
using ConfigReader = athena::io::YAMLDocReader;
|
||||
using ConfigWriter = athena::io::YAMLDocWriter;
|
||||
#endif
|
||||
|
||||
class ProjectManager
|
||||
{
|
||||
ViewManager& m_vm;
|
||||
std::unique_ptr<HECL::Database::Project> m_proj;
|
||||
std::unique_ptr<hecl::Database::Project> m_proj;
|
||||
static bool m_registeredSpecs;
|
||||
ProjectResourceFactory m_factory;
|
||||
pshag::CSimplePool m_objStore;
|
||||
urde::CSimplePool m_objStore;
|
||||
|
||||
void IndexMP1Resources();
|
||||
|
||||
@@ -32,11 +32,11 @@ public:
|
||||
ProjectManager(ViewManager& vm);
|
||||
operator bool() const {return m_proj.operator bool();}
|
||||
|
||||
HECL::Database::Project* project() {return m_proj.get();}
|
||||
hecl::Database::Project* project() {return m_proj.get();}
|
||||
|
||||
bool newProject(const HECL::SystemString& path);
|
||||
bool openProject(const HECL::SystemString& path);
|
||||
bool extractGame(const HECL::SystemString& path);
|
||||
bool newProject(const hecl::SystemString& path);
|
||||
bool openProject(const hecl::SystemString& path);
|
||||
bool extractGame(const hecl::SystemString& path);
|
||||
|
||||
bool saveProject();
|
||||
|
||||
|
||||
@@ -5,25 +5,25 @@
|
||||
#include "Runtime/Particle/CGenDescription.hpp"
|
||||
#include "Runtime/Particle/CElectricDescription.hpp"
|
||||
#include "Runtime/Particle/CSwooshDescription.hpp"
|
||||
#include "Runtime/CModel.hpp"
|
||||
#include "Runtime/CTexture.hpp"
|
||||
#include "Runtime/Graphics/CModel.hpp"
|
||||
#include "Runtime/Graphics/CTexture.hpp"
|
||||
|
||||
namespace URDE
|
||||
{
|
||||
|
||||
ProjectResourceFactory::ProjectResourceFactory()
|
||||
{
|
||||
m_factoryMgr.AddFactory(HECL::FOURCC('TXTR'), pshag::FTextureFactory);
|
||||
m_factoryMgr.AddFactory(HECL::FOURCC('PART'), pshag::FParticleFactory);
|
||||
m_factoryMgr.AddFactory(hecl::FOURCC('TXTR'), urde::FTextureFactory);
|
||||
m_factoryMgr.AddFactory(hecl::FOURCC('PART'), urde::FParticleFactory);
|
||||
}
|
||||
|
||||
void ProjectResourceFactory::BuildObjectMap(const HECL::Database::Project::ProjectDataSpec &spec)
|
||||
void ProjectResourceFactory::BuildObjectMap(const hecl::Database::Project::ProjectDataSpec &spec)
|
||||
{
|
||||
m_resPaths.clear();
|
||||
m_namedResources.clear();
|
||||
HECL::SystemString catalogPath = HECL::ProjectPath(spec.cookedPath, HECL::SystemString(spec.spec.m_name) + _S("/catalog.yaml")).getAbsolutePath();
|
||||
FILE* catalogFile = HECL::Fopen(catalogPath.c_str(), _S("r"));
|
||||
if (!HECL::StrCmp(spec.spec.m_name, _S("MP3")))
|
||||
hecl::SystemString catalogPath = hecl::ProjectPath(spec.cookedPath, hecl::SystemString(spec.spec.m_name) + _S("/catalog.yaml")).getAbsolutePath();
|
||||
FILE* catalogFile = hecl::Fopen(catalogPath.c_str(), _S("r"));
|
||||
if (!hecl::StrCmp(spec.spec.m_name, _S("MP3")))
|
||||
{
|
||||
DataSpec::NamedResourceCatalog<DataSpec::UniqueID64> catalog;
|
||||
if (catalogFile)
|
||||
@@ -39,51 +39,51 @@ void ProjectResourceFactory::BuildObjectMap(const HECL::Database::Project::Proje
|
||||
}
|
||||
}
|
||||
|
||||
std::unique_ptr<pshag::IObj> ProjectResourceFactory::Build(const pshag::SObjectTag& tag,
|
||||
const pshag::CVParamTransfer& paramXfer)
|
||||
std::unique_ptr<urde::IObj> ProjectResourceFactory::Build(const urde::SObjectTag& tag,
|
||||
const urde::CVParamTransfer& paramXfer)
|
||||
{
|
||||
auto search = m_resPaths.find(tag);
|
||||
if (search == m_resPaths.end())
|
||||
return {};
|
||||
|
||||
fprintf(stderr, "Loading resource %s\n", search->second.getRelativePath().c_str());
|
||||
Athena::io::FileReader fr(search->second.getAbsolutePath(), 32 * 1024, false);
|
||||
athena::io::FileReader fr(search->second.getAbsolutePath(), 32 * 1024, false);
|
||||
if (fr.hasError())
|
||||
return {};
|
||||
|
||||
return m_factoryMgr.MakeObject(tag, fr, paramXfer);
|
||||
}
|
||||
|
||||
void ProjectResourceFactory::BuildAsync(const pshag::SObjectTag& tag,
|
||||
const pshag::CVParamTransfer& paramXfer,
|
||||
pshag::IObj** objOut)
|
||||
void ProjectResourceFactory::BuildAsync(const urde::SObjectTag& tag,
|
||||
const urde::CVParamTransfer& paramXfer,
|
||||
urde::IObj** objOut)
|
||||
{
|
||||
std::unique_ptr<pshag::IObj> obj = Build(tag, paramXfer);
|
||||
std::unique_ptr<urde::IObj> obj = Build(tag, paramXfer);
|
||||
*objOut = obj.release();
|
||||
}
|
||||
|
||||
void ProjectResourceFactory::CancelBuild(const pshag::SObjectTag&)
|
||||
void ProjectResourceFactory::CancelBuild(const urde::SObjectTag&)
|
||||
{
|
||||
}
|
||||
|
||||
bool ProjectResourceFactory::CanBuild(const pshag::SObjectTag& tag)
|
||||
bool ProjectResourceFactory::CanBuild(const urde::SObjectTag& tag)
|
||||
{
|
||||
auto search = m_resPaths.find(tag);
|
||||
if (search == m_resPaths.end())
|
||||
return false;
|
||||
|
||||
Athena::io::FileReader fr(search->second.getAbsolutePath(), 32 * 1024, false);
|
||||
athena::io::FileReader fr(search->second.getAbsolutePath(), 32 * 1024, false);
|
||||
if (fr.hasError())
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
const pshag::SObjectTag* ProjectResourceFactory::GetResourceIdByName(const char* name) const
|
||||
const urde::SObjectTag* ProjectResourceFactory::GetResourceIdByName(const char* name) const
|
||||
{
|
||||
if (m_namedResources.find(name) == m_namedResources.end())
|
||||
return nullptr;
|
||||
const pshag::SObjectTag& tag = m_namedResources.at(name);
|
||||
const urde::SObjectTag& tag = m_namedResources.at(name);
|
||||
return &tag;
|
||||
}
|
||||
|
||||
|
||||
@@ -8,23 +8,23 @@
|
||||
namespace URDE
|
||||
{
|
||||
|
||||
class ProjectResourceFactory : public pshag::IFactory
|
||||
class ProjectResourceFactory : public urde::IFactory
|
||||
{
|
||||
std::unordered_map<pshag::SObjectTag, HECL::ProjectPath> m_resPaths;
|
||||
std::unordered_map<std::string, pshag::SObjectTag> m_namedResources;
|
||||
pshag::CFactoryMgr m_factoryMgr;
|
||||
std::unordered_map<urde::SObjectTag, hecl::ProjectPath> m_resPaths;
|
||||
std::unordered_map<std::string, urde::SObjectTag> m_namedResources;
|
||||
urde::CFactoryMgr m_factoryMgr;
|
||||
template <class IDType>
|
||||
void RecursiveAddDirObjects(const HECL::ProjectPath& path, const DataSpec::NamedResourceCatalog<IDType>& catalog)
|
||||
void RecursiveAddDirObjects(const hecl::ProjectPath& path, const DataSpec::NamedResourceCatalog<IDType>& catalog)
|
||||
{
|
||||
HECL::DirectoryEnumerator de = path.enumerateDir();
|
||||
hecl::DirectoryEnumerator de = path.enumerateDir();
|
||||
const int idLen = 5 + (IDType::BinarySize() * 2);
|
||||
for (const HECL::DirectoryEnumerator::Entry& ent : de)
|
||||
for (const hecl::DirectoryEnumerator::Entry& ent : de)
|
||||
{
|
||||
if (ent.m_isDir)
|
||||
RecursiveAddDirObjects(HECL::ProjectPath(path, ent.m_name), catalog);
|
||||
RecursiveAddDirObjects(hecl::ProjectPath(path, ent.m_name), catalog);
|
||||
if (ent.m_name.size() == idLen && ent.m_name[4] == _S('_'))
|
||||
{
|
||||
HECL::SystemUTF8View entu8(ent.m_name);
|
||||
hecl::SystemUTF8View entu8(ent.m_name);
|
||||
#if _WIN32
|
||||
u64 id = _strtoui64(entu8.c_str() + 5, nullptr, 16);
|
||||
#else
|
||||
@@ -33,14 +33,14 @@ class ProjectResourceFactory : public pshag::IFactory
|
||||
|
||||
if (id)
|
||||
{
|
||||
pshag::SObjectTag objTag = {HECL::FourCC(entu8.c_str()), id};
|
||||
urde::SObjectTag objTag = {hecl::FourCC(entu8.c_str()), id};
|
||||
if (m_resPaths.find(objTag) == m_resPaths.end())
|
||||
m_resPaths[objTag] = HECL::ProjectPath(path, ent.m_name);
|
||||
m_resPaths[objTag] = hecl::ProjectPath(path, ent.m_name);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
HECL::SystemUTF8View nameView(ent.m_name);
|
||||
hecl::SystemUTF8View nameView(ent.m_name);
|
||||
auto it = std::find_if(catalog.namedResources.begin(), catalog.namedResources.end(),
|
||||
[&nameView](const typename DataSpec::NamedResourceCatalog<IDType>::NamedResource& res) -> bool
|
||||
{ return res.name == nameView.str(); });
|
||||
@@ -48,33 +48,33 @@ class ProjectResourceFactory : public pshag::IFactory
|
||||
continue;
|
||||
|
||||
const typename DataSpec::NamedResourceCatalog<IDType>::NamedResource& nr = *it;
|
||||
pshag::SObjectTag objTag = GetTag<IDType>(nr);
|
||||
urde::SObjectTag objTag = GetTag<IDType>(nr);
|
||||
|
||||
m_namedResources[nr.name.c_str()] = objTag;
|
||||
m_resPaths[objTag] = HECL::ProjectPath(path, ent.m_name);
|
||||
m_resPaths[objTag] = hecl::ProjectPath(path, ent.m_name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template <class IDType>
|
||||
pshag::SObjectTag GetTag(const DataSpec::NamedResourceCatalog<DataSpec::UniqueID32>::NamedResource &nr,
|
||||
urde::SObjectTag GetTag(const DataSpec::NamedResourceCatalog<DataSpec::UniqueID32>::NamedResource &nr,
|
||||
typename std::enable_if<std::is_same<IDType, DataSpec::UniqueID32>::value>::type* = 0)
|
||||
{ return { nr.type, nr.uid.toUint32() }; }
|
||||
|
||||
template <class IDType>
|
||||
pshag::SObjectTag GetTag(const typename DataSpec::NamedResourceCatalog<IDType>::NamedResource& nr,
|
||||
urde::SObjectTag GetTag(const typename DataSpec::NamedResourceCatalog<IDType>::NamedResource& nr,
|
||||
typename std::enable_if<std::is_same<IDType, DataSpec::UniqueID64>::value>::type* = 0)
|
||||
{ return { nr.type, nr.uid.toUint64() }; }
|
||||
|
||||
public:
|
||||
ProjectResourceFactory();
|
||||
void BuildObjectMap(const HECL::Database::Project::ProjectDataSpec& spec);
|
||||
void BuildObjectMap(const hecl::Database::Project::ProjectDataSpec& spec);
|
||||
|
||||
std::unique_ptr<pshag::IObj> Build(const pshag::SObjectTag&, const pshag::CVParamTransfer&);
|
||||
void BuildAsync(const pshag::SObjectTag&, const pshag::CVParamTransfer&, pshag::IObj**);
|
||||
void CancelBuild(const pshag::SObjectTag&);
|
||||
bool CanBuild(const pshag::SObjectTag&);
|
||||
const pshag::SObjectTag* GetResourceIdByName(const char*) const;
|
||||
std::unique_ptr<urde::IObj> Build(const urde::SObjectTag&, const urde::CVParamTransfer&);
|
||||
void BuildAsync(const urde::SObjectTag&, const urde::CVParamTransfer&, urde::IObj**);
|
||||
void CancelBuild(const urde::SObjectTag&);
|
||||
bool CanBuild(const urde::SObjectTag&);
|
||||
const urde::SObjectTag* GetResourceIdByName(const char*) const;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
namespace URDE
|
||||
{
|
||||
|
||||
Space::Class Resource::DeduceDefaultSpaceClass(const HECL::ProjectPath& path)
|
||||
Space::Class Resource::DeduceDefaultSpaceClass(const hecl::ProjectPath& path)
|
||||
{
|
||||
Athena::io::FileReader r(path.getAbsolutePath(), 32*1024, false);
|
||||
athena::io::FileReader r(path.getAbsolutePath(), 32*1024, false);
|
||||
if (r.hasError())
|
||||
return Space::Class::None;
|
||||
return Space::Class::None;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#ifndef URDE_RESOURCE_HPP
|
||||
#define URDE_RESOURCE_HPP
|
||||
|
||||
#include <HECL/Database.hpp>
|
||||
#include <hecl/Database.hpp>
|
||||
#include "Space.hpp"
|
||||
|
||||
namespace URDE
|
||||
@@ -19,17 +19,17 @@ namespace URDE
|
||||
class Resource
|
||||
{
|
||||
public:
|
||||
using ProjectDataSpec = HECL::Database::Project::ProjectDataSpec;
|
||||
using ProjectDataSpec = hecl::Database::Project::ProjectDataSpec;
|
||||
private:
|
||||
HECL::ProjectPath m_path;
|
||||
hecl::ProjectPath m_path;
|
||||
Space::Class m_defaultClass = Space::Class::None;
|
||||
EditorSpace* m_editingSpace = nullptr;
|
||||
std::vector<ViewerSpace*> m_viewingSpaces;
|
||||
public:
|
||||
static Space::Class DeduceDefaultSpaceClass(const HECL::ProjectPath& path);
|
||||
explicit Resource(HECL::ProjectPath&& path)
|
||||
static Space::Class DeduceDefaultSpaceClass(const hecl::ProjectPath& path);
|
||||
explicit Resource(hecl::ProjectPath&& path)
|
||||
: m_path(std::move(path)), m_defaultClass(DeduceDefaultSpaceClass(m_path)) {}
|
||||
const HECL::ProjectPath& path() const {return m_path;}
|
||||
const hecl::ProjectPath& path() const {return m_path;}
|
||||
};
|
||||
|
||||
/** Provides centralized hierarchical lookup and ownership of Resource nodes */
|
||||
@@ -38,8 +38,8 @@ class ResourceTree
|
||||
public:
|
||||
struct Node
|
||||
{
|
||||
std::map<HECL::ProjectPath, std::unique_ptr<Node>> m_subnodes;
|
||||
std::map<HECL::ProjectPath, std::unique_ptr<Resource>> m_resources;
|
||||
std::map<hecl::ProjectPath, std::unique_ptr<Node>> m_subnodes;
|
||||
std::map<hecl::ProjectPath, std::unique_ptr<Resource>> m_resources;
|
||||
};
|
||||
private:
|
||||
std::unique_ptr<Node> m_rootNode;
|
||||
|
||||
@@ -4,19 +4,19 @@ namespace URDE
|
||||
{
|
||||
#define BROWSER_MARGIN 8
|
||||
|
||||
bool ResourceBrowser::navigateToPath(const HECL::ProjectPath& pathIn)
|
||||
bool ResourceBrowser::navigateToPath(const hecl::ProjectPath& pathIn)
|
||||
{
|
||||
if (pathIn.getPathType() == HECL::ProjectPath::Type::File)
|
||||
if (pathIn.getPathType() == hecl::ProjectPath::Type::File)
|
||||
m_path = pathIn.getParentPath();
|
||||
else
|
||||
m_path = pathIn;
|
||||
|
||||
m_comps = m_path.getPathComponents();
|
||||
|
||||
HECL::DirectoryEnumerator dEnum(m_path.getAbsolutePath(),
|
||||
HECL::DirectoryEnumerator::Mode::DirsThenFilesSorted,
|
||||
hecl::DirectoryEnumerator dEnum(m_path.getAbsolutePath(),
|
||||
hecl::DirectoryEnumerator::Mode::DirsThenFilesSorted,
|
||||
m_state.sortColumn==State::SortColumn::Size,
|
||||
m_state.sortDir==Specter::SortDirection::Descending,
|
||||
m_state.sortDir==specter::SortDirection::Descending,
|
||||
true);
|
||||
m_fileListingBind.updateListing(dEnum);
|
||||
if (m_pathButtons)
|
||||
@@ -37,10 +37,10 @@ void ResourceBrowser::pathButtonActivated(size_t idx)
|
||||
if (idx >= m_comps.size())
|
||||
return;
|
||||
|
||||
HECL::SystemString dir;
|
||||
hecl::SystemString dir;
|
||||
bool needSlash = false;
|
||||
size_t i = 0;
|
||||
for (const HECL::SystemString& d : m_comps)
|
||||
for (const hecl::SystemString& d : m_comps)
|
||||
{
|
||||
if (needSlash)
|
||||
dir += _S('/');
|
||||
@@ -50,7 +50,7 @@ void ResourceBrowser::pathButtonActivated(size_t idx)
|
||||
if (++i > idx)
|
||||
break;
|
||||
}
|
||||
navigateToPath(HECL::ProjectPath(*m_vm.project(), dir));
|
||||
navigateToPath(hecl::ProjectPath(*m_vm.project(), dir));
|
||||
}
|
||||
|
||||
void ResourceBrowser::View::mouseDown(const boo::SWindowCoord& coord, boo::EMouseButton button, boo::EModifierKey mod)
|
||||
@@ -75,7 +75,7 @@ void ResourceBrowser::View::mouseLeave(const boo::SWindowCoord& coord)
|
||||
|
||||
void ResourceBrowser::View::resized(const boo::SWindowRect& root, const boo::SWindowRect& sub)
|
||||
{
|
||||
Specter::View::resized(root, sub);
|
||||
specter::View::resized(root, sub);
|
||||
m_fileListing.m_view->resized(root, sub);
|
||||
}
|
||||
void ResourceBrowser::View::draw(boo::IGraphicsCommandQueue* gfxQ)
|
||||
|
||||
@@ -3,12 +3,12 @@
|
||||
|
||||
#include "Space.hpp"
|
||||
#include "ViewManager.hpp"
|
||||
#include "Specter/PathButtons.hpp"
|
||||
#include "specter/PathButtons.hpp"
|
||||
|
||||
namespace URDE
|
||||
{
|
||||
|
||||
class ResourceBrowser : public Space, public Specter::IPathButtonsBinding
|
||||
class ResourceBrowser : public Space, public specter::IPathButtonsBinding
|
||||
{
|
||||
struct State : Space::State
|
||||
{
|
||||
@@ -22,22 +22,22 @@ class ResourceBrowser : public Space, public Specter::IPathButtonsBinding
|
||||
Size
|
||||
};
|
||||
Value<SortColumn> sortColumn = SortColumn::Name;
|
||||
Value<Specter::SortDirection> sortDir = Specter::SortDirection::Ascending;
|
||||
Value<specter::SortDirection> sortDir = specter::SortDirection::Ascending;
|
||||
} m_state;
|
||||
const Space::State& spaceState() const {return m_state;}
|
||||
|
||||
HECL::ProjectPath m_path;
|
||||
std::vector<HECL::SystemString> m_comps;
|
||||
hecl::ProjectPath m_path;
|
||||
std::vector<hecl::SystemString> m_comps;
|
||||
|
||||
void pathButtonActivated(size_t idx);
|
||||
|
||||
struct ResListingDataBind : Specter::ITableDataBinding, Specter::ITableStateBinding
|
||||
struct ResListingDataBind : specter::ITableDataBinding, specter::ITableStateBinding
|
||||
{
|
||||
ResourceBrowser& m_rb;
|
||||
|
||||
struct Entry
|
||||
{
|
||||
HECL::SystemString m_path;
|
||||
hecl::SystemString m_path;
|
||||
std::string m_name;
|
||||
std::string m_type;
|
||||
std::string m_size;
|
||||
@@ -97,21 +97,21 @@ class ResourceBrowser : public Space, public Specter::IPathButtonsBinding
|
||||
m_rb.m_state.columnSplits[cIdx] = split;
|
||||
}
|
||||
|
||||
void updateListing(const HECL::DirectoryEnumerator& dEnum)
|
||||
void updateListing(const hecl::DirectoryEnumerator& dEnum)
|
||||
{
|
||||
m_entries.clear();
|
||||
m_entries.reserve(dEnum.size());
|
||||
|
||||
for (const HECL::DirectoryEnumerator::Entry& d : dEnum)
|
||||
for (const hecl::DirectoryEnumerator::Entry& d : dEnum)
|
||||
{
|
||||
m_entries.emplace_back();
|
||||
Entry& ent = m_entries.back();
|
||||
ent.m_path = d.m_path;
|
||||
HECL::SystemUTF8View nameUtf8(d.m_name);
|
||||
hecl::SystemUTF8View nameUtf8(d.m_name);
|
||||
ent.m_name = nameUtf8.str();
|
||||
if (d.m_isDir)
|
||||
{
|
||||
if (HECL::SearchForProject(d.m_path))
|
||||
if (hecl::SearchForProject(d.m_path))
|
||||
ent.m_type = m_projStr;
|
||||
else
|
||||
ent.m_type = m_dirStr;
|
||||
@@ -119,8 +119,8 @@ class ResourceBrowser : public Space, public Specter::IPathButtonsBinding
|
||||
else
|
||||
{
|
||||
ent.m_type = m_fileStr;
|
||||
ent.m_size = HECL::HumanizeNumber(d.m_fileSz, 7, nullptr, int(HECL::HNScale::AutoScale),
|
||||
HECL::HNFlags::B | HECL::HNFlags::Decimal);
|
||||
ent.m_size = hecl::HumanizeNumber(d.m_fileSz, 7, nullptr, int(hecl::HNScale::AutoScale),
|
||||
hecl::HNFlags::B | hecl::HNFlags::Decimal);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -129,7 +129,7 @@ class ResourceBrowser : public Space, public Specter::IPathButtonsBinding
|
||||
|
||||
bool m_needsUpdate = false;
|
||||
|
||||
Specter::SortDirection getSort(size_t& cIdx) const
|
||||
specter::SortDirection getSort(size_t& cIdx) const
|
||||
{
|
||||
cIdx = size_t(m_rb.m_state.sortColumn);
|
||||
if (cIdx > 2)
|
||||
@@ -137,7 +137,7 @@ class ResourceBrowser : public Space, public Specter::IPathButtonsBinding
|
||||
return m_rb.m_state.sortDir;
|
||||
}
|
||||
|
||||
void setSort(size_t cIdx, Specter::SortDirection dir)
|
||||
void setSort(size_t cIdx, specter::SortDirection dir)
|
||||
{
|
||||
m_rb.m_state.sortDir = dir;
|
||||
m_needsUpdate = true;
|
||||
@@ -151,7 +151,7 @@ class ResourceBrowser : public Space, public Specter::IPathButtonsBinding
|
||||
{
|
||||
}
|
||||
|
||||
ResListingDataBind(ResourceBrowser& rb, const Specter::IViewManager& vm)
|
||||
ResListingDataBind(ResourceBrowser& rb, const specter::IViewManager& vm)
|
||||
: m_rb(rb)
|
||||
{
|
||||
m_nameCol = vm.translateOr("name", "Name");
|
||||
@@ -164,16 +164,16 @@ class ResourceBrowser : public Space, public Specter::IPathButtonsBinding
|
||||
|
||||
} m_fileListingBind;
|
||||
|
||||
struct View : Specter::View
|
||||
struct View : specter::View
|
||||
{
|
||||
ResourceBrowser& m_ro;
|
||||
Specter::ViewChild<std::unique_ptr<Specter::Table>> m_fileListing;
|
||||
specter::ViewChild<std::unique_ptr<specter::Table>> m_fileListing;
|
||||
|
||||
View(ResourceBrowser& ro, Specter::ViewResources& res)
|
||||
: Specter::View(res, ro.m_vm.rootView()), m_ro(ro)
|
||||
View(ResourceBrowser& ro, specter::ViewResources& res)
|
||||
: specter::View(res, ro.m_vm.rootView()), m_ro(ro)
|
||||
{
|
||||
commitResources(res);
|
||||
m_fileListing.m_view.reset(new Specter::Table(res, *this, &ro.m_fileListingBind, &ro.m_fileListingBind, 3));
|
||||
m_fileListing.m_view.reset(new specter::Table(res, *this, &ro.m_fileListingBind, &ro.m_fileListingBind, 3));
|
||||
}
|
||||
|
||||
void mouseDown(const boo::SWindowCoord&, boo::EMouseButton, boo::EModifierKey);
|
||||
@@ -186,7 +186,7 @@ class ResourceBrowser : public Space, public Specter::IPathButtonsBinding
|
||||
};
|
||||
std::unique_ptr<View> m_view;
|
||||
|
||||
std::unique_ptr<Specter::PathButtons> m_pathButtons;
|
||||
std::unique_ptr<specter::PathButtons> m_pathButtons;
|
||||
|
||||
public:
|
||||
ResourceBrowser(ViewManager& vm, Space* parent)
|
||||
@@ -210,30 +210,30 @@ public:
|
||||
|
||||
void reloadState()
|
||||
{
|
||||
HECL::ProjectPath pp(*m_vm.project(), m_state.path);
|
||||
if (m_state.path.empty() || pp.getPathType() == HECL::ProjectPath::Type::None)
|
||||
hecl::ProjectPath pp(*m_vm.project(), m_state.path);
|
||||
if (m_state.path.empty() || pp.getPathType() == hecl::ProjectPath::Type::None)
|
||||
{
|
||||
m_state.path = m_vm.project()->getProjectWorkingPath().getRelativePathUTF8();
|
||||
navigateToPath(HECL::ProjectPath(*m_vm.project(), m_state.path));
|
||||
navigateToPath(hecl::ProjectPath(*m_vm.project(), m_state.path));
|
||||
}
|
||||
else
|
||||
navigateToPath(pp);
|
||||
}
|
||||
|
||||
bool navigateToPath(const HECL::ProjectPath& path);
|
||||
bool navigateToPath(const hecl::ProjectPath& path);
|
||||
|
||||
Space* copy(Space* parent) const
|
||||
{
|
||||
return new ResourceBrowser(m_vm, parent, *this);
|
||||
}
|
||||
|
||||
void buildToolbarView(Specter::ViewResources &res, Specter::Toolbar &tb)
|
||||
void buildToolbarView(specter::ViewResources &res, specter::Toolbar &tb)
|
||||
{
|
||||
m_pathButtons.reset(new Specter::PathButtons(res, tb, *this, true));
|
||||
m_pathButtons.reset(new specter::PathButtons(res, tb, *this, true));
|
||||
tb.push_back(m_pathButtons.get(), 0);
|
||||
}
|
||||
|
||||
Specter::View* buildContentView(Specter::ViewResources& res)
|
||||
specter::View* buildContentView(specter::ViewResources& res)
|
||||
{
|
||||
m_view.reset(new View(*this, res));
|
||||
return m_view.get();
|
||||
|
||||
@@ -8,34 +8,34 @@
|
||||
|
||||
namespace URDE
|
||||
{
|
||||
static LogVisor::LogModule Log("URDE::Space");
|
||||
static logvisor::Module Log("URDE::Space");
|
||||
|
||||
Space::Space(ViewManager& vm, Class cls, Space* parent)
|
||||
: m_spaceMenuNode(*this), m_spaceSelectBind(*this),
|
||||
m_vm(vm), m_class(cls), m_parent(parent) {}
|
||||
|
||||
Specter::View* Space::buildSpaceView(Specter::ViewResources& res)
|
||||
specter::View* Space::buildSpaceView(specter::ViewResources& res)
|
||||
{
|
||||
if (usesToolbar())
|
||||
{
|
||||
m_spaceView.reset(new Specter::Space(res, *m_parent->basisView(), *this, Specter::Toolbar::Position::Bottom, toolbarUnits()));
|
||||
Specter::View* sview = buildContentView(res);
|
||||
m_spaceView.reset(new specter::Space(res, *m_parent->basisView(), *this, specter::Toolbar::Position::Bottom, toolbarUnits()));
|
||||
specter::View* sview = buildContentView(res);
|
||||
m_spaceView->setContentView(sview);
|
||||
Specter::Toolbar& tb = *m_spaceView->toolbar();
|
||||
specter::Toolbar& tb = *m_spaceView->toolbar();
|
||||
const std::string* classStr = SpaceMenuNode::LookupClassString(m_class);
|
||||
Specter::Icon* classIcon = SpaceMenuNode::LookupClassIcon(m_class);
|
||||
const Zeus::CColor* classColor = SpaceMenuNode::LookupClassColor(m_class);
|
||||
m_spaceSelectButton.reset(new Specter::Button(res, tb, &m_spaceSelectBind, "", classIcon,
|
||||
Specter::Button::Style::Block,
|
||||
classColor?*classColor:Zeus::CColor::skWhite));
|
||||
specter::Icon* classIcon = SpaceMenuNode::LookupClassIcon(m_class);
|
||||
const zeus::CColor* classColor = SpaceMenuNode::LookupClassColor(m_class);
|
||||
m_spaceSelectButton.reset(new specter::Button(res, tb, &m_spaceSelectBind, "", classIcon,
|
||||
specter::Button::Style::Block,
|
||||
classColor?*classColor:zeus::CColor::skWhite));
|
||||
tb.push_back(m_spaceSelectButton.get(), 0);
|
||||
buildToolbarView(res, tb);
|
||||
return m_spaceView.get();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_spaceView.reset(new Specter::Space(res, *m_parent->basisView(), *this, Specter::Toolbar::Position::None, 0));
|
||||
Specter::View* sview = buildContentView(res);
|
||||
m_spaceView.reset(new specter::Space(res, *m_parent->basisView(), *this, specter::Toolbar::Position::None, 0));
|
||||
specter::View* sview = buildContentView(res);
|
||||
m_spaceView->setContentView(sview);
|
||||
return m_spaceView.get();
|
||||
}
|
||||
@@ -57,25 +57,25 @@ void Space::SpaceMenuNode::InitializeStrings(ViewManager& vm)
|
||||
sn.m_text = vm.translateOr(sn.m_key, sn.m_text.c_str());
|
||||
}
|
||||
|
||||
std::unique_ptr<Specter::View> Space::SpaceSelectBind::buildMenu(const Specter::Button* button)
|
||||
std::unique_ptr<specter::View> Space::SpaceSelectBind::buildMenu(const specter::Button* button)
|
||||
{
|
||||
return std::unique_ptr<Specter::View>(new Specter::Menu(m_space.m_vm.rootView().viewRes(),
|
||||
return std::unique_ptr<specter::View>(new specter::Menu(m_space.m_vm.rootView().viewRes(),
|
||||
*m_space.m_spaceView, &m_space.m_spaceMenuNode));
|
||||
}
|
||||
|
||||
Specter::View* RootSpace::buildSpaceView(Specter::ViewResources& res)
|
||||
specter::View* RootSpace::buildSpaceView(specter::ViewResources& res)
|
||||
{
|
||||
Specter::View* newRoot = buildContentView(res);
|
||||
specter::View* newRoot = buildContentView(res);
|
||||
m_vm.RootSpaceViewBuilt(newRoot);
|
||||
return newRoot;
|
||||
}
|
||||
|
||||
Specter::View* RootSpace::basisView() {return &m_vm.rootView();}
|
||||
specter::View* RootSpace::basisView() {return &m_vm.rootView();}
|
||||
|
||||
Specter::View* SplitSpace::buildContentView(Specter::ViewResources& res)
|
||||
specter::View* SplitSpace::buildContentView(specter::ViewResources& res)
|
||||
{
|
||||
int clearance = res.pixelFactor() * SPECTER_TOOLBAR_GAUGE;
|
||||
m_splitView.reset(new Specter::SplitView(res, *m_parent->basisView(), this, m_state.axis,
|
||||
m_splitView.reset(new specter::SplitView(res, *m_parent->basisView(), this, m_state.axis,
|
||||
m_state.split, clearance, clearance));
|
||||
if (m_slots[0])
|
||||
m_splitView->setContentView(0, m_slots[0]->buildSpaceView(res));
|
||||
@@ -87,19 +87,19 @@ Specter::View* SplitSpace::buildContentView(Specter::ViewResources& res)
|
||||
void SplitSpace::setChildSlot(unsigned slot, std::unique_ptr<Space>&& space)
|
||||
{
|
||||
if (slot > 1)
|
||||
Log.report(LogVisor::FatalError, "invalid slot %u for SplitView", slot);
|
||||
Log.report(logvisor::Fatal, "invalid slot %u for SplitView", slot);
|
||||
m_slots[slot] = std::move(space);
|
||||
m_slots[slot]->m_parent = this;
|
||||
}
|
||||
|
||||
void SplitSpace::joinViews(Specter::SplitView* thisSplit, int thisSlot, Specter::SplitView* otherSplit, int otherSlot)
|
||||
void SplitSpace::joinViews(specter::SplitView* thisSplit, int thisSlot, specter::SplitView* otherSplit, int otherSlot)
|
||||
{
|
||||
if (thisSplit == otherSplit)
|
||||
{
|
||||
SplitSpace* thisSS = dynamic_cast<SplitSpace*>(m_slots[thisSlot].get());
|
||||
if (thisSS)
|
||||
{
|
||||
int ax = thisSS->m_state.axis == Specter::SplitView::Axis::Horizontal ? 1 : 0;
|
||||
int ax = thisSS->m_state.axis == specter::SplitView::Axis::Horizontal ? 1 : 0;
|
||||
const boo::SWindowRect& thisRect = m_splitView->subRect();
|
||||
const boo::SWindowRect& subRect = thisSS->m_splitView->subRect();
|
||||
int splitPx = subRect.location[ax] + subRect.size[ax] * thisSS->m_state.split -
|
||||
@@ -116,7 +116,7 @@ void SplitSpace::joinViews(Specter::SplitView* thisSplit, int thisSlot, Specter:
|
||||
SplitSpace* otherSS = dynamic_cast<SplitSpace*>(m_slots[i].get());
|
||||
if (otherSS && otherSS->m_splitView.get() == otherSplit)
|
||||
{
|
||||
int ax = m_state.axis == Specter::SplitView::Axis::Horizontal ? 1 : 0;
|
||||
int ax = m_state.axis == specter::SplitView::Axis::Horizontal ? 1 : 0;
|
||||
const boo::SWindowRect& thisRect = m_splitView->subRect();
|
||||
const boo::SWindowRect& subRect = otherSS->m_splitView->subRect();
|
||||
int splitPx = subRect.location[ax] + subRect.size[ax] * otherSS->m_state.split -
|
||||
@@ -130,13 +130,13 @@ void SplitSpace::joinViews(Specter::SplitView* thisSplit, int thisSlot, Specter:
|
||||
}
|
||||
}
|
||||
|
||||
Specter::ISplitSpaceController* Space::spaceSplit(Specter::SplitView::Axis axis, int thisSlot)
|
||||
specter::ISplitSpaceController* Space::spaceSplit(specter::SplitView::Axis axis, int thisSlot)
|
||||
{
|
||||
if (m_parent)
|
||||
{
|
||||
/* Reject split operations with insufficient clearance */
|
||||
int clearance = m_vm.m_viewResources.pixelFactor() * SPECTER_TOOLBAR_GAUGE;
|
||||
if (axis == Specter::SplitView::Axis::Horizontal)
|
||||
if (axis == specter::SplitView::Axis::Horizontal)
|
||||
{
|
||||
if (m_spaceView->subRect().size[1] <= clearance)
|
||||
return nullptr;
|
||||
@@ -166,7 +166,7 @@ std::unique_ptr<Space> RootSpace::exchangeSpaceSplitJoin(Space* removeSpace, std
|
||||
m_spaceTree->m_parent = this;
|
||||
}
|
||||
else
|
||||
Log.report(LogVisor::FatalError, "RootSpace::exchangeSpaceSplitJoin() failure");
|
||||
Log.report(logvisor::Fatal, "RootSpace::exchangeSpaceSplitJoin() failure");
|
||||
|
||||
return ret;
|
||||
}
|
||||
@@ -186,7 +186,7 @@ std::unique_ptr<Space> SplitSpace::exchangeSpaceSplitJoin(Space* removeSpace, st
|
||||
m_slots[1]->m_parent = this;
|
||||
}
|
||||
else
|
||||
Log.report(LogVisor::FatalError, "SplitSpace::exchangeSpaceSplitJoin() failure");
|
||||
Log.report(logvisor::Fatal, "SplitSpace::exchangeSpaceSplitJoin() failure");
|
||||
|
||||
return ret;
|
||||
}
|
||||
@@ -212,13 +212,13 @@ static Space* BuildNewSpace(ViewManager& vm, Space::Class cls, Space* parent, Re
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void Space::saveState(Athena::io::IStreamWriter& w) const
|
||||
void Space::saveState(athena::io::IStreamWriter& w) const
|
||||
{
|
||||
w.writeUint32Big(atUint32(m_class));
|
||||
spaceState().write(w);
|
||||
}
|
||||
|
||||
void Space::saveState(Athena::io::YAMLDocWriter& w) const
|
||||
void Space::saveState(athena::io::YAMLDocWriter& w) const
|
||||
{
|
||||
w.writeUint32("class", atUint32(m_class));
|
||||
spaceState().write(w);
|
||||
|
||||
114
Editor/Space.hpp
114
Editor/Space.hpp
@@ -1,11 +1,11 @@
|
||||
#ifndef URDE_SPACE_HPP
|
||||
#define URDE_SPACE_HPP
|
||||
|
||||
#include <Athena/DNAYaml.hpp>
|
||||
#include <Specter/Specter.hpp>
|
||||
#include <athena/DNAYaml.hpp>
|
||||
#include <specter/specter.hpp>
|
||||
#include "ProjectManager.hpp"
|
||||
|
||||
namespace Specter
|
||||
namespace specter
|
||||
{
|
||||
class View;
|
||||
class SplitView;
|
||||
@@ -17,7 +17,7 @@ namespace URDE
|
||||
class ViewManager;
|
||||
class RootSpace;
|
||||
|
||||
class Space : public Specter::ISpaceController
|
||||
class Space : public specter::ISpaceController
|
||||
{
|
||||
friend class SplitSpace;
|
||||
public:
|
||||
@@ -38,28 +38,28 @@ public:
|
||||
InformationCenter
|
||||
};
|
||||
|
||||
struct State : Athena::io::DNAYaml<Athena::BigEndian> {Delete _d;};
|
||||
struct State : athena::io::DNAYaml<athena::BigEndian> {Delete _d;};
|
||||
static Space* NewSpaceFromConfigStream(ViewManager& vm, Space* parent, ConfigReader& r);
|
||||
static RootSpace* NewRootSpaceFromConfigStream(ViewManager& vm, ConfigReader& r);
|
||||
|
||||
struct SpaceMenuNode : Specter::IMenuNode
|
||||
struct SpaceMenuNode : specter::IMenuNode
|
||||
{
|
||||
struct SubNodeData : Specter::IMenuNode
|
||||
struct SubNodeData : specter::IMenuNode
|
||||
{
|
||||
Class m_cls;
|
||||
std::string m_key;
|
||||
std::string m_text;
|
||||
Specter::Icon& m_icon;
|
||||
Zeus::CColor m_color;
|
||||
specter::Icon& m_icon;
|
||||
zeus::CColor m_color;
|
||||
const std::string* text() const {return &m_text;}
|
||||
void activated(const boo::SWindowCoord& coord) {}
|
||||
|
||||
SubNodeData(Class cls, const char* key, const char* text, Specter::Icon& icon, const Zeus::CColor& color)
|
||||
SubNodeData(Class cls, const char* key, const char* text, specter::Icon& icon, const zeus::CColor& color)
|
||||
: m_cls(cls), m_key(key), m_text(text), m_icon(icon), m_color(color) {}
|
||||
};
|
||||
static std::vector<SubNodeData> s_subNodeDats;
|
||||
|
||||
struct SubNode : Specter::IMenuNode
|
||||
struct SubNode : specter::IMenuNode
|
||||
{
|
||||
Space& m_space;
|
||||
const SubNodeData& m_data;
|
||||
@@ -91,14 +91,14 @@ public:
|
||||
return &sn.m_text;
|
||||
return nullptr;
|
||||
}
|
||||
static Specter::Icon* LookupClassIcon(Class cls)
|
||||
static specter::Icon* LookupClassIcon(Class cls)
|
||||
{
|
||||
for (SubNodeData& sn : s_subNodeDats)
|
||||
if (sn.m_cls == cls)
|
||||
return &sn.m_icon;
|
||||
return nullptr;
|
||||
}
|
||||
static const Zeus::CColor* LookupClassColor(Class cls)
|
||||
static const zeus::CColor* LookupClassColor(Class cls)
|
||||
{
|
||||
for (SubNodeData& sn : s_subNodeDats)
|
||||
if (sn.m_cls == cls)
|
||||
@@ -107,17 +107,17 @@ public:
|
||||
}
|
||||
} m_spaceMenuNode;
|
||||
|
||||
struct SpaceSelectBind : Specter::IButtonBinding
|
||||
struct SpaceSelectBind : specter::IButtonBinding
|
||||
{
|
||||
Space& m_space;
|
||||
const char* name(const Specter::Control* control) const {return SpaceMenuNode::s_text.c_str();}
|
||||
const char* name(const specter::Control* control) const {return SpaceMenuNode::s_text.c_str();}
|
||||
|
||||
MenuStyle menuStyle(const Specter::Button* button) const {return MenuStyle::Primary;}
|
||||
std::unique_ptr<Specter::View> buildMenu(const Specter::Button* button);
|
||||
MenuStyle menuStyle(const specter::Button* button) const {return MenuStyle::Primary;}
|
||||
std::unique_ptr<specter::View> buildMenu(const specter::Button* button);
|
||||
|
||||
SpaceSelectBind(Space& space) : m_space(space) {}
|
||||
} m_spaceSelectBind;
|
||||
std::unique_ptr<Specter::Button> m_spaceSelectButton;
|
||||
std::unique_ptr<specter::Button> m_spaceSelectButton;
|
||||
|
||||
protected:
|
||||
friend class ViewManager;
|
||||
@@ -125,7 +125,7 @@ protected:
|
||||
ViewManager& m_vm;
|
||||
Class m_class = Class::None;
|
||||
Space* m_parent;
|
||||
std::unique_ptr<Specter::Space> m_spaceView;
|
||||
std::unique_ptr<specter::Space> m_spaceView;
|
||||
Space(ViewManager& vm, Class cls, Space* parent);
|
||||
|
||||
/* Allows common Space code to access DNA-encoded state */
|
||||
@@ -134,13 +134,13 @@ protected:
|
||||
/* Structural control */
|
||||
virtual bool usesToolbar() const {return false;}
|
||||
virtual unsigned toolbarUnits() const {return 1;}
|
||||
virtual void buildToolbarView(Specter::ViewResources& res, Specter::Toolbar& tb) {}
|
||||
virtual Specter::View* buildContentView(Specter::ViewResources& res)=0;
|
||||
virtual Specter::View* buildSpaceView(Specter::ViewResources& res);
|
||||
virtual void buildToolbarView(specter::ViewResources& res, specter::Toolbar& tb) {}
|
||||
virtual specter::View* buildContentView(specter::ViewResources& res)=0;
|
||||
virtual specter::View* buildSpaceView(specter::ViewResources& res);
|
||||
|
||||
public:
|
||||
virtual void saveState(Athena::io::IStreamWriter& w) const;
|
||||
virtual void saveState(Athena::io::YAMLDocWriter& w) const;
|
||||
virtual void saveState(athena::io::IStreamWriter& w) const;
|
||||
virtual void saveState(athena::io::YAMLDocWriter& w) const;
|
||||
virtual void reloadState() {}
|
||||
|
||||
virtual void think() {}
|
||||
@@ -148,17 +148,17 @@ public:
|
||||
virtual Space* copy(Space* parent) const=0;
|
||||
bool spaceSplitAllowed() const {return true;}
|
||||
|
||||
Specter::ISplitSpaceController* spaceSplit(Specter::SplitView::Axis axis, int thisSlot);
|
||||
specter::ISplitSpaceController* spaceSplit(specter::SplitView::Axis axis, int thisSlot);
|
||||
virtual std::unique_ptr<Space> exchangeSpaceSplitJoin(Space* removeSpace, std::unique_ptr<Space>&& keepSpace)
|
||||
{return std::unique_ptr<Space>();}
|
||||
|
||||
virtual Specter::View* basisView() {return m_spaceView.get();}
|
||||
virtual specter::View* basisView() {return m_spaceView.get();}
|
||||
};
|
||||
|
||||
class RootSpace : public Space
|
||||
{
|
||||
friend class ViewManager;
|
||||
std::unique_ptr<Specter::RootView> m_rootView;
|
||||
std::unique_ptr<specter::RootView> m_rootView;
|
||||
std::unique_ptr<Space> m_spaceTree;
|
||||
struct State : Space::State
|
||||
{
|
||||
@@ -181,7 +181,7 @@ public:
|
||||
#endif
|
||||
}
|
||||
|
||||
void saveState(Athena::io::IStreamWriter& w) const
|
||||
void saveState(athena::io::IStreamWriter& w) const
|
||||
{
|
||||
w.writeUint32Big(atUint32(m_class));
|
||||
m_state.write(w);
|
||||
@@ -192,7 +192,7 @@ public:
|
||||
w.writeUint32Big(0);
|
||||
}
|
||||
|
||||
void saveState(Athena::io::YAMLDocWriter& w) const
|
||||
void saveState(athena::io::YAMLDocWriter& w) const
|
||||
{
|
||||
w.writeUint32("class", atUint32(m_class));
|
||||
m_state.write(w);
|
||||
@@ -214,35 +214,35 @@ public:
|
||||
Space* copy(Space* parent) const {return nullptr;}
|
||||
bool spaceSplitAllowed() const {return false;}
|
||||
|
||||
Specter::View* buildSpaceView(Specter::ViewResources& res);
|
||||
Specter::View* buildContentView(Specter::ViewResources& res) {return m_spaceTree->buildSpaceView(res);}
|
||||
specter::View* buildSpaceView(specter::ViewResources& res);
|
||||
specter::View* buildContentView(specter::ViewResources& res) {return m_spaceTree->buildSpaceView(res);}
|
||||
|
||||
std::unique_ptr<Space> exchangeSpaceSplitJoin(Space* removeSpace, std::unique_ptr<Space>&& keepSpace);
|
||||
|
||||
Specter::View* basisView();
|
||||
specter::View* basisView();
|
||||
};
|
||||
|
||||
class SplitSpace : public Space, public Specter::ISplitSpaceController
|
||||
class SplitSpace : public Space, public specter::ISplitSpaceController
|
||||
{
|
||||
friend class ViewManager;
|
||||
std::unique_ptr<Space> m_slots[2];
|
||||
std::unique_ptr<Specter::SplitView> m_splitView;
|
||||
std::unique_ptr<specter::SplitView> m_splitView;
|
||||
struct State : Space::State
|
||||
{
|
||||
DECL_YAML
|
||||
Value<Specter::SplitView::Axis> axis = Specter::SplitView::Axis::Horizontal;
|
||||
Value<specter::SplitView::Axis> axis = specter::SplitView::Axis::Horizontal;
|
||||
Value<float> split = 0.5;
|
||||
} m_state;
|
||||
const Space::State& spaceState() const {return m_state;}
|
||||
|
||||
public:
|
||||
SplitSpace(ViewManager& vm, Space* parent, Specter::SplitView::Axis axis) : Space(vm, Class::SplitSpace, parent)
|
||||
SplitSpace(ViewManager& vm, Space* parent, specter::SplitView::Axis axis) : Space(vm, Class::SplitSpace, parent)
|
||||
{
|
||||
m_state.axis = axis;
|
||||
reloadState();
|
||||
}
|
||||
SplitSpace(ViewManager& vm, Space* parent, ConfigReader& r)
|
||||
: SplitSpace(vm, parent, Specter::SplitView::Axis::Horizontal)
|
||||
: SplitSpace(vm, parent, specter::SplitView::Axis::Horizontal)
|
||||
{
|
||||
m_state.read(r);
|
||||
#ifdef URDE_BINARY_CONFIGS
|
||||
@@ -262,9 +262,9 @@ public:
|
||||
void reloadState()
|
||||
{
|
||||
m_state.split = std::min(1.f, std::max(0.f, m_state.split));
|
||||
if (m_state.axis != Specter::SplitView::Axis::Horizontal &&
|
||||
m_state.axis != Specter::SplitView::Axis::Vertical)
|
||||
m_state.axis = Specter::SplitView::Axis::Horizontal;
|
||||
if (m_state.axis != specter::SplitView::Axis::Horizontal &&
|
||||
m_state.axis != specter::SplitView::Axis::Vertical)
|
||||
m_state.axis = specter::SplitView::Axis::Horizontal;
|
||||
if (m_splitView)
|
||||
{
|
||||
m_splitView->setSplit(m_state.split);
|
||||
@@ -272,7 +272,7 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
void saveState(Athena::io::IStreamWriter& w) const
|
||||
void saveState(athena::io::IStreamWriter& w) const
|
||||
{
|
||||
w.writeUint32Big(atUint32(m_class));
|
||||
m_state.write(w);
|
||||
@@ -289,7 +289,7 @@ public:
|
||||
w.writeUint32Big(0);
|
||||
}
|
||||
|
||||
void saveState(Athena::io::YAMLDocWriter& w) const
|
||||
void saveState(athena::io::YAMLDocWriter& w) const
|
||||
{
|
||||
w.writeUint32("class", atUint32(m_class));
|
||||
m_state.write(w);
|
||||
@@ -311,8 +311,8 @@ public:
|
||||
|
||||
void setChildSlot(unsigned slot, std::unique_ptr<Space>&& space);
|
||||
|
||||
Specter::View* buildSpaceView(Specter::ViewResources& res) {return buildContentView(res);}
|
||||
Specter::View* buildContentView(Specter::ViewResources& res);
|
||||
specter::View* buildSpaceView(specter::ViewResources& res) {return buildContentView(res);}
|
||||
specter::View* buildContentView(specter::ViewResources& res);
|
||||
|
||||
Space* copy(Space* parent) const {return nullptr;}
|
||||
bool spaceSplitAllowed() const {return false;}
|
||||
@@ -330,20 +330,20 @@ public:
|
||||
|
||||
std::unique_ptr<Space> exchangeSpaceSplitJoin(Space* removeSpace, std::unique_ptr<Space>&& keepSpace);
|
||||
|
||||
Specter::SplitView* splitView() {return m_splitView.get();}
|
||||
specter::SplitView* splitView() {return m_splitView.get();}
|
||||
void updateSplit(float split) {m_state.split = split;}
|
||||
void joinViews(Specter::SplitView* thisSplit, int thisSlot, Specter::SplitView* otherSplit, int otherSlot);
|
||||
void joinViews(specter::SplitView* thisSplit, int thisSlot, specter::SplitView* otherSplit, int otherSlot);
|
||||
|
||||
void setAxis(Specter::SplitView::Axis axis)
|
||||
void setAxis(specter::SplitView::Axis axis)
|
||||
{
|
||||
m_state.axis = axis;
|
||||
reloadState();
|
||||
}
|
||||
|
||||
Specter::SplitView::Axis axis() const {return m_state.axis;}
|
||||
specter::SplitView::Axis axis() const {return m_state.axis;}
|
||||
float split() const {return m_state.split;}
|
||||
|
||||
Specter::View* basisView() {return m_splitView.get();}
|
||||
specter::View* basisView() {return m_splitView.get();}
|
||||
};
|
||||
|
||||
class ViewerSpace : public Space
|
||||
@@ -362,17 +362,17 @@ public:
|
||||
|
||||
class TestSpace : public Space
|
||||
{
|
||||
std::unique_ptr<Specter::Button> m_button;
|
||||
std::unique_ptr<Specter::MultiLineTextView> m_textView;
|
||||
std::unique_ptr<specter::Button> m_button;
|
||||
std::unique_ptr<specter::MultiLineTextView> m_textView;
|
||||
|
||||
std::string m_contentStr;
|
||||
std::string m_buttonStr;
|
||||
|
||||
Specter::IButtonBinding* m_binding;
|
||||
specter::IButtonBinding* m_binding;
|
||||
|
||||
public:
|
||||
TestSpace(ViewManager& vm, Space* parent, const std::string& content, const std::string& button,
|
||||
Specter::IButtonBinding* binding)
|
||||
specter::IButtonBinding* binding)
|
||||
: Space(vm, Class::TestSpace, parent), m_contentStr(content), m_buttonStr(button), m_binding(binding)
|
||||
{}
|
||||
|
||||
@@ -383,15 +383,15 @@ public:
|
||||
Space::State& spaceState() {return m_state;}
|
||||
|
||||
bool usesToolbar() const {return true;}
|
||||
void buildToolbarView(Specter::ViewResources& res, Specter::Toolbar& tb)
|
||||
void buildToolbarView(specter::ViewResources& res, specter::Toolbar& tb)
|
||||
{
|
||||
m_button.reset(new Specter::Button(res, tb, m_binding, m_buttonStr));
|
||||
m_button.reset(new specter::Button(res, tb, m_binding, m_buttonStr));
|
||||
tb.push_back(m_button.get(), 0);
|
||||
}
|
||||
|
||||
Specter::View* buildContentView(Specter::ViewResources& res)
|
||||
specter::View* buildContentView(specter::ViewResources& res)
|
||||
{
|
||||
m_textView.reset(new Specter::MultiLineTextView(res, *m_spaceView, res.m_heading14));
|
||||
m_textView.reset(new specter::MultiLineTextView(res, *m_spaceView, res.m_heading14));
|
||||
m_textView->setBackground(res.themeData().viewportBackground());
|
||||
m_textView->typesetGlyphs(m_contentStr, res.themeData().uiText());
|
||||
return m_textView.get();
|
||||
|
||||
@@ -17,9 +17,9 @@ namespace URDE
|
||||
#define LINE_WIDTH 2
|
||||
#define TEXT_MARGIN 10
|
||||
|
||||
SplashScreen::SplashScreen(ViewManager& vm, Specter::ViewResources& res)
|
||||
SplashScreen::SplashScreen(ViewManager& vm, specter::ViewResources& res)
|
||||
: ModalWindow(res, vm.rootView(),
|
||||
Specter::RectangleConstraint(SPLASH_WIDTH * res.pixelFactor(),
|
||||
specter::RectangleConstraint(SPLASH_WIDTH * res.pixelFactor(),
|
||||
SPLASH_HEIGHT * res.pixelFactor())),
|
||||
m_vm(vm),
|
||||
m_textColor(res.themeData().uiText()),
|
||||
@@ -35,7 +35,7 @@ SplashScreen::SplashScreen(ViewManager& vm, Specter::ViewResources& res)
|
||||
GIT_COMMIT_HASH[0] != '\0' &&
|
||||
GIT_BRANCH[0] != '\0')
|
||||
{
|
||||
m_buildInfoStr = HECL::Format("%s: %s\n%s: %s\n%s: %s",
|
||||
m_buildInfoStr = hecl::Format("%s: %s\n%s: %s\n%s: %s",
|
||||
vm.translateOr("branch", "Branch").c_str(), GIT_BRANCH,
|
||||
vm.translateOr("commit", "Commit").c_str(), GIT_COMMIT_HASH,
|
||||
vm.translateOr("date", "Date").c_str(), GIT_COMMIT_DATE);
|
||||
@@ -64,19 +64,19 @@ void SplashScreen::think()
|
||||
|
||||
if (m_newProjBind.m_deferPath.size())
|
||||
{
|
||||
Log.report(LogVisor::Info, _S("Making project '%s'"), m_newProjBind.m_deferPath.c_str());
|
||||
Log.report(logvisor::Info, _S("Making project '%s'"), m_newProjBind.m_deferPath.c_str());
|
||||
m_vm.projectManager().newProject(m_newProjBind.m_deferPath);
|
||||
m_newProjBind.m_deferPath.clear();
|
||||
}
|
||||
else if (m_openProjBind.m_deferPath.size())
|
||||
{
|
||||
Log.report(LogVisor::Info, _S("Opening project '%s'"), m_openProjBind.m_deferPath.c_str());
|
||||
Log.report(logvisor::Info, _S("Opening project '%s'"), m_openProjBind.m_deferPath.c_str());
|
||||
m_vm.projectManager().openProject(m_openProjBind.m_deferPath);
|
||||
m_openProjBind.m_deferPath.clear();
|
||||
}
|
||||
else if (m_extractProjBind.m_deferPath.size())
|
||||
{
|
||||
Log.report(LogVisor::Info, _S("Extracting game '%s'"), m_extractProjBind.m_deferPath.c_str());
|
||||
Log.report(logvisor::Info, _S("Extracting game '%s'"), m_extractProjBind.m_deferPath.c_str());
|
||||
m_vm.projectManager().extractGame(m_extractProjBind.m_deferPath);
|
||||
m_extractProjBind.m_deferPath.clear();
|
||||
}
|
||||
@@ -84,31 +84,31 @@ void SplashScreen::think()
|
||||
|
||||
void SplashScreen::updateContentOpacity(float opacity)
|
||||
{
|
||||
Specter::ViewResources& res = rootView().viewRes();
|
||||
specter::ViewResources& res = rootView().viewRes();
|
||||
|
||||
if (!m_title && res.fontCacheReady())
|
||||
{
|
||||
m_title.reset(new Specter::TextView(res, *this, res.m_titleFont));
|
||||
Zeus::CColor clearColor = res.themeData().uiText();
|
||||
m_title.reset(new specter::TextView(res, *this, res.m_titleFont));
|
||||
zeus::CColor clearColor = res.themeData().uiText();
|
||||
clearColor[3] = 0.0;
|
||||
m_title->typesetGlyphs("URDE", clearColor);
|
||||
|
||||
m_buildInfo.reset(new Specter::MultiLineTextView(res, *this, res.m_mainFont, Specter::TextView::Alignment::Right));
|
||||
m_buildInfo.reset(new specter::MultiLineTextView(res, *this, res.m_mainFont, specter::TextView::Alignment::Right));
|
||||
m_buildInfo->typesetGlyphs(m_buildInfoStr, clearColor);
|
||||
|
||||
m_newButt.m_view.reset(new Specter::Button(res, *this, &m_newProjBind, m_newString,
|
||||
nullptr, Specter::Button::Style::Text));
|
||||
m_openButt.m_view.reset(new Specter::Button(res, *this, &m_openProjBind, m_openString,
|
||||
nullptr, Specter::Button::Style::Text));
|
||||
m_extractButt.m_view.reset(new Specter::Button(res, *this, &m_extractProjBind, m_extractString,
|
||||
nullptr, Specter::Button::Style::Text));
|
||||
m_newButt.m_view.reset(new specter::Button(res, *this, &m_newProjBind, m_newString,
|
||||
nullptr, specter::Button::Style::Text));
|
||||
m_openButt.m_view.reset(new specter::Button(res, *this, &m_openProjBind, m_openString,
|
||||
nullptr, specter::Button::Style::Text));
|
||||
m_extractButt.m_view.reset(new specter::Button(res, *this, &m_extractProjBind, m_extractString,
|
||||
nullptr, specter::Button::Style::Text));
|
||||
|
||||
updateSize();
|
||||
}
|
||||
|
||||
Zeus::CColor clearColor = res.themeData().uiText();
|
||||
zeus::CColor clearColor = res.themeData().uiText();
|
||||
clearColor[3] = 0.0;
|
||||
Zeus::CColor color = Zeus::CColor::lerp(clearColor, res.themeData().uiText(), opacity);
|
||||
zeus::CColor color = zeus::CColor::lerp(clearColor, res.themeData().uiText(), opacity);
|
||||
m_title->colorGlyphs(color);
|
||||
m_buildInfo->colorGlyphs(color);
|
||||
m_newButt.m_view->colorGlyphs(color);
|
||||
|
||||
@@ -1,51 +1,51 @@
|
||||
#ifndef URDE_SPLASH_SCREEN_HPP
|
||||
#define URDE_SPLASH_SCREEN_HPP
|
||||
|
||||
#include <Specter/View.hpp>
|
||||
#include <Specter/ModalWindow.hpp>
|
||||
#include <Specter/MultiLineTextView.hpp>
|
||||
#include <Specter/FileBrowser.hpp>
|
||||
#include <Specter/Menu.hpp>
|
||||
#include <specter/View.hpp>
|
||||
#include <specter/ModalWindow.hpp>
|
||||
#include <specter/MultiLineTextView.hpp>
|
||||
#include <specter/FileBrowser.hpp>
|
||||
#include <specter/Menu.hpp>
|
||||
#include "ViewManager.hpp"
|
||||
|
||||
namespace URDE
|
||||
{
|
||||
static LogVisor::LogModule Log("Specter::SplashScreen");
|
||||
static logvisor::Module Log("specter::SplashScreen");
|
||||
|
||||
class SplashScreen : public Specter::ModalWindow
|
||||
class SplashScreen : public specter::ModalWindow
|
||||
{
|
||||
ViewManager& m_vm;
|
||||
|
||||
Zeus::CColor m_textColor;
|
||||
Zeus::CColor m_textColorClear;
|
||||
zeus::CColor m_textColor;
|
||||
zeus::CColor m_textColorClear;
|
||||
|
||||
std::unique_ptr<Specter::TextView> m_title;
|
||||
std::unique_ptr<specter::TextView> m_title;
|
||||
std::string m_buildInfoStr;
|
||||
std::unique_ptr<Specter::MultiLineTextView> m_buildInfo;
|
||||
std::unique_ptr<specter::MultiLineTextView> m_buildInfo;
|
||||
|
||||
std::string m_newString;
|
||||
Specter::ViewChild<std::unique_ptr<Specter::Button>> m_newButt;
|
||||
specter::ViewChild<std::unique_ptr<specter::Button>> m_newButt;
|
||||
std::string m_openString;
|
||||
Specter::ViewChild<std::unique_ptr<Specter::Button>> m_openButt;
|
||||
specter::ViewChild<std::unique_ptr<specter::Button>> m_openButt;
|
||||
std::string m_extractString;
|
||||
Specter::ViewChild<std::unique_ptr<Specter::Button>> m_extractButt;
|
||||
specter::ViewChild<std::unique_ptr<specter::Button>> m_extractButt;
|
||||
|
||||
Specter::ViewChild<std::unique_ptr<Specter::FileBrowser>> m_fileBrowser;
|
||||
specter::ViewChild<std::unique_ptr<specter::FileBrowser>> m_fileBrowser;
|
||||
|
||||
struct NewProjBinding : Specter::IButtonBinding
|
||||
struct NewProjBinding : specter::IButtonBinding
|
||||
{
|
||||
SplashScreen& m_splash;
|
||||
HECL::SystemString m_deferPath;
|
||||
hecl::SystemString m_deferPath;
|
||||
NewProjBinding(SplashScreen& splash) : m_splash(splash) {}
|
||||
const char* name(const Specter::Control* control) const {return m_splash.m_newString.c_str();}
|
||||
const char* help(const Specter::Control* control) const {return "Creates an empty project at selected path";}
|
||||
void activated(const Specter::Button* button, const boo::SWindowCoord& coord)
|
||||
const char* name(const specter::Control* control) const {return m_splash.m_newString.c_str();}
|
||||
const char* help(const specter::Control* control) const {return "Creates an empty project at selected path";}
|
||||
void activated(const specter::Button* button, const boo::SWindowCoord& coord)
|
||||
{
|
||||
m_splash.m_fileBrowser.m_view.reset(
|
||||
new Specter::FileBrowser(m_splash.rootView().viewRes(),
|
||||
new specter::FileBrowser(m_splash.rootView().viewRes(),
|
||||
m_splash, m_splash.m_newString,
|
||||
Specter::FileBrowser::Type::NewHECLProject,
|
||||
[&](bool ok, const HECL::SystemString& path)
|
||||
specter::FileBrowser::Type::NewHECLProject,
|
||||
[&](bool ok, const hecl::SystemString& path)
|
||||
{
|
||||
if (ok)
|
||||
m_deferPath = path;
|
||||
@@ -55,20 +55,20 @@ class SplashScreen : public Specter::ModalWindow
|
||||
}
|
||||
} m_newProjBind;
|
||||
|
||||
struct OpenProjBinding : Specter::IButtonBinding
|
||||
struct OpenProjBinding : specter::IButtonBinding
|
||||
{
|
||||
SplashScreen& m_splash;
|
||||
HECL::SystemString m_deferPath;
|
||||
hecl::SystemString m_deferPath;
|
||||
OpenProjBinding(SplashScreen& splash) : m_splash(splash), m_openRecentMenuRoot(*this) {}
|
||||
const char* name(const Specter::Control* control) const {return m_splash.m_openString.c_str();}
|
||||
const char* help(const Specter::Control* control) const {return "Opens an existing project at selected path";}
|
||||
void activated(const Specter::Button* button, const boo::SWindowCoord& coord)
|
||||
const char* name(const specter::Control* control) const {return m_splash.m_openString.c_str();}
|
||||
const char* help(const specter::Control* control) const {return "Opens an existing project at selected path";}
|
||||
void activated(const specter::Button* button, const boo::SWindowCoord& coord)
|
||||
{
|
||||
m_splash.m_fileBrowser.m_view.reset(
|
||||
new Specter::FileBrowser(m_splash.rootView().viewRes(),
|
||||
new specter::FileBrowser(m_splash.rootView().viewRes(),
|
||||
m_splash, m_splash.m_openString,
|
||||
Specter::FileBrowser::Type::OpenHECLProject,
|
||||
[&](bool ok, const HECL::SystemString& path)
|
||||
specter::FileBrowser::Type::OpenHECLProject,
|
||||
[&](bool ok, const hecl::SystemString& path)
|
||||
{
|
||||
if (ok)
|
||||
m_deferPath = path;
|
||||
@@ -77,7 +77,7 @@ class SplashScreen : public Specter::ModalWindow
|
||||
m_splash.m_openButt.mouseLeave(coord);
|
||||
}
|
||||
|
||||
struct OpenRecentMenuRoot : Specter::IMenuNode
|
||||
struct OpenRecentMenuRoot : specter::IMenuNode
|
||||
{
|
||||
OpenProjBinding& m_openProjBind;
|
||||
OpenRecentMenuRoot(OpenProjBinding& openProjBind) : m_openProjBind(openProjBind) {}
|
||||
@@ -85,11 +85,11 @@ class SplashScreen : public Specter::ModalWindow
|
||||
std::string m_text;
|
||||
const std::string* text() const {return &m_text;}
|
||||
|
||||
struct OpenRecentMenuItem : Specter::IMenuNode
|
||||
struct OpenRecentMenuItem : specter::IMenuNode
|
||||
{
|
||||
OpenRecentMenuRoot& m_parent;
|
||||
|
||||
HECL::SystemString m_path;
|
||||
hecl::SystemString m_path;
|
||||
std::string m_text;
|
||||
|
||||
const std::string* text() const {return &m_text;}
|
||||
@@ -99,54 +99,54 @@ class SplashScreen : public Specter::ModalWindow
|
||||
m_parent.m_openProjBind.m_splash.m_openButt.m_view->closeMenu(coord);
|
||||
}
|
||||
|
||||
OpenRecentMenuItem(OpenRecentMenuRoot& parent, const HECL::SystemString& path)
|
||||
OpenRecentMenuItem(OpenRecentMenuRoot& parent, const hecl::SystemString& path)
|
||||
: m_parent(parent), m_path(path)
|
||||
{
|
||||
std::vector<HECL::SystemString> pathComps = Specter::FileBrowser::PathComponents(path);
|
||||
std::vector<hecl::SystemString> pathComps = specter::FileBrowser::PathComponents(path);
|
||||
if (pathComps.size())
|
||||
m_text = HECL::SystemUTF8View(pathComps.back()).str();
|
||||
m_text = hecl::SystemUTF8View(pathComps.back()).str();
|
||||
}
|
||||
};
|
||||
std::vector<OpenRecentMenuItem> m_items;
|
||||
|
||||
size_t subNodeCount() const {return m_items.size();}
|
||||
Specter::IMenuNode* subNode(size_t idx) {return &m_items[idx];}
|
||||
specter::IMenuNode* subNode(size_t idx) {return &m_items[idx];}
|
||||
|
||||
void buildNodes(const std::vector<HECL::SystemString>* recentProjects)
|
||||
void buildNodes(const std::vector<hecl::SystemString>* recentProjects)
|
||||
{
|
||||
m_items.clear();
|
||||
if (recentProjects)
|
||||
{
|
||||
m_items.reserve(recentProjects->size());
|
||||
for (const HECL::SystemString& path : *recentProjects)
|
||||
for (const hecl::SystemString& path : *recentProjects)
|
||||
m_items.emplace_back(*this, path);
|
||||
}
|
||||
}
|
||||
} m_openRecentMenuRoot;
|
||||
|
||||
MenuStyle menuStyle(const Specter::Button* button) const {return MenuStyle::Auxiliary;}
|
||||
std::unique_ptr<View> buildMenu(const Specter::Button* button)
|
||||
MenuStyle menuStyle(const specter::Button* button) const {return MenuStyle::Auxiliary;}
|
||||
std::unique_ptr<View> buildMenu(const specter::Button* button)
|
||||
{
|
||||
m_openRecentMenuRoot.buildNodes(m_splash.m_vm.recentProjects());
|
||||
return std::unique_ptr<View>(new Specter::Menu(m_splash.rootView().viewRes(),
|
||||
return std::unique_ptr<View>(new specter::Menu(m_splash.rootView().viewRes(),
|
||||
m_splash, &m_openRecentMenuRoot));
|
||||
}
|
||||
} m_openProjBind;
|
||||
|
||||
struct ExtractProjBinding : Specter::IButtonBinding
|
||||
struct ExtractProjBinding : specter::IButtonBinding
|
||||
{
|
||||
SplashScreen& m_splash;
|
||||
HECL::SystemString m_deferPath;
|
||||
hecl::SystemString m_deferPath;
|
||||
ExtractProjBinding(SplashScreen& splash) : m_splash(splash) {}
|
||||
const char* name(const Specter::Control* control) const {return m_splash.m_extractString.c_str();}
|
||||
const char* help(const Specter::Control* control) const {return "Extracts game image as project at selected path";}
|
||||
void activated(const Specter::Button* button, const boo::SWindowCoord& coord)
|
||||
const char* name(const specter::Control* control) const {return m_splash.m_extractString.c_str();}
|
||||
const char* help(const specter::Control* control) const {return "Extracts game image as project at selected path";}
|
||||
void activated(const specter::Button* button, const boo::SWindowCoord& coord)
|
||||
{
|
||||
m_splash.m_fileBrowser.m_view.reset(
|
||||
new Specter::FileBrowser(m_splash.rootView().viewRes(),
|
||||
new specter::FileBrowser(m_splash.rootView().viewRes(),
|
||||
m_splash, m_splash.m_extractString,
|
||||
Specter::FileBrowser::Type::OpenFile,
|
||||
[&](bool ok, const HECL::SystemString& path)
|
||||
specter::FileBrowser::Type::OpenFile,
|
||||
[&](bool ok, const hecl::SystemString& path)
|
||||
{
|
||||
if (ok)
|
||||
m_deferPath = path;
|
||||
@@ -157,7 +157,7 @@ class SplashScreen : public Specter::ModalWindow
|
||||
} m_extractProjBind;
|
||||
|
||||
public:
|
||||
SplashScreen(ViewManager& vm, Specter::ViewResources& res);
|
||||
SplashScreen(ViewManager& vm, specter::ViewResources& res);
|
||||
void think();
|
||||
void updateContentOpacity(float opacity);
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "ViewManager.hpp"
|
||||
#include "Specter/Control.hpp"
|
||||
#include "Specter/Space.hpp"
|
||||
#include "Specter/Menu.hpp"
|
||||
#include "specter/Control.hpp"
|
||||
#include "specter/Space.hpp"
|
||||
#include "specter/Menu.hpp"
|
||||
#include "SplashScreen.hpp"
|
||||
#include "locale/locale.hpp"
|
||||
#include "ResourceBrowser.hpp"
|
||||
@@ -9,25 +9,25 @@
|
||||
#include "Runtime/Particle/CGenDescription.hpp"
|
||||
#include "Runtime/Particle/CElectricDescription.hpp"
|
||||
#include "Runtime/Particle/CSwooshDescription.hpp"
|
||||
#include "Runtime/CModel.hpp"
|
||||
#include "Runtime/CGraphics.hpp"
|
||||
#include "Runtime/Graphics/CModel.hpp"
|
||||
#include "Runtime/Graphics/CGraphics.hpp"
|
||||
#include <cstdio>
|
||||
|
||||
using YAMLNode = Athena::io::YAMLNode;
|
||||
using YAMLNode = athena::io::YAMLNode;
|
||||
|
||||
namespace URDE
|
||||
{
|
||||
|
||||
void ViewManager::BuildTestPART(pshag::IObjectStore& objStore)
|
||||
void ViewManager::BuildTestPART(urde::IObjectStore& objStore)
|
||||
{
|
||||
//m_partGenDesc = objStore.GetObj({HECL::FOURCC('PART'), 0x972A5CD2});
|
||||
//m_partGenDesc = objStore.GetObj({hecl::FOURCC('PART'), 0x972A5CD2});
|
||||
m_partGenDesc = objStore.GetObj("BusterSparks");
|
||||
m_partGen.reset(new pshag::CElementGen(m_partGenDesc,
|
||||
pshag::CElementGen::EModelOrientationType::Normal,
|
||||
pshag::CElementGen::EOptionalSystemFlags::None));
|
||||
m_partGen.reset(new urde::CElementGen(m_partGenDesc,
|
||||
urde::CElementGen::EModelOrientationType::Normal,
|
||||
urde::CElementGen::EOptionalSystemFlags::None));
|
||||
m_partGen->SetGlobalScale({5.f, 5.f, 5.f});
|
||||
m_particleView.reset(new ParticleView(*this, m_viewResources, *m_rootView));
|
||||
m_lineRenderer.reset(new pshag::CLineRenderer(pshag::CLineRenderer::EPrimitiveMode::LineStrip, 4, nullptr, true));
|
||||
m_lineRenderer.reset(new urde::CLineRenderer(urde::CLineRenderer::EPrimitiveMode::LineStrip, 4, nullptr, true));
|
||||
|
||||
//m_rootView->accessContentViews().clear();
|
||||
m_rootView->accessContentViews().push_back(m_particleView.get());
|
||||
@@ -36,8 +36,8 @@ void ViewManager::BuildTestPART(pshag::IObjectStore& objStore)
|
||||
|
||||
void ViewManager::ParticleView::resized(const boo::SWindowRect& root, const boo::SWindowRect& sub)
|
||||
{
|
||||
Specter::View::resized(root, sub);
|
||||
pshag::CGraphics::SetViewportResolution({sub.size[0], sub.size[1]});
|
||||
specter::View::resized(root, sub);
|
||||
urde::CGraphics::SetViewportResolution({sub.size[0], sub.size[1]});
|
||||
}
|
||||
|
||||
void ViewManager::ParticleView::draw(boo::IGraphicsCommandQueue *gfxQ)
|
||||
@@ -49,35 +49,35 @@ void ViewManager::ParticleView::draw(boo::IGraphicsCommandQueue *gfxQ)
|
||||
if (m_vm.m_partGen->IsSystemDeletable())
|
||||
m_vm.m_partGen->Reset();
|
||||
|
||||
pshag::CGraphics::SetModelMatrix(Zeus::CTransform::Identity());
|
||||
pshag::CGraphics::SetViewPointMatrix(Zeus::CTransform::Identity() + Zeus::CVector3f(0.f, -10.f, 0.f));
|
||||
urde::CGraphics::SetModelMatrix(zeus::CTransform::Identity());
|
||||
urde::CGraphics::SetViewPointMatrix(zeus::CTransform::Identity() + zeus::CVector3f(0.f, -10.f, 0.f));
|
||||
boo::SWindowRect windowRect = m_vm.m_mainWindow->getWindowFrame();
|
||||
float aspect = windowRect.size[0] / float(windowRect.size[1]);
|
||||
pshag::CGraphics::SetPerspective(55.0, aspect, 0.001f, 1000.f);
|
||||
urde::CGraphics::SetPerspective(55.0, aspect, 0.001f, 1000.f);
|
||||
//gfxQ->clearTarget(false, true);
|
||||
m_vm.m_partGen->Render();
|
||||
|
||||
/*
|
||||
m_vm.m_lineRenderer->Reset();
|
||||
m_vm.m_lineRenderer->AddVertex({-0.5f, 0.f, -0.5f}, Zeus::CColor::skBlue, 1.f);
|
||||
m_vm.m_lineRenderer->AddVertex({-0.5f, 0.f, 0.5f}, Zeus::CColor::skBlue, 1.f);
|
||||
m_vm.m_lineRenderer->AddVertex({0.5f, 10.f, 0.5f}, Zeus::CColor::skRed, 3.f);
|
||||
m_vm.m_lineRenderer->AddVertex({0.5f, 0.f, -0.5f}, Zeus::CColor::skBlue, 1.f);
|
||||
m_vm.m_lineRenderer->AddVertex({-0.5f, 0.f, -0.5f}, zeus::CColor::skBlue, 1.f);
|
||||
m_vm.m_lineRenderer->AddVertex({-0.5f, 0.f, 0.5f}, zeus::CColor::skBlue, 1.f);
|
||||
m_vm.m_lineRenderer->AddVertex({0.5f, 10.f, 0.5f}, zeus::CColor::skRed, 3.f);
|
||||
m_vm.m_lineRenderer->AddVertex({0.5f, 0.f, -0.5f}, zeus::CColor::skBlue, 1.f);
|
||||
m_vm.m_lineRenderer->Render();
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
Specter::View* ViewManager::BuildSpaceViews()
|
||||
specter::View* ViewManager::BuildSpaceViews()
|
||||
{
|
||||
m_rootSpaceView = m_rootSpace->buildSpaceView(m_viewResources);
|
||||
return m_rootSpaceView;
|
||||
}
|
||||
|
||||
Specter::RootView* ViewManager::SetupRootView()
|
||||
specter::RootView* ViewManager::SetupRootView()
|
||||
{
|
||||
m_rootView.reset(new Specter::RootView(*this, m_viewResources, m_mainWindow.get()));
|
||||
m_rootView->setBackground(Zeus::CColor::skBlack);
|
||||
m_rootView.reset(new specter::RootView(*this, m_viewResources, m_mainWindow.get()));
|
||||
m_rootView->setBackground(zeus::CColor::skBlack);
|
||||
return m_rootView.get();
|
||||
}
|
||||
|
||||
@@ -89,9 +89,9 @@ SplashScreen* ViewManager::SetupSplashView()
|
||||
return m_splash.get();
|
||||
}
|
||||
|
||||
void ViewManager::RootSpaceViewBuilt(Specter::View *view)
|
||||
void ViewManager::RootSpaceViewBuilt(specter::View *view)
|
||||
{
|
||||
std::vector<Specter::View*>& cViews = m_rootView->accessContentViews();
|
||||
std::vector<specter::View*>& cViews = m_rootView->accessContentViews();
|
||||
cViews.clear();
|
||||
cViews.push_back(view);
|
||||
cViews.push_back(m_splash.get());
|
||||
@@ -102,7 +102,7 @@ void ViewManager::SetupEditorView()
|
||||
{
|
||||
m_rootSpace.reset(new RootSpace(*this));
|
||||
|
||||
SplitSpace* split = new SplitSpace(*this, nullptr, Specter::SplitView::Axis::Horizontal);
|
||||
SplitSpace* split = new SplitSpace(*this, nullptr, specter::SplitView::Axis::Horizontal);
|
||||
m_rootSpace->setChild(std::unique_ptr<Space>(split));
|
||||
split->setChildSlot(0, std::make_unique<ResourceBrowser>(*this, split));
|
||||
split->setChildSlot(1, std::make_unique<ResourceBrowser>(*this, split));
|
||||
@@ -131,39 +131,39 @@ void ViewManager::DismissSplash()
|
||||
m_splash->close();
|
||||
}
|
||||
|
||||
ViewManager::ViewManager(HECL::Runtime::FileStoreManager& fileMgr, HECL::CVarManager& cvarMgr)
|
||||
ViewManager::ViewManager(hecl::Runtime::FileStoreManager& fileMgr, hecl::CVarManager& cvarMgr)
|
||||
: m_fileStoreManager(fileMgr), m_cvarManager(cvarMgr), m_projManager(*this),
|
||||
m_fontCache(fileMgr), m_translator(URDE::SystemLocaleOrEnglish()),
|
||||
m_recentProjectsPath(HECL::SysFormat(_S("%s/recent_projects.txt"), fileMgr.getStoreRoot().c_str())),
|
||||
m_recentFilesPath(HECL::SysFormat(_S("%s/recent_files.txt"), fileMgr.getStoreRoot().c_str()))
|
||||
m_recentProjectsPath(hecl::SysFormat(_S("%s/recent_projects.txt"), fileMgr.getStoreRoot().c_str())),
|
||||
m_recentFilesPath(hecl::SysFormat(_S("%s/recent_files.txt"), fileMgr.getStoreRoot().c_str()))
|
||||
{
|
||||
Space::SpaceMenuNode::InitializeStrings(*this);
|
||||
char path[2048];
|
||||
HECL::Sstat theStat;
|
||||
hecl::Sstat theStat;
|
||||
|
||||
FILE* fp = HECL::Fopen(m_recentProjectsPath.c_str(), _S("r"), HECL::FileLockType::Read);
|
||||
FILE* fp = hecl::Fopen(m_recentProjectsPath.c_str(), _S("r"), hecl::FileLockType::Read);
|
||||
if (fp)
|
||||
{
|
||||
while (fgets(path, 2048, fp))
|
||||
{
|
||||
std::string pathStr(path);
|
||||
pathStr.pop_back();
|
||||
HECL::SystemStringView pathStrView(pathStr);
|
||||
if (!HECL::Stat(pathStrView.c_str(), &theStat) && S_ISDIR(theStat.st_mode))
|
||||
hecl::SystemStringView pathStrView(pathStr);
|
||||
if (!hecl::Stat(pathStrView.c_str(), &theStat) && S_ISDIR(theStat.st_mode))
|
||||
m_recentProjects.push_back(pathStrView);
|
||||
}
|
||||
fclose(fp);
|
||||
}
|
||||
|
||||
fp = HECL::Fopen(m_recentFilesPath.c_str(), _S("r"), HECL::FileLockType::Read);
|
||||
fp = hecl::Fopen(m_recentFilesPath.c_str(), _S("r"), hecl::FileLockType::Read);
|
||||
if (fp)
|
||||
{
|
||||
while (fgets(path, 2048, fp))
|
||||
{
|
||||
std::string pathStr(path);
|
||||
pathStr.pop_back();
|
||||
HECL::SystemStringView pathStrView(pathStr);
|
||||
if (!HECL::Stat(pathStrView.c_str(), &theStat) && S_ISDIR(theStat.st_mode))
|
||||
hecl::SystemStringView pathStrView(pathStr);
|
||||
if (!hecl::Stat(pathStrView.c_str(), &theStat) && S_ISDIR(theStat.st_mode))
|
||||
m_recentFiles.push_back(pathStrView);
|
||||
}
|
||||
fclose(fp);
|
||||
@@ -172,36 +172,36 @@ ViewManager::ViewManager(HECL::Runtime::FileStoreManager& fileMgr, HECL::CVarMan
|
||||
|
||||
ViewManager::~ViewManager() {}
|
||||
|
||||
void ViewManager::pushRecentProject(const HECL::SystemString& path)
|
||||
void ViewManager::pushRecentProject(const hecl::SystemString& path)
|
||||
{
|
||||
for (HECL::SystemString& testPath : m_recentProjects)
|
||||
for (hecl::SystemString& testPath : m_recentProjects)
|
||||
{
|
||||
if (path == testPath)
|
||||
return;
|
||||
}
|
||||
m_recentProjects.push_back(path);
|
||||
FILE* fp = HECL::Fopen(m_recentProjectsPath.c_str(), _S("w"), HECL::FileLockType::Write);
|
||||
FILE* fp = hecl::Fopen(m_recentProjectsPath.c_str(), _S("w"), hecl::FileLockType::Write);
|
||||
if (fp)
|
||||
{
|
||||
for (HECL::SystemString& pPath : m_recentProjects)
|
||||
fprintf(fp, "%s\n", HECL::SystemUTF8View(pPath).c_str());
|
||||
for (hecl::SystemString& pPath : m_recentProjects)
|
||||
fprintf(fp, "%s\n", hecl::SystemUTF8View(pPath).c_str());
|
||||
fclose(fp);
|
||||
}
|
||||
}
|
||||
|
||||
void ViewManager::pushRecentFile(const HECL::SystemString& path)
|
||||
void ViewManager::pushRecentFile(const hecl::SystemString& path)
|
||||
{
|
||||
for (HECL::SystemString& testPath : m_recentFiles)
|
||||
for (hecl::SystemString& testPath : m_recentFiles)
|
||||
{
|
||||
if (path == testPath)
|
||||
return;
|
||||
}
|
||||
m_recentFiles.push_back(path);
|
||||
FILE* fp = HECL::Fopen(m_recentFilesPath.c_str(), _S("w"), HECL::FileLockType::Write);
|
||||
FILE* fp = hecl::Fopen(m_recentFilesPath.c_str(), _S("w"), hecl::FileLockType::Write);
|
||||
if (fp)
|
||||
{
|
||||
for (HECL::SystemString& pPath : m_recentFiles)
|
||||
fprintf(fp, "%s\n", HECL::SystemUTF8View(pPath).c_str());
|
||||
for (hecl::SystemString& pPath : m_recentFiles)
|
||||
fprintf(fp, "%s\n", hecl::SystemUTF8View(pPath).c_str());
|
||||
fclose(fp);
|
||||
}}
|
||||
|
||||
@@ -217,16 +217,16 @@ void ViewManager::init(boo::IApplication* app)
|
||||
m_viewResources.init(gf, &m_fontCache, &m_themeData, pixelFactor);
|
||||
m_iconsToken = InitializeIcons(m_viewResources);
|
||||
m_viewResources.prepFontCacheAsync(m_mainWindow.get());
|
||||
Specter::RootView* root = SetupRootView();
|
||||
specter::RootView* root = SetupRootView();
|
||||
m_showSplash = true;
|
||||
root->accessContentViews().push_back(SetupSplashView());
|
||||
root->updateSize();
|
||||
|
||||
m_mainWindow->setWaitCursor(false);
|
||||
|
||||
pshag::CGraphics::InitializeBoo(gf, m_mainWindow->getCommandQueue(), root->renderTex());
|
||||
pshag::CElementGen::Initialize();
|
||||
pshag::CLineRenderer::Initialize();
|
||||
urde::CGraphics::InitializeBoo(gf, m_mainWindow->getCommandQueue(), root->renderTex());
|
||||
urde::CElementGen::Initialize();
|
||||
urde::CLineRenderer::Initialize();
|
||||
}
|
||||
|
||||
bool ViewManager::proc()
|
||||
@@ -238,12 +238,12 @@ bool ViewManager::proc()
|
||||
if (m_updatePf)
|
||||
{
|
||||
m_viewResources.resetPixelFactor(m_reqPf);
|
||||
Specter::RootView* root = SetupRootView();
|
||||
specter::RootView* root = SetupRootView();
|
||||
if (m_rootSpace)
|
||||
BuildSpaceViews();
|
||||
else
|
||||
{
|
||||
std::vector<Specter::View*>& cViews = m_rootView->accessContentViews();
|
||||
std::vector<specter::View*>& cViews = m_rootView->accessContentViews();
|
||||
cViews.push_back(SetupSplashView());
|
||||
}
|
||||
root->updateSize();
|
||||
@@ -266,7 +266,7 @@ bool ViewManager::proc()
|
||||
|
||||
++m_editorFrames;
|
||||
if (m_rootSpaceView && m_editorFrames <= 30)
|
||||
m_rootSpaceView->setMultiplyColor(Zeus::CColor::lerp({1,1,1,0}, {1,1,1,1}, m_editorFrames / 30.0));
|
||||
m_rootSpaceView->setMultiplyColor(zeus::CColor::lerp({1,1,1,0}, {1,1,1,1}, m_editorFrames / 30.0));
|
||||
|
||||
m_rootView->draw(gfxQ);
|
||||
gfxQ->execute();
|
||||
@@ -277,8 +277,8 @@ bool ViewManager::proc()
|
||||
|
||||
void ViewManager::stop()
|
||||
{
|
||||
pshag::CElementGen::Shutdown();
|
||||
pshag::CLineRenderer::Shutdown();
|
||||
urde::CElementGen::Shutdown();
|
||||
urde::CLineRenderer::Shutdown();
|
||||
m_iconsToken.doDestroy();
|
||||
m_viewResources.destroyResData();
|
||||
m_fontCache.destroyAtlases();
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#ifndef URDE_VIEW_MANAGER_HPP
|
||||
#define URDE_VIEW_MANAGER_HPP
|
||||
|
||||
#include <HECL/CVarManager.hpp>
|
||||
#include <hecl/CVarManager.hpp>
|
||||
#include "ProjectManager.hpp"
|
||||
#include "Space.hpp"
|
||||
|
||||
@@ -12,54 +12,54 @@ namespace URDE
|
||||
{
|
||||
class SplashScreen;
|
||||
|
||||
class ViewManager : public Specter::IViewManager
|
||||
class ViewManager : public specter::IViewManager
|
||||
{
|
||||
friend class ProjectManager;
|
||||
friend class Space;
|
||||
friend class RootSpace;
|
||||
friend class SplitSpace;
|
||||
|
||||
HECL::Runtime::FileStoreManager& m_fileStoreManager;
|
||||
HECL::CVarManager& m_cvarManager;
|
||||
hecl::Runtime::FileStoreManager& m_fileStoreManager;
|
||||
hecl::CVarManager& m_cvarManager;
|
||||
ProjectManager m_projManager;
|
||||
Specter::FontCache m_fontCache;
|
||||
Specter::DefaultThemeData m_themeData;
|
||||
Specter::ViewResources m_viewResources;
|
||||
specter::FontCache m_fontCache;
|
||||
specter::DefaultThemeData m_themeData;
|
||||
specter::ViewResources m_viewResources;
|
||||
boo::GraphicsDataToken m_iconsToken;
|
||||
Specter::Translator m_translator;
|
||||
specter::Translator m_translator;
|
||||
std::unique_ptr<boo::IWindow> m_mainWindow;
|
||||
|
||||
std::unique_ptr<Specter::RootView> m_rootView;
|
||||
std::unique_ptr<specter::RootView> m_rootView;
|
||||
std::unique_ptr<SplashScreen> m_splash;
|
||||
std::unique_ptr<RootSpace> m_rootSpace;
|
||||
Specter::View* m_rootSpaceView = nullptr;
|
||||
specter::View* m_rootSpaceView = nullptr;
|
||||
|
||||
class ParticleView : public Specter::View
|
||||
class ParticleView : public specter::View
|
||||
{
|
||||
ViewManager& m_vm;
|
||||
public:
|
||||
ParticleView(ViewManager& vm, Specter::ViewResources& res, Specter::View& parent)
|
||||
ParticleView(ViewManager& vm, specter::ViewResources& res, specter::View& parent)
|
||||
: View(res, parent), m_vm(vm) {}
|
||||
void resized(const boo::SWindowRect& root, const boo::SWindowRect& sub);
|
||||
void draw(boo::IGraphicsCommandQueue* gfxQ);
|
||||
};
|
||||
std::unique_ptr<ParticleView> m_particleView;
|
||||
pshag::TLockedToken<pshag::CGenDescription> m_partGenDesc;
|
||||
std::unique_ptr<pshag::CElementGen> m_partGen;
|
||||
std::unique_ptr<pshag::CLineRenderer> m_lineRenderer;
|
||||
urde::TLockedToken<urde::CGenDescription> m_partGenDesc;
|
||||
std::unique_ptr<urde::CElementGen> m_partGen;
|
||||
std::unique_ptr<urde::CLineRenderer> m_lineRenderer;
|
||||
|
||||
HECL::SystemString m_recentProjectsPath;
|
||||
std::vector<HECL::SystemString> m_recentProjects;
|
||||
HECL::SystemString m_recentFilesPath;
|
||||
std::vector<HECL::SystemString> m_recentFiles;
|
||||
hecl::SystemString m_recentProjectsPath;
|
||||
std::vector<hecl::SystemString> m_recentProjects;
|
||||
hecl::SystemString m_recentFilesPath;
|
||||
std::vector<hecl::SystemString> m_recentFiles;
|
||||
|
||||
bool m_updatePf = false;
|
||||
float m_reqPf;
|
||||
|
||||
Specter::View* BuildSpaceViews();
|
||||
Specter::RootView* SetupRootView();
|
||||
specter::View* BuildSpaceViews();
|
||||
specter::RootView* SetupRootView();
|
||||
SplashScreen* SetupSplashView();
|
||||
void RootSpaceViewBuilt(Specter::View* view);
|
||||
void RootSpaceViewBuilt(specter::View* view);
|
||||
void SetupEditorView();
|
||||
void SetupEditorView(ConfigReader& r);
|
||||
void SaveEditorView(ConfigWriter& w);
|
||||
@@ -70,18 +70,18 @@ class ViewManager : public Specter::IViewManager
|
||||
unsigned m_editorFrames = 120;
|
||||
void FadeInEditors() {m_editorFrames = 0;}
|
||||
|
||||
void BuildTestPART(pshag::IObjectStore& objStore);
|
||||
void BuildTestPART(urde::IObjectStore& objStore);
|
||||
|
||||
Space* m_deferSplit = nullptr;
|
||||
Specter::SplitView::Axis m_deferSplitAxis;
|
||||
specter::SplitView::Axis m_deferSplitAxis;
|
||||
int m_deferSplitThisSlot;
|
||||
boo::SWindowCoord m_deferSplitCoord;
|
||||
|
||||
public:
|
||||
ViewManager(HECL::Runtime::FileStoreManager& fileMgr, HECL::CVarManager& cvarMgr);
|
||||
ViewManager(hecl::Runtime::FileStoreManager& fileMgr, hecl::CVarManager& cvarMgr);
|
||||
~ViewManager();
|
||||
|
||||
Specter::RootView& rootView() const {return *m_rootView;}
|
||||
specter::RootView& rootView() const {return *m_rootView;}
|
||||
void requestPixelFactor(float pf)
|
||||
{
|
||||
m_reqPf = pf;
|
||||
@@ -89,10 +89,10 @@ public:
|
||||
}
|
||||
|
||||
ProjectManager& projectManager() {return m_projManager;}
|
||||
HECL::Database::Project* project() {return m_projManager.project();}
|
||||
const Specter::Translator* getTranslator() const {return &m_translator;}
|
||||
hecl::Database::Project* project() {return m_projManager.project();}
|
||||
const specter::Translator* getTranslator() const {return &m_translator;}
|
||||
|
||||
void deferSpaceSplit(Specter::ISpaceController* split, Specter::SplitView::Axis axis, int thisSlot,
|
||||
void deferSpaceSplit(specter::ISpaceController* split, specter::SplitView::Axis axis, int thisSlot,
|
||||
const boo::SWindowCoord& coord)
|
||||
{
|
||||
m_deferSplit = static_cast<Space*>(split);
|
||||
@@ -101,11 +101,11 @@ public:
|
||||
m_deferSplitCoord = coord;
|
||||
}
|
||||
|
||||
const std::vector<HECL::SystemString>* recentProjects() const {return &m_recentProjects;}
|
||||
void pushRecentProject(const HECL::SystemString& path);
|
||||
const std::vector<hecl::SystemString>* recentProjects() const {return &m_recentProjects;}
|
||||
void pushRecentProject(const hecl::SystemString& path);
|
||||
|
||||
const std::vector<HECL::SystemString>* recentFiles() const {return &m_recentFiles;}
|
||||
void pushRecentFile(const HECL::SystemString& path);
|
||||
const std::vector<hecl::SystemString>* recentFiles() const {return &m_recentFiles;}
|
||||
void pushRecentFile(const hecl::SystemString& path);
|
||||
|
||||
void init(boo::IApplication* app);
|
||||
bool proc();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include "icons.hpp"
|
||||
#include "Athena/MemoryReader.hpp"
|
||||
#include "athena/MemoryReader.hpp"
|
||||
#include <zlib.h>
|
||||
|
||||
extern "C" uint8_t URDE_ICONS[];
|
||||
@@ -7,16 +7,16 @@ extern "C" size_t URDE_ICONS_SZ;
|
||||
|
||||
namespace URDE
|
||||
{
|
||||
static LogVisor::LogModule Log("URDE::icons");
|
||||
static logvisor::Module Log("URDE::icons");
|
||||
|
||||
Specter::IconAtlas<8,8> g_IconAtlas;
|
||||
specter::IconAtlas<8,8> g_IconAtlas;
|
||||
|
||||
boo::GraphicsDataToken InitializeIcons(Specter::ViewResources& viewRes)
|
||||
boo::GraphicsDataToken InitializeIcons(specter::ViewResources& viewRes)
|
||||
{
|
||||
Athena::io::MemoryReader r(URDE_ICONS, URDE_ICONS_SZ);
|
||||
athena::io::MemoryReader r(URDE_ICONS, URDE_ICONS_SZ);
|
||||
size_t fmt = r.readUint32Big();
|
||||
if (fmt != 16)
|
||||
Log.report(LogVisor::FatalError, "incorrect icon texture format");
|
||||
Log.report(logvisor::Fatal, "incorrect icon texture format");
|
||||
size_t width = r.readUint16Big();
|
||||
size_t height = r.readUint16Big();
|
||||
size_t mips = r.readUint32Big();
|
||||
@@ -26,14 +26,14 @@ boo::GraphicsDataToken InitializeIcons(Specter::ViewResources& viewRes)
|
||||
uLongf destSz = decompSz;
|
||||
size_t pos = r.position();
|
||||
if (uncompress(texels.get(), &destSz, URDE_ICONS + pos, URDE_ICONS_SZ - pos) != Z_OK)
|
||||
Log.report(LogVisor::FatalError, "unable to decompress icons");
|
||||
Log.report(logvisor::Fatal, "unable to decompress icons");
|
||||
|
||||
g_IconAtlas.initializeAtlas(viewRes.m_factory->newStaticTexture(width, height, mips, boo::TextureFormat::RGBA8,
|
||||
texels.get(), destSz));
|
||||
return viewRes.m_factory->commit();
|
||||
}
|
||||
|
||||
Specter::Icon& GetIcon(SpaceIcon icon)
|
||||
specter::Icon& GetIcon(SpaceIcon icon)
|
||||
{
|
||||
switch (icon)
|
||||
{
|
||||
@@ -50,7 +50,7 @@ Specter::Icon& GetIcon(SpaceIcon icon)
|
||||
}
|
||||
}
|
||||
|
||||
Specter::Icon& GetIcon(MonoIcon icon)
|
||||
specter::Icon& GetIcon(MonoIcon icon)
|
||||
{
|
||||
switch (icon)
|
||||
{
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
#ifndef URDE_ICONS_HPP
|
||||
#define URDE_ICONS_HPP
|
||||
|
||||
#include "Specter/Icon.hpp"
|
||||
#include "Specter/ViewResources.hpp"
|
||||
#include "specter/Icon.hpp"
|
||||
#include "specter/ViewResources.hpp"
|
||||
|
||||
namespace URDE
|
||||
{
|
||||
boo::GraphicsDataToken InitializeIcons(Specter::ViewResources& viewRes);
|
||||
boo::GraphicsDataToken InitializeIcons(specter::ViewResources& viewRes);
|
||||
|
||||
enum class SpaceIcon
|
||||
{
|
||||
@@ -16,7 +16,7 @@ enum class SpaceIcon
|
||||
ModelViewer,
|
||||
InformationCenter
|
||||
};
|
||||
Specter::Icon& GetIcon(SpaceIcon icon);
|
||||
specter::Icon& GetIcon(SpaceIcon icon);
|
||||
|
||||
enum class MonoIcon
|
||||
{
|
||||
@@ -37,7 +37,7 @@ enum class MonoIcon
|
||||
Folder,
|
||||
Info
|
||||
};
|
||||
Specter::Icon& GetIcon(MonoIcon icon);
|
||||
specter::Icon& GetIcon(MonoIcon icon);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ extern "C" size_t L_ja_JP_SZ;
|
||||
namespace URDE
|
||||
{
|
||||
|
||||
static const Specter::Locale Locales[] =
|
||||
static const specter::Locale Locales[] =
|
||||
{
|
||||
{"en_US", "US English", L_en_US, L_en_US_SZ},
|
||||
{"en_GB", "British English", L_en_GB, L_en_GB_SZ},
|
||||
@@ -29,32 +29,32 @@ std::vector<std::pair<const std::string*, const std::string*>> ListLocales()
|
||||
ret.reserve(localeCount);
|
||||
for (size_t i=0 ; i<localeCount ; ++i)
|
||||
{
|
||||
const Specter::Locale& l = Locales[i];
|
||||
const specter::Locale& l = Locales[i];
|
||||
ret.emplace_back(&l.name(), &l.fullName());
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
const Specter::Locale* LookupLocale(const std::string& name)
|
||||
const specter::Locale* LookupLocale(const std::string& name)
|
||||
{
|
||||
constexpr size_t localeCount = std::extent<decltype(Locales)>::value;
|
||||
for (size_t i=0 ; i<localeCount ; ++i)
|
||||
{
|
||||
const Specter::Locale& l = Locales[i];
|
||||
const specter::Locale& l = Locales[i];
|
||||
if (!name.compare(l.name()))
|
||||
return &l;
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const Specter::Locale* SystemLocaleOrEnglish()
|
||||
const specter::Locale* SystemLocaleOrEnglish()
|
||||
{
|
||||
const char* sysLocale = std::setlocale(LC_ALL, nullptr);
|
||||
size_t sysLocaleLen = std::strlen(sysLocale);
|
||||
constexpr size_t localeCount = std::extent<decltype(Locales)>::value;
|
||||
for (size_t i=0 ; i<localeCount ; ++i)
|
||||
{
|
||||
const Specter::Locale& l = Locales[i];
|
||||
const specter::Locale& l = Locales[i];
|
||||
if (!l.name().compare(0, std::min(l.name().size(), sysLocaleLen), sysLocale))
|
||||
return &l;
|
||||
}
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
#ifndef URDE_LOCALE_HPP
|
||||
#define URDE_LOCALE_HPP
|
||||
|
||||
#include <Specter/Translator.hpp>
|
||||
#include <specter/Translator.hpp>
|
||||
|
||||
namespace URDE
|
||||
{
|
||||
|
||||
std::vector<std::pair<const std::string*, const std::string*>> ListLocales();
|
||||
const Specter::Locale* LookupLocale(const std::string& name);
|
||||
const Specter::Locale* SystemLocaleOrEnglish();
|
||||
const specter::Locale* LookupLocale(const std::string& name);
|
||||
const specter::Locale* SystemLocaleOrEnglish();
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
#include <LogVisor/LogVisor.hpp>
|
||||
#include <boo/boo.hpp>
|
||||
#include <Specter/Specter.hpp>
|
||||
#include <HECL/CVarManager.hpp>
|
||||
#include <Runtime/CGameAllocator.hpp>
|
||||
#include "logvisor/logvisor.hpp"
|
||||
#include "boo/boo.hpp"
|
||||
#include "specter/specter.hpp"
|
||||
#include "hecl/CVarManager.hpp"
|
||||
#include "Runtime/CGameAllocator.hpp"
|
||||
#include <functional>
|
||||
#include "ViewManager.hpp"
|
||||
#include <Runtime/Particle/CElementGen.hpp>
|
||||
#include "Runtime/Particle/CElementGen.hpp"
|
||||
|
||||
namespace URDE
|
||||
{
|
||||
LogVisor::LogModule Log{"URDE"};
|
||||
logvisor::Module Log{"URDE"};
|
||||
|
||||
struct Application : boo::IApplicationCallback
|
||||
{
|
||||
HECL::Runtime::FileStoreManager m_fileMgr;
|
||||
HECL::CVarManager m_cvarManager;
|
||||
hecl::Runtime::FileStoreManager m_fileMgr;
|
||||
hecl::CVarManager m_cvarManager;
|
||||
std::unique_ptr<ViewManager> m_viewManager;
|
||||
|
||||
bool m_running = true;
|
||||
@@ -51,12 +51,12 @@ struct Application : boo::IApplicationCallback
|
||||
|
||||
void initialize(boo::IApplication* app)
|
||||
{
|
||||
Zeus::detectCPU();
|
||||
zeus::detectCPU();
|
||||
|
||||
const Zeus::CPUInfo& cpuInf = Zeus::cpuFeatures();
|
||||
Log.report(LogVisor::Info, "CPU Name: %s", cpuInf.cpuBrand);
|
||||
Log.report(LogVisor::Info, "CPU Vendor: %s", cpuInf.cpuVendor);
|
||||
HECL::SystemString features;
|
||||
const zeus::CPUInfo& cpuInf = zeus::cpuFeatures();
|
||||
Log.report(logvisor::Info, "CPU Name: %s", cpuInf.cpuBrand);
|
||||
Log.report(logvisor::Info, "CPU Vendor: %s", cpuInf.cpuVendor);
|
||||
hecl::SystemString features;
|
||||
if (cpuInf.AESNI)
|
||||
features += _S("AES-NI");
|
||||
if (cpuInf.SSE1)
|
||||
@@ -68,14 +68,14 @@ struct Application : boo::IApplicationCallback
|
||||
}
|
||||
else
|
||||
{
|
||||
Log.report(LogVisor::FatalError, _S("URDE requires SSE1 minimum"));
|
||||
Log.report(logvisor::Fatal, _S("URDE requires SSE1 minimum"));
|
||||
return;
|
||||
}
|
||||
if (cpuInf.SSE2)
|
||||
features += _S(", SSE2");
|
||||
else
|
||||
{
|
||||
Log.report(LogVisor::FatalError, _S("URDE requires SSE2 minimum"));
|
||||
Log.report(logvisor::Fatal, _S("URDE requires SSE2 minimum"));
|
||||
return;
|
||||
}
|
||||
if (cpuInf.SSE3)
|
||||
@@ -88,7 +88,7 @@ struct Application : boo::IApplicationCallback
|
||||
features += _S(", SSE4.1");
|
||||
if (cpuInf.SSE42)
|
||||
features += _S(", SSE4.2");
|
||||
Log.report(LogVisor::Info, _S("CPU Features: %s"), features.c_str());
|
||||
Log.report(logvisor::Info, _S("CPU Features: %s"), features.c_str());
|
||||
}
|
||||
};
|
||||
|
||||
@@ -100,7 +100,7 @@ int wmain(int argc, const boo::SystemChar** argv)
|
||||
int main(int argc, const boo::SystemChar** argv)
|
||||
#endif
|
||||
{
|
||||
LogVisor::RegisterConsoleLogger();
|
||||
logvisor::RegisterConsoleLogger();
|
||||
URDE::Application appCb;
|
||||
int ret = boo::ApplicationRun(boo::IApplication::EPlatformType::Auto,
|
||||
appCb, _S("urde"), _S("URDE"), argc, argv, false);
|
||||
@@ -120,7 +120,7 @@ int APIENTRY wWinMain(HINSTANCE hInstance, HINSTANCE, LPWSTR lpCmdLine, int)
|
||||
for (int i=0 ; i<argc ; ++i)
|
||||
booArgv[i+1] = argv[i];
|
||||
|
||||
LogVisor::CreateWin32Console();
|
||||
logvisor::CreateWin32Console();
|
||||
return wmain(argc+1, booArgv);
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user