Skip to content
This repository was archived by the owner on Mar 11, 2025. It is now read-only.

Commit c87092f

Browse files
TymianekPLkarnkaul
andauthored
Tymii/17 inconsistent file naming (#19)
* Fix inconsistent file & namespace naming * Fix clang format * fix casing uwu * gh checks * casing * casing * fix chmod for scripts * fix cmakelists * meow * cmakelists * github * owo * fix namespace Detail references * FormatCheckDiff.sh * format code * Fix builds * Fix shaders --------- Co-authored-by: Karn Kaul <karnkaul@gmail.com>
1 parent 66799bf commit c87092f

34 files changed

+117
-119
lines changed
File renamed without changes.

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ jobs:
66
steps:
77
- uses: actions/checkout@v4
88
- name: format code
9-
run: scripts/format_code.sh
9+
run: chmod a+x Scripts/FormatCode.sh; Scripts/FormatCode.sh
1010
- name: check diff
11-
run: .github/format_check_diff.sh
11+
run: chmod a+x .github/FormatCheckDiff.sh; .github/FormatCheckDiff.sh
1212
linux-gcc:
1313
runs-on: ubuntu-latest
1414
steps:
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
project(${project_name}-app)
1+
project(${project_name}-App)
22

33
add_executable(${PROJECT_NAME})
44

55
target_link_libraries(${PROJECT_NAME} PRIVATE
6-
${project_name}::lib
6+
${project_name}::Lib
77
)
88

9-
target_precompile_headers(${PROJECT_NAME} REUSE_FROM ${project_name}-lib)
9+
target_precompile_headers(${PROJECT_NAME} REUSE_FROM ${project_name}-Lib)
1010

11-
file(GLOB_RECURSE sources LIST_DIRECTORIES false "src/*.[hc]pp")
11+
file(GLOB_RECURSE sources LIST_DIRECTORIES false "Src/*.[hc]pp")
1212
target_sources(${PROJECT_NAME} PRIVATE
1313
${sources}
1414
)

app/src/main.cpp renamed to App/Src/Main.cpp

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
#include <imgui.h>
2+
#include <Tkge/Engine.hpp>
3+
#include <Tkge/Graphics/Shader.hpp>
24
#include <klib/assert.hpp>
3-
#include <tkge/engine.hpp>
45
#include <exception>
56
#include <print>
67

7-
// temporary, until we have shader assets.
8-
#include <tkge/graphics/shader.hpp>
8+
// temporary, until we have shader Assets.
99
#include <filesystem>
1010
#include <fstream>
1111
#include <vector>
@@ -41,27 +41,27 @@ namespace
4141

4242
void Run(const fs::path& assets_path)
4343
{
44-
static constexpr tkge::WindowSurface surface{.size = {1280, 720}};
45-
tkge::Engine engine{surface};
44+
static constexpr Tkge::WindowSurface surface{.size = {1280, 720}};
45+
Tkge::Engine engine{surface};
4646

47-
auto shader = tkge::graphics::Shader{};
48-
const auto vertexSpirV = LoadSpirV((assets_path / "shaders/default.vert").string().c_str());
49-
const auto fragmentSpirV = LoadSpirV((assets_path / "shaders/default.frag").string().c_str());
47+
auto shader = Tkge::Graphics::Shader{};
48+
const auto vertexSpirV = LoadSpirV((assets_path / "Shaders/Default.vert").string().c_str());
49+
const auto fragmentSpirV = LoadSpirV((assets_path / "Shaders/Default.frag").string().c_str());
5050
const auto& renderDevice = engine.RenderDevice();
5151
if (!shader.Load(renderDevice.get_device(), vertexSpirV, fragmentSpirV)) { throw std::runtime_error{"Failed to load shaders"}; }
5252

5353
constexpr auto vertices = std::array{
54-
tkge::graphics::Vertex{.position = {-0.5f, -0.5f}, .colour = kvf::red_v.to_vec4()},
55-
tkge::graphics::Vertex{.position = {0.5f, -0.5f}, .colour = kvf::green_v.to_vec4()},
56-
tkge::graphics::Vertex{.position = {0.5f, 0.5f}, .colour = kvf::blue_v.to_vec4()},
57-
tkge::graphics::Vertex{.position = {-0.5f, 0.5f}, .colour = kvf::yellow_v.to_vec4()},
54+
Tkge::Graphics::Vertex{.position = {-0.5f, -0.5f}, .colour = kvf::red_v.to_vec4()},
55+
Tkge::Graphics::Vertex{.position = {0.5f, -0.5f}, .colour = kvf::green_v.to_vec4()},
56+
Tkge::Graphics::Vertex{.position = {0.5f, 0.5f}, .colour = kvf::blue_v.to_vec4()},
57+
Tkge::Graphics::Vertex{.position = {-0.5f, 0.5f}, .colour = kvf::yellow_v.to_vec4()},
5858
};
5959

6060
constexpr auto indices = std::array{
6161
0u, 1u, 2u, 2u, 3u, 0u,
6262
};
6363

64-
const auto primitive = tkge::graphics::Primitive{
64+
const auto primitive = Tkge::Graphics::Primitive{
6565
.vertices = vertices,
6666
.indices = indices,
6767
};
@@ -100,7 +100,7 @@ int main([[maybe_unused]] int argc, char** argv)
100100
try
101101
{
102102
KLIB_ASSERT(argc > 0);
103-
const auto assets_path = Upfind(*argv, "assets");
103+
const auto assets_path = Upfind(*argv, "Assets");
104104
Run(assets_path);
105105
}
106106
catch (const std::exception& e)
File renamed without changes.
File renamed without changes.

CMakeLists.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
cmake_minimum_required(VERSION 3.24)
22

3-
set(project_name tkge)
3+
set(project_name Tkge)
44
project(${project_name})
55

66
set(CMAKE_CXX_STANDARD 23)
77
set(CMAKE_CXX_STANDARD_REQUIRED ON)
88
set(CMAKE_CXX_EXTENSIONS OFF)
99
set(CMAKE_DEBUG_POSTFIX "-d")
1010

11-
add_subdirectory(ext)
11+
add_subdirectory(Ext)
1212

13-
add_subdirectory(lib)
14-
add_subdirectory(app)
13+
add_subdirectory(Lib)
14+
add_subdirectory(App)
File renamed without changes.
File renamed without changes.

ext/src.zip renamed to Ext/src.zip

File renamed without changes.

lib/CMakeLists.txt renamed to Lib/CMakeLists.txt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
project(${project_name}-lib)
1+
project(${project_name}-Lib)
22

33
add_library(${PROJECT_NAME})
4-
add_library(${project_name}::lib ALIAS ${PROJECT_NAME})
4+
add_library(${project_name}::Lib ALIAS ${PROJECT_NAME})
55

66
target_include_directories(${PROJECT_NAME} PUBLIC
7-
include
7+
Include
88
)
99

1010
target_include_directories(${PROJECT_NAME} PRIVATE
11-
src
11+
Src
1212
)
1313

1414
target_link_libraries(${PROJECT_NAME} PUBLIC
@@ -23,6 +23,6 @@ target_precompile_headers(${PROJECT_NAME} PRIVATE
2323
<vulkan/vulkan.hpp>
2424
)
2525

26-
file(GLOB_RECURSE sources LIST_DIRECTORIES false "src/*.[hc]pp")
26+
file(GLOB_RECURSE sources LIST_DIRECTORIES false "Src/*.[hc]pp")
2727
target_sources(${PROJECT_NAME} PRIVATE
2828
${sources})

lib/include/tkge/assetLoader.hpp renamed to Lib/Include/Tkge/AssetLoader.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
#pragma once
22

3-
#include <tkge/Assets/IAsset.hpp>
3+
#include <Tkge/Assets/IAsset.hpp>
44
#include <filesystem>
55
#include <string>
66
#include <type_traits>
77

8-
namespace tkge
8+
namespace Tkge
99
{
1010
class AssetLoader
1111
{
@@ -39,4 +39,4 @@ namespace tkge
3939
private:
4040
std::vector<std::filesystem::path> _paths;
4141
};
42-
} // namespace tkge
42+
} // namespace Tkge

lib/include/tkge/Assets/IAsset.hpp renamed to Lib/Include/Tkge/Assets/IAsset.hpp

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
#pragma once
22

3+
#include <klib/polymorphic.hpp>
34
#include <cstddef>
4-
#include <fstream>
55
#include <memory>
66
#include <span>
77
#include <string>
88

9-
namespace tkge::Assets
9+
namespace Tkge::Assets
1010
{
11-
namespace detail
11+
namespace Detail
1212
{
1313
enum struct MemoryFileCapabilities : std::uint8_t
1414
{
@@ -67,7 +67,7 @@ namespace tkge::Assets
6767
/// <returns>Capabilities of the implementation</returns>
6868
[[nodiscard]] virtual MemoryFileCapabilities Capabilities() const noexcept = 0;
6969
};
70-
} // namespace detail
70+
} // namespace Detail
7171

7272
class ReadonlyByteStream
7373
{
@@ -128,13 +128,12 @@ namespace tkge::Assets
128128
std::span<std::byte> ReadChunk(std::size_t offset, std::size_t size, bool prefetchMemory);
129129
std::span<const std::byte> ReadChunk(std::size_t offset, std::size_t size, bool prefetchMemory) const;
130130

131-
std::unique_ptr<detail::MemoryMappedFile> _file;
131+
std::unique_ptr<Detail::MemoryMappedFile> _file;
132132
};
133133

134-
class IAsset
134+
class IAsset : public klib::Polymorphic
135135
{
136136
public:
137-
virtual ~IAsset() = default;
138137
virtual bool Load(ReadonlyByteStream) = 0;
139138
};
140-
} // namespace tkge::Assets
139+
} // namespace Tkge::Assets

lib/include/tkge/Assets/TextAsset.hpp renamed to Lib/Include/Tkge/Assets/TextAsset.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
#include "IAsset.hpp"
44

5-
namespace tkge::Assets
5+
namespace Tkge::Assets
66
{
77
class TextAsset final : public IAsset
88
{
@@ -15,4 +15,4 @@ namespace tkge::Assets
1515
private:
1616
std::string _text;
1717
};
18-
} // namespace tkge::Assets
18+
} // namespace Tkge::Assets

