├── .gitmodules ├── scripts └── Setup.bat ├── .gitignore ├── premake5.lua ├── README.md ├── WalnutApp ├── src │ └── WalnutApp.cpp └── premake5.lua └── LICENSE.txt /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "Walnut"] 2 | path = Walnut 3 | url = https://github.com/TheCherno/Walnut 4 | -------------------------------------------------------------------------------- /scripts/Setup.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | pushd .. 4 | Walnut\vendor\bin\premake5.exe vs2022 5 | popd 6 | pause -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Directories 2 | .vs/ 3 | bin/ 4 | bin-int/ 5 | 6 | # Files 7 | *.vcxproj 8 | *.vcxproj.user 9 | *.vcxproj.filters 10 | *.sln 11 | 12 | # Exclude 13 | !vendor/bin -------------------------------------------------------------------------------- /premake5.lua: -------------------------------------------------------------------------------- 1 | -- premake5.lua 2 | workspace "WalnutApp" 3 | architecture "x64" 4 | configurations { "Debug", "Release", "Dist" } 5 | startproject "WalnutApp" 6 | 7 | outputdir = "%{cfg.buildcfg}-%{cfg.system}-%{cfg.architecture}" 8 | include "Walnut/WalnutExternal.lua" 9 | 10 | include "WalnutApp" -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Walnut App Template 2 | 3 | This is a simple app template for [Walnut](https://github.com/TheCherno/Walnut) - unlike the example within the Walnut repository, this keeps Walnut as an external submodule and is much more sensible for actually building applications. See the [Walnut](https://github.com/TheCherno/Walnut) repository for more details. 4 | 5 | ## Getting Started 6 | Once you've cloned, you can customize the `premake5.lua` and `WalnutApp/premake5.lua` files to your liking (eg. change the name from "WalnutApp" to something else). Once you're happy, run `scripts/Setup.bat` to generate Visual Studio 2022 solution/project files. Your app is located in the `WalnutApp/` directory, which some basic example code to get you going in `WalnutApp/src/WalnutApp.cpp`. I recommend modifying that WalnutApp project to create your own application, as everything should be setup and ready to go. -------------------------------------------------------------------------------- /WalnutApp/src/WalnutApp.cpp: -------------------------------------------------------------------------------- 1 | #include "Walnut/Application.h" 2 | #include "Walnut/EntryPoint.h" 3 | 4 | #include "Walnut/Image.h" 5 | 6 | class ExampleLayer : public Walnut::Layer 7 | { 8 | public: 9 | virtual void OnUIRender() override 10 | { 11 | ImGui::Begin("Hello"); 12 | ImGui::Button("Button"); 13 | ImGui::End(); 14 | 15 | ImGui::ShowDemoWindow(); 16 | } 17 | }; 18 | 19 | Walnut::Application* Walnut::CreateApplication(int argc, char** argv) 20 | { 21 | Walnut::ApplicationSpecification spec; 22 | spec.Name = "Walnut Example"; 23 | 24 | Walnut::Application* app = new Walnut::Application(spec); 25 | app->PushLayer(); 26 | app->SetMenubarCallback([app]() 27 | { 28 | if (ImGui::BeginMenu("File")) 29 | { 30 | if (ImGui::MenuItem("Exit")) 31 | { 32 | app->Close(); 33 | } 34 | ImGui::EndMenu(); 35 | } 36 | }); 37 | return app; 38 | } -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022 Studio Cherno 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /WalnutApp/premake5.lua: -------------------------------------------------------------------------------- 1 | project "WalnutApp" 2 | kind "ConsoleApp" 3 | language "C++" 4 | cppdialect "C++17" 5 | targetdir "bin/%{cfg.buildcfg}" 6 | staticruntime "off" 7 | 8 | files { "src/**.h", "src/**.cpp" } 9 | 10 | includedirs 11 | { 12 | "../Walnut/vendor/imgui", 13 | "../Walnut/vendor/glfw/include", 14 | "../Walnut/vendor/glm", 15 | 16 | "../Walnut/Walnut/src", 17 | 18 | "%{IncludeDir.VulkanSDK}", 19 | } 20 | 21 | links 22 | { 23 | "Walnut" 24 | } 25 | 26 | targetdir ("../bin/" .. outputdir .. "/%{prj.name}") 27 | objdir ("../bin-int/" .. outputdir .. "/%{prj.name}") 28 | 29 | filter "system:windows" 30 | systemversion "latest" 31 | defines { "WL_PLATFORM_WINDOWS" } 32 | 33 | filter "configurations:Debug" 34 | defines { "WL_DEBUG" } 35 | runtime "Debug" 36 | symbols "On" 37 | 38 | filter "configurations:Release" 39 | defines { "WL_RELEASE" } 40 | runtime "Release" 41 | optimize "On" 42 | symbols "On" 43 | 44 | filter "configurations:Dist" 45 | kind "WindowedApp" 46 | defines { "WL_DIST" } 47 | runtime "Release" 48 | optimize "On" 49 | symbols "Off" --------------------------------------------------------------------------------