50 lines
1.4 KiB
C++
50 lines
1.4 KiB
C++
|
|
#pragma once
|
|
|
|
#if !defined(SDL_GPU_TEST_PRIVATE_SDL_GPU_TEST_6_UI_APP_HPP_INCLUDED)
|
|
#define SDL_GPU_TEST_PRIVATE_SDL_GPU_TEST_6_UI_APP_HPP_INCLUDED 1
|
|
|
|
#include "../application.hpp"
|
|
#include "../gui/button.hpp"
|
|
#include "../gui/label.hpp"
|
|
#include "../gui/widget.hpp"
|
|
#include "../gui/ui_renderer.hpp"
|
|
#include "../sdlpp/gamepad.hpp"
|
|
|
|
namespace sdl_gpu_test
|
|
{
|
|
class UIApp : public Application
|
|
{
|
|
private:
|
|
sdlpp::GPUBuffer mVertexBuffer;
|
|
sdlpp::GPUTexture mDepthBuffer;
|
|
sdlpp::GPUGraphicsPipeline mMeshPipeline;
|
|
sdlpp::GPUTexture mTexture;
|
|
sdlpp::GPUSampler mSampler;
|
|
|
|
UIRenderer mUIRenderer;
|
|
WidgetTree mWidgetTree;
|
|
|
|
Label* mLabel;
|
|
Button* mButton;
|
|
|
|
sdlpp::Gamepad mGamepad;
|
|
Uint32 mNumVertices = 0;
|
|
Uint32 mLastSwapchainWidth = 1280;
|
|
Uint32 mLastSwapchainHeight = 720;
|
|
float mRotation = 0.f;
|
|
float mYPos = 1.5f;
|
|
public:
|
|
void init(const AppInitArgs& args) override;
|
|
void update(const AppUpdateArgs& args) override;
|
|
void handleKeyboardEvent(const sdlpp::KeyboardEvent& event) override;
|
|
void handleMouseMotionEvent(const sdlpp::MouseMotionEvent& event) override;
|
|
void handleMouseButtonEvent(const sdlpp::MouseButtonEvent&) override;
|
|
private:
|
|
void createMeshPipeline();
|
|
void processInput(const AppUpdateArgs& args);
|
|
};
|
|
} // namespace sdl_gpu_test
|
|
|
|
#endif // !defined(SDL_GPU_TEST_PRIVATE_SDL_GPU_TEST_6_UI_APP_HPP_INCLUDED)
|