lib/include/tkge/engine.hpp renamed to Lib/Include/Tkge/Engine.hpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
#pragma once
2+
#include <Tkge/AssetLoader.hpp>
3+
#include <Tkge/Graphics/Renderer.hpp>
24
#include <glm/vec2.hpp>
35
#include <klib/c_string.hpp>
46
#include <kvf/color.hpp>
57
#include <kvf/render_device.hpp>
68
#include <kvf/render_pass.hpp>
79
#include <kvf/window.hpp>
8-
#include <tkge/assetLoader.hpp>
9-
#include <tkge/graphics/renderer.hpp>
1010

11-
namespace tkge
11+
namespace Tkge
1212
{
1313
struct WindowSurface
1414
{
@@ -32,7 +32,7 @@ namespace tkge
3232

3333
[[nodiscard]] bool IsRunning() const;
3434
vk::CommandBuffer NextFrame();
35-
[[nodiscard]] graphics::Renderer BeginRender(kvf::Color clear = kvf::black_v);
35+
[[nodiscard]] Graphics::Renderer BeginRender(kvf::Color clear = kvf::black_v);
3636
void Present();
3737

3838
[[nodiscard]] AssetLoader& GetAssetLoader() noexcept { return this->_assetLoader; }
@@ -45,9 +45,9 @@ namespace tkge
4545
kvf::RenderDevice _renderDevice;
4646
kvf::RenderPass _renderPass;
4747

48-
std::unique_ptr<graphics::IResourcePool> _resourcePool{};
48+
std::unique_ptr<Graphics::IResourcePool> _resourcePool{};
4949

5050
vk::CommandBuffer _cmd{};
5151
AssetLoader _assetLoader;
5252
};
53-
} // namespace tkge
53+
} // namespace Tkge

