From d74f808a17b32adaaeb54c90e33cd84ae46a1329 Mon Sep 17 00:00:00 2001 From: "Grayson Riffe (Laptop)" <graysonriffe@yahoo.com> Date: Thu, 26 Aug 2021 00:23:56 -0500 Subject: [PATCH] Added Model and default shader; Organization --- .gitignore | 3 +- Game/Game.vcxproj | 8 +++ Game/src/Game.cpp | 6 +- Game/src/MainState.cpp | 4 +- Game/src/include/MainState.h | 2 +- NothinFancy/NothinFancy.rc | 71 +++++++++++++++++++ NothinFancy/NothinFancy.vcxproj | 28 +++++++- NothinFancy/NothinFancy.vcxproj.filters | 20 +++++- NothinFancy/src/Renderer/Drawable.cpp | 31 -------- .../src/Renderer/Drawable/Drawable.cpp | 27 +++++++ NothinFancy/src/Renderer/Drawable/Model.cpp | 44 ++++++++++++ NothinFancy/src/Renderer/Renderer.cpp | 21 ++++-- NothinFancy/src/Renderer/VertexArray.cpp | 2 +- NothinFancy/src/Utility.cpp | 14 ++++ NothinFancy/src/include/Drawable.h | 14 ++-- NothinFancy/src/include/Model.h | 18 +++++ NothinFancy/src/include/NothinFancy.h | 4 +- NothinFancy/src/include/Renderer.h | 7 +- NothinFancy/src/include/Shader.h | 1 - NothinFancy/src/include/Utility.h | 7 ++ NothinFancy/src/include/VertexArray.h | 2 +- NothinFancy/src/include/resource.h | 17 +++++ notes.txt | 6 +- 23 files changed, 293 insertions(+), 64 deletions(-) create mode 100644 NothinFancy/NothinFancy.rc delete mode 100644 NothinFancy/src/Renderer/Drawable.cpp create mode 100644 NothinFancy/src/Renderer/Drawable/Drawable.cpp create mode 100644 NothinFancy/src/Renderer/Drawable/Model.cpp create mode 100644 NothinFancy/src/include/Model.h create mode 100644 NothinFancy/src/include/resource.h diff --git a/.gitignore b/.gitignore index 2bce6b8..e540b07 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ .vs/ bin/ int/ -*aps \ No newline at end of file +*aps +*res \ No newline at end of file diff --git a/Game/Game.vcxproj b/Game/Game.vcxproj index 622e1f0..de3235c 100644 --- a/Game/Game.vcxproj +++ b/Game/Game.vcxproj @@ -105,6 +105,8 @@ <EntryPointSymbol>mainCRTStartup</EntryPointSymbol> <IgnoreSpecificDefaultLibraries>libcmt.lib</IgnoreSpecificDefaultLibraries> <AdditionalOptions>/ignore:4099 %(AdditionalOptions)</AdditionalOptions> + <AdditionalLibraryDirectories>$(ProjectDir)dep\;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + <AdditionalDependencies>nf.res;%(AdditionalDependencies)</AdditionalDependencies> </Link> </ItemDefinitionGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> @@ -126,6 +128,8 @@ <EntryPointSymbol>mainCRTStartup</EntryPointSymbol> <IgnoreSpecificDefaultLibraries>libcmt.lib</IgnoreSpecificDefaultLibraries> <AdditionalOptions>/ignore:4099 %(AdditionalOptions)</AdditionalOptions> + <AdditionalLibraryDirectories>$(ProjectDir)dep\;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + <AdditionalDependencies>nf.res;%(AdditionalDependencies)</AdditionalDependencies> </Link> </ItemDefinitionGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> @@ -143,6 +147,8 @@ <EntryPointSymbol>mainCRTStartup</EntryPointSymbol> <IgnoreSpecificDefaultLibraries>libcmt.lib</IgnoreSpecificDefaultLibraries> <AdditionalOptions>/ignore:4099 %(AdditionalOptions)</AdditionalOptions> + <AdditionalLibraryDirectories>$(ProjectDir)dep\;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + <AdditionalDependencies>nf.res;%(AdditionalDependencies)</AdditionalDependencies> </Link> </ItemDefinitionGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> @@ -164,6 +170,8 @@ <EntryPointSymbol>mainCRTStartup</EntryPointSymbol> <IgnoreSpecificDefaultLibraries>libcmt.lib</IgnoreSpecificDefaultLibraries> <AdditionalOptions>/ignore:4099 %(AdditionalOptions)</AdditionalOptions> + <AdditionalLibraryDirectories>$(ProjectDir)dep\;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + <AdditionalDependencies>nf.res;%(AdditionalDependencies)</AdditionalDependencies> </Link> </ItemDefinitionGroup> <ItemGroup> diff --git a/Game/src/Game.cpp b/Game/src/Game.cpp index 255ec8f..9fdcbee 100644 --- a/Game/src/Game.cpp +++ b/Game/src/Game.cpp @@ -1,11 +1,9 @@ #include "NothinFancy.h" #include "MainState.h" -using namespace nf; - int main(int argc, char* argv[]) { - Config conf = { 1280, 720, false, "Example Game"}; - Application app(conf); + nf::Config conf = { 1280, 720, false, "Example Game"}; + nf::Application app(conf); //app.setWindowIcon(...); // app.setWindowCursor(...); diff --git a/Game/src/MainState.cpp b/Game/src/MainState.cpp index 061c9fe..ce41b83 100644 --- a/Game/src/MainState.cpp +++ b/Game/src/MainState.cpp @@ -1,6 +1,6 @@ #include "MainState.h" -MainState::MainState(Application* app) : +MainState::MainState(nf::Application* app) : Gamestate(app) { } @@ -13,7 +13,7 @@ void MainState::update(double deltaTime) { } void MainState::render() { - static Renderer& renderer = *m_app->getRenderer(); + static nf::Renderer& renderer = *m_app->getRenderer(); } void MainState::onExit() { diff --git a/Game/src/include/MainState.h b/Game/src/include/MainState.h index 83813c3..194391d 100644 --- a/Game/src/include/MainState.h +++ b/Game/src/include/MainState.h @@ -3,7 +3,7 @@ class MainState : public nf::Gamestate { public: - MainState(Application* app); + MainState(nf::Application* app); void onEnter() override; diff --git a/NothinFancy/NothinFancy.rc b/NothinFancy/NothinFancy.rc new file mode 100644 index 0000000..660c9ab --- /dev/null +++ b/NothinFancy/NothinFancy.rc @@ -0,0 +1,71 @@ +// Microsoft Visual C++ generated resource script. +// +#include "src/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 + "src/include/resource.h\0" +END + +2 TEXTINCLUDE +BEGIN + "#include ""winres.h""\r\n" + "\0" +END + +3 TEXTINCLUDE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// SHADER +// + +IDR_DEFAULTVERTEX RCDATA "res\\defaultShader\\vertex.shader" + +IDR_DEFAULTFRAGMENT RCDATA "res\\defaultShader\\fragment.shader" + +#endif // English (United States) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/NothinFancy/NothinFancy.vcxproj b/NothinFancy/NothinFancy.vcxproj index bd31894..f2c0745 100644 --- a/NothinFancy/NothinFancy.vcxproj +++ b/NothinFancy/NothinFancy.vcxproj @@ -112,6 +112,10 @@ <ProjectReference> <LinkLibraryDependencies>true</LinkLibraryDependencies> </ProjectReference> + <PostBuildEvent> + <Command>copy "$(IntDir)$(ProjectName).res" "$(SolutionDir)Game\dep\nf.res"</Command> + <Message>Copying default NF resources</Message> + </PostBuildEvent> </ItemDefinitionGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <ClCompile> @@ -139,6 +143,10 @@ <ProjectReference> <LinkLibraryDependencies>true</LinkLibraryDependencies> </ProjectReference> + <PostBuildEvent> + <Command>copy "$(IntDir)$(ProjectName).res" "$(SolutionDir)Game\dep\nf.res"</Command> + <Message>Copying default NF resources</Message> + </PostBuildEvent> </ItemDefinitionGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <ClCompile> @@ -162,6 +170,10 @@ <ProjectReference> <LinkLibraryDependencies>true</LinkLibraryDependencies> </ProjectReference> + <PostBuildEvent> + <Command>copy "$(IntDir)$(ProjectName).res" "$(SolutionDir)Game\dep\nf.res"</Command> + <Message>Copying default NF resources</Message> + </PostBuildEvent> </ItemDefinitionGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <ClCompile> @@ -189,12 +201,17 @@ <ProjectReference> <LinkLibraryDependencies>true</LinkLibraryDependencies> </ProjectReference> + <PostBuildEvent> + <Command>copy "$(IntDir)$(ProjectName).res" "$(SolutionDir)Game\dep\nf.res"</Command> + <Message>Copying default NF resources</Message> + </PostBuildEvent> </ItemDefinitionGroup> <ItemGroup> <ClCompile Include="src\Application.cpp" /> <ClCompile Include="src\Gamestate.cpp" /> <ClCompile Include="src\IntroGamestate.cpp" /> - <ClCompile Include="src\Renderer\Drawable.cpp" /> + <ClCompile Include="src\Renderer\Drawable\Drawable.cpp" /> + <ClCompile Include="src\Renderer\Drawable\Model.cpp" /> <ClCompile Include="src\Renderer\IndexBuffer.cpp" /> <ClCompile Include="src\Renderer\Renderer.cpp" /> <ClCompile Include="src\Renderer\Shader.cpp" /> @@ -203,6 +220,7 @@ <ClCompile Include="src\Utility.cpp" /> </ItemGroup> <ItemGroup> + <ClInclude Include="src\include\resource.h" /> <ClInclude Include="src\include\Application.h" /> <ClInclude Include="src\include\Config.h" /> <ClInclude Include="src\include\Drawable.h" /> @@ -210,6 +228,7 @@ <ClInclude Include="src\include\IndexBuffer.h" /> <ClInclude Include="src\include\IntroGamestate.h" /> <ClInclude Include="src\include\Input.h" /> + <ClInclude Include="src\include\Model.h" /> <ClInclude Include="src\include\NothinFancy.h" /> <ClInclude Include="src\include\Renderer.h" /> <ClInclude Include="src\include\Shader.h" /> @@ -220,6 +239,13 @@ <ItemGroup> <Natvis Include="NatvisFile.natvis" /> </ItemGroup> + <ItemGroup> + <None Include="res\defaultShader\fragment.shader" /> + <None Include="res\defaultShader\vertex.shader" /> + </ItemGroup> + <ItemGroup> + <ResourceCompile Include="NothinFancy.rc" /> + </ItemGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <ImportGroup Label="ExtensionTargets"> </ImportGroup> diff --git a/NothinFancy/NothinFancy.vcxproj.filters b/NothinFancy/NothinFancy.vcxproj.filters index 34dc2e7..bdf998b 100644 --- a/NothinFancy/NothinFancy.vcxproj.filters +++ b/NothinFancy/NothinFancy.vcxproj.filters @@ -39,12 +39,15 @@ <ClCompile Include="src\Renderer\Shader.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="src\Renderer\Drawable.cpp"> + <ClCompile Include="src\Renderer\Drawable\Drawable.cpp"> <Filter>Source Files</Filter> </ClCompile> <ClCompile Include="src\Gamestate.cpp"> <Filter>Source Files</Filter> </ClCompile> + <ClCompile Include="src\Renderer\Drawable\Model.cpp"> + <Filter>Source Files</Filter> + </ClCompile> </ItemGroup> <ItemGroup> <ClInclude Include="src\include\Config.h"> @@ -86,8 +89,23 @@ <ClInclude Include="src\include\Drawable.h"> <Filter>Header Files</Filter> </ClInclude> + <ClInclude Include="src\include\Model.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="src\include\resource.h"> + <Filter>Header Files</Filter> + </ClInclude> </ItemGroup> <ItemGroup> <Natvis Include="NatvisFile.natvis" /> </ItemGroup> + <ItemGroup> + <None Include="res\defaultShader\vertex.shader" /> + <None Include="res\defaultShader\fragment.shader" /> + </ItemGroup> + <ItemGroup> + <ResourceCompile Include="NothinFancy.rc"> + <Filter>Resource Files</Filter> + </ResourceCompile> + </ItemGroup> </Project> \ No newline at end of file diff --git a/NothinFancy/src/Renderer/Drawable.cpp b/NothinFancy/src/Renderer/Drawable.cpp deleted file mode 100644 index d2f8260..0000000 --- a/NothinFancy/src/Renderer/Drawable.cpp +++ /dev/null @@ -1,31 +0,0 @@ -#include "Drawable.h" - -namespace nf { - Drawable::Drawable(const char* vertexShader, const char* fragmentShader, const void* vertexBufferData, const size_t vertexBufferSize, const void* indexBufferData, size_t indexBufferCount) : - m_shader(vertexShader, fragmentShader), - m_vao(), - m_ib(indexBufferData, indexBufferCount) - { - m_vao.addBuffer(vertexBufferData, vertexBufferSize); - m_vao.push<float>(2); - m_vao.finishBufferLayout(); - } - - unsigned int Drawable::getIndexCount() { - return m_ib.getCount(); - } - - void Drawable::bind() { - m_shader.bind(); - m_vao.bind(); - m_ib.bind(); - } - - Drawable::DrawableType Drawable::identity() { - return DrawableType::NF_NONE; - } - - Drawable::~Drawable() { - - } -} \ No newline at end of file diff --git a/NothinFancy/src/Renderer/Drawable/Drawable.cpp b/NothinFancy/src/Renderer/Drawable/Drawable.cpp new file mode 100644 index 0000000..6b2607c --- /dev/null +++ b/NothinFancy/src/Renderer/Drawable/Drawable.cpp @@ -0,0 +1,27 @@ +#include "Drawable.h" + +#include "Utility.h" + +namespace nf { + Drawable::Drawable() { + Log("Drawable constructor"); + } + + Drawable::DrawableType Drawable::identity() { + return DrawableType::NF_NONE; + } + + void Drawable::bind() { + Error("Tried to bind an invalid object!"); + } + + unsigned int Drawable::getIndexCount() { + return m_ib->getCount(); + } + + Drawable::~Drawable() { + delete m_vao; + delete m_ib; + delete m_shader; + } +} \ No newline at end of file diff --git a/NothinFancy/src/Renderer/Drawable/Model.cpp b/NothinFancy/src/Renderer/Drawable/Model.cpp new file mode 100644 index 0000000..06e8383 --- /dev/null +++ b/NothinFancy/src/Renderer/Drawable/Model.cpp @@ -0,0 +1,44 @@ +#include "Model.h" + +#include "Utility.h" + +namespace nf { + Model::Model() { + } + + void Model::create(const void* vertexBufferData, const size_t vertexBufferSize, const void* indexBufferData, size_t indexBufferCount, const char* vertexShader, const char* fragmentShader) { + m_vao = new VertexArray; + m_vao->addBuffer(vertexBufferData, vertexBufferSize); + m_vao->push<float>(2); + //TODO: Change this to 3 + m_vao->finishBufferLayout(); + m_ib = new IndexBuffer(indexBufferData, indexBufferCount); + if (vertexShader && fragmentShader) + m_shader = new Shader(vertexShader, fragmentShader); + } + + Drawable::DrawableType Model::identity() { + return DrawableType::NF_GAME; + } + + void Model::bind() { + if (m_vao == nullptr) + Error("Tried to bind uninitialized model!"); + m_vao->bind(); + m_ib->bind(); + if (m_shader) { + m_shader->bind(); + //TODO: Set uniforms here such as position and texture + } + } + + bool Model::hasCustomShader() { + if (m_shader) + return true; + return false; + } + + Model::~Model() { + + } +} \ No newline at end of file diff --git a/NothinFancy/src/Renderer/Renderer.cpp b/NothinFancy/src/Renderer/Renderer.cpp index b05b3f9..8b9b28e 100644 --- a/NothinFancy/src/Renderer/Renderer.cpp +++ b/NothinFancy/src/Renderer/Renderer.cpp @@ -5,6 +5,7 @@ #include "Application.h" #include "Utility.h" +#include "resource.h" namespace nf { Renderer::Renderer(Application* app) { @@ -51,15 +52,21 @@ namespace nf { glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glClearColor(0.0f, 0.0f, 0.0f, 1.0f); + + Win32Res vs(IDR_DEFAULTVERTEX); + m_defaultVertex = (const char*)vs.ptr; + Win32Res fs(IDR_DEFAULTFRAGMENT); + m_defaultFragment = (const char*)fs.ptr; + m_defaultShader = new Shader(m_defaultVertex, m_defaultFragment); } - void Renderer::render(Drawable* in) { - if (in == nullptr) + void Renderer::render(Drawable& in) { + if (&in == nullptr) Error("Drawable object tried to render before being constructed!"); - if (in->identity() == Drawable::DrawableType::NF_UI) - m_lUI.push_back(in); + if (in.identity() == Drawable::DrawableType::NF_UI) + m_lUI.push_back(&in); else - m_lGame.push_back(in); + m_lGame.push_back(&in); } void Renderer::doFrame() { @@ -67,8 +74,10 @@ namespace nf { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); for (Drawable* draw : m_lGame) { - Drawable& curr = *draw; + Model& curr = (Model&)*draw; curr.bind(); + if (!curr.hasCustomShader()) + m_defaultShader->bind(); glDrawElements(GL_TRIANGLES, curr.getIndexCount(), GL_UNSIGNED_INT, nullptr); } diff --git a/NothinFancy/src/Renderer/VertexArray.cpp b/NothinFancy/src/Renderer/VertexArray.cpp index 397ac9c..68677f6 100644 --- a/NothinFancy/src/Renderer/VertexArray.cpp +++ b/NothinFancy/src/Renderer/VertexArray.cpp @@ -42,7 +42,7 @@ namespace nf { m_lastStride = 0; } - void VertexArray::bind(unsigned int buffer) { + void VertexArray::bind() { if (m_buffers.empty()) Error("No buffers and layouts added to vertex array before being bound!"); if (!m_lastBufferHasLayout) diff --git a/NothinFancy/src/Utility.cpp b/NothinFancy/src/Utility.cpp index f840c18..201ca75 100644 --- a/NothinFancy/src/Utility.cpp +++ b/NothinFancy/src/Utility.cpp @@ -54,6 +54,20 @@ namespace nf { } #endif + Win32Res::Win32Res(int id) : + ptr(nullptr), + size(0) + { + HRSRC src = FindResource(NULL, MAKEINTRESOURCE(id), RT_RCDATA); + if (src) { + HGLOBAL temp = LoadResource(NULL, src); + if (temp) { + ptr = LockResource(temp); + size = (size_t)SizeofResource(NULL, src); + } + } + } + const wchar_t* toWide(const char* in) { int length = std::strlen(in) + 1; wchar_t* out = new wchar_t[length]; diff --git a/NothinFancy/src/include/Drawable.h b/NothinFancy/src/include/Drawable.h index 7ca8e05..7a6d13e 100644 --- a/NothinFancy/src/include/Drawable.h +++ b/NothinFancy/src/include/Drawable.h @@ -9,17 +9,17 @@ namespace nf { enum class DrawableType { NF_NONE, NF_GAME, NF_UI }; - Drawable(const char* vertexShader, const char* fragmentShader, const void* vertexBuffer, const size_t vertexBufferSize, const void* indexBufferData, size_t indexBufferCount); + //TODO: Construct using Shader code and data from obj + Drawable(); - unsigned int getIndexCount(); - void bind(); virtual DrawableType identity(); + virtual void bind(); + unsigned int getIndexCount(); ~Drawable(); protected: - //TODO: Add VAO, Shader, index buffer, etc. - Shader m_shader; - VertexArray m_vao; - IndexBuffer m_ib; + VertexArray* m_vao; + IndexBuffer* m_ib; + Shader* m_shader; }; } \ No newline at end of file diff --git a/NothinFancy/src/include/Model.h b/NothinFancy/src/include/Model.h new file mode 100644 index 0000000..841d22c --- /dev/null +++ b/NothinFancy/src/include/Model.h @@ -0,0 +1,18 @@ +#pragma once +#include "Drawable.h" + +namespace nf { + class Model : public Drawable { + public: + Model(); + + void create(const void* vertexBufferData, const size_t vertexBufferSize, const void* indexBufferData, size_t indexBufferCount, const char* vertexShader = nullptr, const char* fragmentShader = nullptr); + DrawableType identity() override; + void bind() override; + bool hasCustomShader(); + + ~Model(); + private: + + }; +} \ No newline at end of file diff --git a/NothinFancy/src/include/NothinFancy.h b/NothinFancy/src/include/NothinFancy.h index c782751..f76b396 100644 --- a/NothinFancy/src/include/NothinFancy.h +++ b/NothinFancy/src/include/NothinFancy.h @@ -2,6 +2,4 @@ #include "Application.h" #include "Input.h" -#include "Utility.h" - -using namespace nf; \ No newline at end of file +#include "Utility.h" \ No newline at end of file diff --git a/NothinFancy/src/include/Renderer.h b/NothinFancy/src/include/Renderer.h index 3fc2412..1c1cdc3 100644 --- a/NothinFancy/src/include/Renderer.h +++ b/NothinFancy/src/include/Renderer.h @@ -2,7 +2,7 @@ #include <vector> #include <Windows.h> -#include "Drawable.h" +#include "Model.h" namespace nf { class Application; @@ -11,7 +11,7 @@ namespace nf { public: Renderer(Application* app); - void render(Drawable* in); + void render(Drawable& in); void doFrame(); @@ -24,5 +24,8 @@ namespace nf { std::vector<Drawable*> m_lGame; std::vector<Drawable*> m_lUI; + const char* m_defaultVertex; + const char* m_defaultFragment; + Shader* m_defaultShader; }; } \ No newline at end of file diff --git a/NothinFancy/src/include/Shader.h b/NothinFancy/src/include/Shader.h index f10e0c3..73171a2 100644 --- a/NothinFancy/src/include/Shader.h +++ b/NothinFancy/src/include/Shader.h @@ -15,6 +15,5 @@ namespace nf { private: unsigned int m_id; std::unordered_map<const char*, unsigned int> m_uniformLocations; - //TODO: Load from resource }; } \ No newline at end of file diff --git a/NothinFancy/src/include/Utility.h b/NothinFancy/src/include/Utility.h index dcd9705..60eaa0a 100644 --- a/NothinFancy/src/include/Utility.h +++ b/NothinFancy/src/include/Utility.h @@ -38,8 +38,15 @@ __debugbreak();} std::exit(-1);} #endif + struct Win32Res { + Win32Res(int id); + void* ptr; + size_t size; + }; + const wchar_t* toWide(const char* in); const wchar_t* toWide(const std::string& in); bool writeFile(const char* filename, const std::string& in); std::string readFile(const char* filename); + } \ No newline at end of file diff --git a/NothinFancy/src/include/VertexArray.h b/NothinFancy/src/include/VertexArray.h index 1a4f10c..e13c72b 100644 --- a/NothinFancy/src/include/VertexArray.h +++ b/NothinFancy/src/include/VertexArray.h @@ -18,7 +18,7 @@ namespace nf { template<typename T> void push(unsigned int count); void finishBufferLayout(); - void bind(unsigned int buffer = 1); + void bind(); ~VertexArray(); private: diff --git a/NothinFancy/src/include/resource.h b/NothinFancy/src/include/resource.h new file mode 100644 index 0000000..52df288 --- /dev/null +++ b/NothinFancy/src/include/resource.h @@ -0,0 +1,17 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by NothinFancy.rc +// +#define IDR_DEFAULTVERTEX 201 +#define IDR_DEFAULTFRAGMENT 202 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 103 +#define _APS_NEXT_COMMAND_VALUE 40001 +#define _APS_NEXT_CONTROL_VALUE 1001 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/notes.txt b/notes.txt index 3bc7bbe..630665b 100644 --- a/notes.txt +++ b/notes.txt @@ -16,14 +16,16 @@ Remember to use tasks (//TODO: ) *Separate project *Namespaced Refactor NothinFancy.h to ONLY include stuff the frontend needs -AND get rid of NFENGINE -High CPU usage? +*AND get rid of NFENGINE +*High CPU usage? *Debug and log system *NatVis *Config changing *Alt-Enter *File IO functions *Keyboard and mouse click input +Separate Model and UIElement from Drawable +Entity and Camera classes Mouse position input Audio *Game states