verus/HelloTriangle/src/HelloTriangleGame.h

53 lines
1.3 KiB
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// Copyright (C) 2021-2022, Dmitry Maluev (dmaluev@gmail.com). All rights reserved.
#pragma once
namespace verus::Game
{
// Epigraph
// "Vulkan (it takes) 1000 lines to draw a triangle"
// "- I thought you only needed 3 lines to draw a triangle"
// https://www.reddit.com/r/linux/comments/58fyqn/vulkan_1000_lines_to_draw_a_triangle/
class HelloTriangleGame : public Singleton<HelloTriangleGame>, public BaseGame
{
struct Vertex
{
float _x, _y, _z;
UINT32 _color;
};
VERUS_TYPEDEFS(Vertex);
VERUS_UBUFFER_STRUCT UB_ShaderVS
{
matrix _matWVP;
};
VERUS_UBUFFER_STRUCT UB_ShaderFS
{
float _phase;
};
CGI::GeometryPwn _geo;
CGI::ShaderPwn _shader;
CGI::PipelinePwn _pipe;
CSZ _shaderCode;
UB_ShaderVS _ubShaderVS;
UB_ShaderFS _ubShaderFS;
int _vertCount = 0;
public:
HelloTriangleGame();
~HelloTriangleGame();
virtual void BaseGame_UpdateSettings(App::Window::RDesc windowDesc) override;
virtual void BaseGame_LoadContent() override;
virtual void BaseGame_UnloadContent() override;
virtual void BaseGame_Update() override;
virtual void BaseGame_Draw() override;
virtual void BaseGame_DrawView(CGI::RcViewDesc viewDesc) override;
};
VERUS_TYPEDEFS(HelloTriangleGame);
}
#define VERUS_QREF_GAME Game::RHelloTriangleGame game = Game::HelloTriangleGame::I()