lib/include/tkge/graphics/pipeline_fixed_state.hpp renamed to Lib/Include/Tkge/Graphics/PipelineFixedState.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#pragma once
22
#include <vulkan/vulkan.hpp>
33

4-
namespace tkge::graphics
4+
namespace Tkge::Graphics
55
{
66
/// \brief Description of a unique Pipeline's fixed state.
77
struct PipelineFixedState
@@ -12,4 +12,4 @@ namespace tkge::graphics
1212
vk::PrimitiveTopology topology{vk::PrimitiveTopology::eTriangleList};
1313
vk::PolygonMode polygonMode{vk::PolygonMode::eFill};
1414
};
15-
} // namespace tkge::graphics
15+
} // namespace Tkge::Graphics
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#pragma once
2-
#include <tkge/graphics/vertex.hpp>
2+
#include <Tkge/Graphics/Vertex.hpp>
33
#include <span>
44

5-
namespace tkge::graphics
5+
namespace Tkge::Graphics
66
{
77
struct Primitive
88
{
@@ -11,4 +11,4 @@ namespace tkge::graphics
1111

1212
vk::PrimitiveTopology topology{vk::PrimitiveTopology::eTriangleList};
1313
};
14-
} // namespace tkge::graphics
14+
} // namespace Tkge::Graphics

