Removed some agame things; Added VSYNC
This commit is contained in:
37
include/object/ui/uitextbox.hpp
Normal file
37
include/object/ui/uitextbox.hpp
Normal file
@@ -0,0 +1,37 @@
|
||||
#pragma once
|
||||
|
||||
#include <object/entity.hpp>
|
||||
#include <renderer/font.hpp>
|
||||
#include <renderer/texture.hpp>
|
||||
#include <utility>
|
||||
#include <game/input.hpp>
|
||||
|
||||
namespace Game::Object {
|
||||
class UITextBox : public Entity {
|
||||
public:
|
||||
UITextBox(const std::string& name, std::shared_ptr<Renderer::Font> font, const Transform& transform, float x = 0.f, float y = 0.f);
|
||||
~UITextBox() override = default;
|
||||
|
||||
void start() override;
|
||||
void update(float deltaTime) override;
|
||||
|
||||
void setText(const std::string& text);
|
||||
std::string getText() const;
|
||||
std::string getValue() const;
|
||||
bool isFocused() const;
|
||||
|
||||
void setPosition(float x, float y) { mX = x; mY = y; }
|
||||
std::pair<float, float> getPosition() const { return {mX, mY}; }
|
||||
|
||||
private:
|
||||
bool isMouseInsideBox() const;
|
||||
void refreshVisualText();
|
||||
|
||||
float mX, mY;
|
||||
std::string mText;
|
||||
bool mIsFocused = false;
|
||||
float mBoxWidth = 0.f;
|
||||
float mBoxHeight = 0.f;
|
||||
bool mNeedsTextRefresh = true;
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user