Added the example application; Added the default window icon
This commit is contained in:
1 parent
805a1cef1f
commit
30e725b2f4
13 files changed
+244
-4
No files matched your search
+110
@@ -0,0 +1,110 @@
|
||||
// Microsoft Visual C++ generated resource script.
|
||||
//
|
||||
#include "resource.h"
|
||||
|
||||
#define APSTUDIO_READONLY_SYMBOLS
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 2 resource.
|
||||
//
|
||||
#include "winres.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#undef APSTUDIO_READONLY_SYMBOLS
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// English (United States) resources
|
||||
|
||||
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
|
||||
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||
#pragma code_page(1252)
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// TEXTINCLUDE
|
||||
//
|
||||
|
||||
1 TEXTINCLUDE
|
||||
BEGIN
|
||||
"resource.h\0"
|
||||
END
|
||||
|
||||
2 TEXTINCLUDE
|
||||
BEGIN
|
||||
"#include ""winres.h""\r\n"
|
||||
"\0"
|
||||
END
|
||||
|
||||
3 TEXTINCLUDE
|
||||
BEGIN
|
||||
"\r\n"
|
||||
"\0"
|
||||
END
|
||||
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Icon
|
||||
//
|
||||
|
||||
// Icon with lowest ID value placed first to ensure application icon
|
||||
// remains consistent on all systems.
|
||||
IDI_ICON1 ICON "res\\icons\\exeicon.ico"
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Version
|
||||
//
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 1,0,0,0
|
||||
PRODUCTVERSION 1,0,0,1
|
||||
FILEFLAGSMASK 0x3fL
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x1L
|
||||
#else
|
||||
FILEFLAGS 0x0L
|
||||
#endif
|
||||
FILEOS 0x40004L
|
||||
FILETYPE 0x1L
|
||||
FILESUBTYPE 0x0L
|
||||
BEGIN
|
||||
BLOCK "StringFileInfo"
|
||||
BEGIN
|
||||
BLOCK "040904b0"
|
||||
BEGIN
|
||||
VALUE "CompanyName", "TODO: <Company name>"
|
||||
VALUE "FileDescription", "Nothin' Fancy Example Application"
|
||||
VALUE "FileVersion", "1.0.0.0"
|
||||
VALUE "InternalName", "Game.exe"
|
||||
VALUE "LegalCopyright", "Copyright (C) 2021 Grayson Riffe"
|
||||
VALUE "OriginalFilename", "Game.exe"
|
||||
VALUE "ProductName", "Nothin' Fancy"
|
||||
VALUE "ProductVersion", "1.0"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
BEGIN
|
||||
VALUE "Translation", 0x409, 1200
|
||||
END
|
||||
END
|
||||
|
||||
#endif // English (United States) resources
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
#ifndef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 3 resource.
|
||||
//
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#endif // not APSTUDIO_INVOKED
|
||||
|
||||
@@ -188,8 +188,15 @@
|
||||
<ClCompile Include="src\MainState.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="resource.h" />
|
||||
<ClInclude Include="src\include\MainState.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="Game.rc" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Image Include="res\icons\exeicon.ico" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
|
||||
@@ -26,5 +26,18 @@
|
||||
<ClInclude Include="src\include\MainState.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="resource.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="Game.rc">
|
||||
<Filter>Resource Files</Filter>
|
||||
</ResourceCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Image Include="res\icons\exeicon.ico">
|
||||
<Filter>Resource Files</Filter>
|
||||
</Image>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 649 KiB |
@@ -0,0 +1,16 @@
|
||||
//{{NO_DEPENDENCIES}}
|
||||
// Microsoft Visual C++ generated include file.
|
||||
// Used by Game.rc
|
||||
//
|
||||
#define IDI_ICON1 101
|
||||
|
||||
// Next default values for new objects
|
||||
//
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_NEXT_RESOURCE_VALUE 102
|
||||
#define _APS_NEXT_COMMAND_VALUE 40001
|
||||
#define _APS_NEXT_CONTROL_VALUE 1001
|
||||
#define _APS_NEXT_SYMED_VALUE 101
|
||||
#endif
|
||||
#endif
|
||||
+58
-2
@@ -2,17 +2,73 @@
|
||||
|
||||
void MainState::onEnter() {
|
||||
Log("MainState onEnter!");
|
||||
|
||||
camera->setType(nf::Camera::Type::FIRST_PERSON);
|
||||
ap.load("CubeTest.nfpack");
|
||||
test.create(ap["spec.obj"]);
|
||||
test.setPosition(0.0, 0.0, -5.0);
|
||||
plane.create(nf::BaseAssets::plane);
|
||||
plane.setPosition(0.0, -2.0, 0.0);
|
||||
plane.setScale(10.0);
|
||||
text.create("This is a test text.", nf::Vec2(0.1, 0.025), nf::Vec3(0.7));
|
||||
text.centered(true);
|
||||
uiTex.create(nf::BaseAssets::logo, nf::Vec2(0.025, 0.025), 0.5);
|
||||
button.create(nf::Vec2(0.8, 0.025), "Reset");
|
||||
light.create(nf::Vec3(0.0, 5.0, 0.0), nf::Vec3(1.0, 1.0, 1.0), 1.3);
|
||||
cm.create(nf::BaseAssets::cubemap);
|
||||
}
|
||||
|
||||
void MainState::update(double deltaTime) {
|
||||
if (app->isKeyPressed(NFI_U))
|
||||
camera->setType(nf::Camera::Type::UI);
|
||||
if (app->isKeyPressed(NFI_P))
|
||||
camera->setType(nf::Camera::Type::FIRST_PERSON);
|
||||
|
||||
double speed = 5.0;
|
||||
if (camera->getType() == nf::Camera::Type::FIRST_PERSON) {
|
||||
if (app->isKeyHeld(NFI_SHIFT))
|
||||
speed = 20.0;
|
||||
else
|
||||
speed = 5.0;
|
||||
if (app->isKeyHeld(NFI_W))
|
||||
camera->moveForward(speed * deltaTime);
|
||||
if (app->isKeyHeld(NFI_S))
|
||||
camera->moveBackward(speed * deltaTime);
|
||||
if (app->isKeyHeld(NFI_D))
|
||||
camera->moveRight(speed * deltaTime);
|
||||
if (app->isKeyHeld(NFI_A))
|
||||
camera->moveLeft(speed * deltaTime);
|
||||
}
|
||||
|
||||
float offset = 0.5f;
|
||||
if (app->isKeyHeld(NFI_UP))
|
||||
yrot += offset;
|
||||
if (app->isKeyHeld(NFI_DOWN))
|
||||
yrot -= offset;
|
||||
if (app->isKeyHeld(NFI_LEFT))
|
||||
xrot += offset;
|
||||
if (app->isKeyHeld(NFI_RIGHT))
|
||||
xrot -= offset;
|
||||
test.setRotation(-yrot, -xrot, 0.0);
|
||||
|
||||
text.setText("FPS: " + std::to_string(app->getFPS()));
|
||||
|
||||
if (button.isClicked())
|
||||
app->changeState("Main State");
|
||||
if (app->isKeyPressed(NFI_ESCAPE))
|
||||
app->quit();
|
||||
}
|
||||
|
||||
void MainState::render(nf::Renderer& renderer) {
|
||||
|
||||
renderer.render(test);
|
||||
renderer.render(plane);
|
||||
renderer.render(text);
|
||||
renderer.render(uiTex);
|
||||
renderer.render(button);
|
||||
renderer.render(light);
|
||||
renderer.render(cm);
|
||||
}
|
||||
|
||||
void MainState::onExit() {
|
||||
Log("MainState onExit!");
|
||||
xrot = yrot = 0.0f;
|
||||
}
|
||||
@@ -10,5 +10,15 @@ public:
|
||||
|
||||
void onExit() override;
|
||||
private:
|
||||
nf::AssetPack ap;
|
||||
nf::Entity test;
|
||||
nf::Entity plane;
|
||||
nf::Text text;
|
||||
nf::UITexture uiTex;
|
||||
nf::Button button;
|
||||
nf::Light light;
|
||||
nf::Cubemap cm;
|
||||
|
||||
float xrot, yrot;
|
||||
|
||||
};
|
||||
Reference in new issue
Block a user