lib/include/tkge/graphics/renderer.hpp renamed to Lib/Include/Tkge/Graphics/Renderer.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
#pragma once
2+
#include <Tkge/Graphics/Primitive.hpp>
3+
#include <Tkge/Graphics/ResourcePool.hpp>
24
#include <kvf/render_pass.hpp>
3-
#include <tkge/graphics/primitive.hpp>
4-
#include <tkge/graphics/resource_pool.hpp>
55

6-
namespace tkge::graphics
6+
namespace Tkge::Graphics
77
{
88
class Renderer
99
{
@@ -40,4 +40,4 @@ namespace tkge::graphics
4040
vk::PolygonMode _polygonMode{vk::PolygonMode::eFill};
4141
float _lineWidth{1.0f};
4242
};
43-
} // namespace tkge::graphics
43+
} // namespace Tkge::Graphics

lib/include/tkge/graphics/resource_pool.hpp renamed to Lib/Include/Tkge/Graphics/ResourcePool.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
#pragma once
2+
#include <Tkge/Graphics/PipelineFixedState.hpp>
3+
#include <Tkge/Graphics/Shader.hpp>
24
#include <kvf/vma.hpp>
3-
#include <tkge/graphics/pipeline_fixed_state.hpp>
4-
#include <tkge/graphics/shader.hpp>
55

6-
namespace tkge::graphics
6+
namespace Tkge::Graphics
77
{
88
using Buffer = kvf::vma::Buffer;
99

@@ -21,4 +21,4 @@ namespace tkge::graphics
2121
/// \brief Allocate a Buffer for given usage and of given size.
2222
[[nodiscard]] virtual Buffer& AllocateBuffer(vk::BufferUsageFlags usage, vk::DeviceSize size) = 0;
2323
};
24-
} // namespace tkge::graphics
24+
} // namespace Tkge::Graphics

lib/include/tkge/graphics/shader.hpp renamed to Lib/Include/Tkge/Graphics/Shader.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#include <cstdint>
44
#include <span>
55

6-
namespace tkge::graphics
6+
namespace Tkge::Graphics
77
{
88
class Shader
99
{
@@ -20,4 +20,4 @@ namespace tkge::graphics
2020
vk::UniqueShaderModule _fragment{};
2121
std::size_t _hash{};
2222
};
23-
} // namespace tkge::graphics
23+
} // namespace Tkge::Graphics

lib/include/tkge/graphics/vertex.hpp renamed to Lib/Include/Tkge/Graphics/Vertex.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22
#include <glm/vec2.hpp>
33
#include <glm/vec4.hpp>
44

5-
namespace tkge::graphics
5+
namespace Tkge::Graphics
66
{
77
struct Vertex
88
{
99
glm::vec2 position{};
1010
glm::vec4 colour{1.0f};
1111
glm::vec2 uv{};
1212
};
13-
} // namespace tkge::graphics
13+
} // namespace Tkge::Graphics
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
#pragma once
2-
#include <tkge/graphics/vertex.hpp>
2+
#include <Tkge/Graphics/Vertex.hpp>
33
#include <cstdint>
44
#include <span>
55
#include <vector>
66

7-
namespace tkge::graphics
7+
namespace Tkge::Graphics
88
{
99
struct VertexArray
1010
{
@@ -15,4 +15,4 @@ namespace tkge::graphics
1515
void Clear();
1616
auto Append(std::span<const Vertex> vertices, std::span<const std::uint32_t> indices) -> VertexArray&;
1717
};
18-
} // namespace tkge::graphics
18+
} // namespace Tkge::Graphics

lib/src/assetLoader.cpp renamed to Lib/Src/AssetLoader.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#include <tkge/assetLoader.hpp>
1+
#include <Tkge/AssetLoader.hpp>
22
#include <filesystem>
33

44
#ifdef _WIN32
@@ -10,7 +10,7 @@
1010
#include <minwindef.h>
1111
#endif
1212

13-
std::vector<std::filesystem::path> tkge::AssetLoader::GetSearchPaths() const
13+
std::vector<std::filesystem::path> Tkge::AssetLoader::GetSearchPaths() const
1414
{
1515
std::vector<std::filesystem::path> paths{};
1616

@@ -21,7 +21,7 @@ std::vector<std::filesystem::path> tkge::AssetLoader::GetSearchPaths() const
2121
GetModuleFileNameA(nullptr, buffer, MAX_PATH);
2222

2323
paths.push_back(std::filesystem::path{buffer}.parent_path());
24-
paths.push_back(paths.back() / "assets");
24+
paths.push_back(paths.back() / "Assets");
2525
#else
2626
#endif
2727

0 commit comments

Comments
 (0)