Template asset build system; More version stuff
This commit is contained in:
parent
d1f17e136c
commit
2bc28afedd
@ -72,7 +72,7 @@
|
|||||||
</Link>
|
</Link>
|
||||||
<PostBuildEvent>
|
<PostBuildEvent>
|
||||||
<Command>cd assets
|
<Command>cd assets
|
||||||
"$(SolutionDir)NFAssetBuilder\bin\x64$(Configuration)\NFAssetBuilder.exe"
|
"$(SolutionDir)NFAssetBuilder\bin\x64Release\NFAssetBuilder.exe"
|
||||||
if exist "$(OutDir)assets" (rmdir "$(OutDir)assets" /S /Q && goto end) else goto end
|
if exist "$(OutDir)assets" (rmdir "$(OutDir)assets" /S /Q && goto end) else goto end
|
||||||
:end
|
:end
|
||||||
mkdir "$(OutDir)assets"
|
mkdir "$(OutDir)assets"
|
||||||
@ -105,7 +105,7 @@ if exist "base.nfpack" (copy "base.nfpack" "$(OutDir)assets\")</Command>
|
|||||||
</Link>
|
</Link>
|
||||||
<PostBuildEvent>
|
<PostBuildEvent>
|
||||||
<Command>cd assets
|
<Command>cd assets
|
||||||
"$(SolutionDir)NFAssetBuilder\bin\x64$(Configuration)\NFAssetBuilder.exe"
|
"$(SolutionDir)NFAssetBuilder\bin\x64Release\NFAssetBuilder.exe"
|
||||||
if exist "$(OutDir)assets" (rmdir "$(OutDir)assets" /S /Q && goto end) else goto end
|
if exist "$(OutDir)assets" (rmdir "$(OutDir)assets" /S /Q && goto end) else goto end
|
||||||
:end
|
:end
|
||||||
mkdir "$(OutDir)assets"
|
mkdir "$(OutDir)assets"
|
||||||
|
@ -81,7 +81,7 @@
|
|||||||
<PostBuildEvent />
|
<PostBuildEvent />
|
||||||
<PostBuildEvent>
|
<PostBuildEvent>
|
||||||
<Command>cd assets
|
<Command>cd assets
|
||||||
"$(SolutionDir)NFAssetBuilder\bin\x64$(Configuration)\NFAssetBuilder.exe"</Command>
|
"$(SolutionDir)NFAssetBuilder\bin\x64Release\NFAssetBuilder.exe"</Command>
|
||||||
</PostBuildEvent>
|
</PostBuildEvent>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
@ -116,7 +116,7 @@
|
|||||||
<PostBuildEvent />
|
<PostBuildEvent />
|
||||||
<PostBuildEvent>
|
<PostBuildEvent>
|
||||||
<Command>cd assets
|
<Command>cd assets
|
||||||
"$(SolutionDir)NFAssetBuilder\bin\x64$(Configuration)\NFAssetBuilder.exe"</Command>
|
"$(SolutionDir)NFAssetBuilder\bin\x64Release\NFAssetBuilder.exe"</Command>
|
||||||
</PostBuildEvent>
|
</PostBuildEvent>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
@ -83,6 +83,7 @@ namespace nf {
|
|||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
Debug::startTimer();
|
Debug::startTimer();
|
||||||
SetThreadDescription(GetCurrentThread(), L"Input Thread");
|
SetThreadDescription(GetCurrentThread(), L"Input Thread");
|
||||||
|
SetConsoleTitle(toWide("Nothin' Fancy v" + (std::string)NFVERSION).data());
|
||||||
#endif
|
#endif
|
||||||
if (m_defaultState.empty())
|
if (m_defaultState.empty())
|
||||||
NFError("No default gamestate has been set!");
|
NFError("No default gamestate has been set!");
|
||||||
|
@ -45,9 +45,11 @@ namespace nf {
|
|||||||
}
|
}
|
||||||
|
|
||||||
AssetPack::AssetPack() :
|
AssetPack::AssetPack() :
|
||||||
|
m_member(false),
|
||||||
m_loaded(false)
|
m_loaded(false)
|
||||||
{
|
{
|
||||||
|
if (!Application::getApp() || !Application::getApp()->getCurrentState())
|
||||||
|
m_member = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AssetPack::load(const char* packName) {
|
void AssetPack::load(const char* packName) {
|
||||||
@ -255,10 +257,9 @@ namespace nf {
|
|||||||
}
|
}
|
||||||
|
|
||||||
m_loaded = true;
|
m_loaded = true;
|
||||||
if (packName != "base.nfpack") {
|
if (packName != "base.nfpack")
|
||||||
if (!Application::getApp()->getCurrentState()->isRunning())
|
if (Application::getApp()->getCurrentState()->isLoading() && m_member)
|
||||||
Application::getApp()->getCurrentState()->m_nfObjects.push_back(this);
|
Application::getApp()->getCurrentState()->m_nfObjects.push_back(this);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AssetPack::isLoaded() {
|
bool AssetPack::isLoaded() {
|
||||||
|
@ -9,8 +9,8 @@ namespace nf {
|
|||||||
m_scale = 2.0;
|
m_scale = 2.0;
|
||||||
m_logoTex.create(BaseAssets::logo, Vec2(0.0, 0.0));
|
m_logoTex.create(BaseAssets::logo, Vec2(0.0, 0.0));
|
||||||
m_logoTex.centered(true, true);
|
m_logoTex.centered(true, true);
|
||||||
m_text.create("(c) Grayson Riffe 2021 | graysonriffe.com", Vec2(0.01f, 0.025f), Vec3(0.8f));
|
m_verText.create("v" + (std::string)NFVERSION, Vec2(0.01f, 0.075f), Vec3(0.8f), 0.6f);
|
||||||
m_text.setScale(0.6f);
|
m_text.create("(c) Grayson Riffe 2021 | graysonriffe.com", Vec2(0.01f, 0.025f), Vec3(0.8f), 0.6f);
|
||||||
m_start = std::chrono::steady_clock::now();
|
m_start = std::chrono::steady_clock::now();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -32,6 +32,7 @@ namespace nf {
|
|||||||
|
|
||||||
void IntroGamestate::render(Renderer& renderer) {
|
void IntroGamestate::render(Renderer& renderer) {
|
||||||
renderer.render(m_logoTex);
|
renderer.render(m_logoTex);
|
||||||
|
renderer.render(m_verText);
|
||||||
renderer.render(m_text);
|
renderer.render(m_text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -149,6 +149,7 @@ namespace nf {
|
|||||||
void destroy() override;
|
void destroy() override;
|
||||||
~AssetPack();
|
~AssetPack();
|
||||||
private:
|
private:
|
||||||
|
bool m_member;
|
||||||
bool m_loaded;
|
bool m_loaded;
|
||||||
std::unordered_map<std::string, Asset*> m_assets;
|
std::unordered_map<std::string, Asset*> m_assets;
|
||||||
};
|
};
|
||||||
|
@ -17,6 +17,7 @@ namespace nf {
|
|||||||
std::chrono::steady_clock::time_point m_start;
|
std::chrono::steady_clock::time_point m_start;
|
||||||
float m_scale;
|
float m_scale;
|
||||||
UITexture m_logoTex;
|
UITexture m_logoTex;
|
||||||
|
Text m_verText;
|
||||||
Text m_text;
|
Text m_text;
|
||||||
};
|
};
|
||||||
}
|
}
|
@ -26,8 +26,8 @@ Global
|
|||||||
{B7FEC2D6-1D8F-487E-89CB-FD611FD1AEB6}.Debug|x64.Build.0 = Debug|x64
|
{B7FEC2D6-1D8F-487E-89CB-FD611FD1AEB6}.Debug|x64.Build.0 = Debug|x64
|
||||||
{B7FEC2D6-1D8F-487E-89CB-FD611FD1AEB6}.Release|x64.ActiveCfg = Release|x64
|
{B7FEC2D6-1D8F-487E-89CB-FD611FD1AEB6}.Release|x64.ActiveCfg = Release|x64
|
||||||
{B7FEC2D6-1D8F-487E-89CB-FD611FD1AEB6}.Release|x64.Build.0 = Release|x64
|
{B7FEC2D6-1D8F-487E-89CB-FD611FD1AEB6}.Release|x64.Build.0 = Release|x64
|
||||||
{771B4AEE-E2C6-4745-AC40-1EF57149612E}.Debug|x64.ActiveCfg = Debug|x64
|
{771B4AEE-E2C6-4745-AC40-1EF57149612E}.Debug|x64.ActiveCfg = Release|x64
|
||||||
{771B4AEE-E2C6-4745-AC40-1EF57149612E}.Debug|x64.Build.0 = Debug|x64
|
{771B4AEE-E2C6-4745-AC40-1EF57149612E}.Debug|x64.Build.0 = Release|x64
|
||||||
{771B4AEE-E2C6-4745-AC40-1EF57149612E}.Release|x64.ActiveCfg = Release|x64
|
{771B4AEE-E2C6-4745-AC40-1EF57149612E}.Release|x64.ActiveCfg = Release|x64
|
||||||
{771B4AEE-E2C6-4745-AC40-1EF57149612E}.Release|x64.Build.0 = Release|x64
|
{771B4AEE-E2C6-4745-AC40-1EF57149612E}.Release|x64.Build.0 = Release|x64
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
|
@ -52,14 +52,12 @@ as shown below.
|
|||||||
|
|
||||||
@image html blankproject.png "The template opened in Visual Studio" width=70%
|
@image html blankproject.png "The template opened in Visual Studio" width=70%
|
||||||
|
|
||||||
To build the project, go to Build -> Build Solution or Build Project. Both do the same thing
|
To build the project, go to Build -> Build Solution or Build Project, which will not build
|
||||||
since there's only one project in the solution initially. You could also hit the default
|
your assets. You can also also hit the default keyboard shortcut of `Ctrl-Shift-B` to build
|
||||||
keyboard shortcut of `Ctrl-Shift-B`.
|
both your app and assets at once.
|
||||||
|
|
||||||
@note After your application is built, your assets are also built and placed into
|
@note When the "Build Assets" project is built, the resulting NFPacks are moved to
|
||||||
the output `assets` directory. As your project grows, this could take longer and longer,
|
the output `assets` directory next to your .exe for you.
|
||||||
so this can be disabled in the project properties dialog under Build Events -> Post-Build Event.
|
|
||||||
Change "Use In Build" to "No" and save.
|
|
||||||
|
|
||||||
NF is a **statically-linked** library. This means that your build will not
|
NF is a **statically-linked** library. This means that your build will not
|
||||||
rely on any external dlls other than the MSVC redistributable.
|
rely on any external dlls other than the MSVC redistributable.
|
Reference in New Issue
Block a user