mirror of
https://github.com/celisej567/mcpe.git
synced 2026-09-17 20:10:23 +03:00
* Initial commit.
:)
This commit is contained in:
46
source/GUI/TextInputBox.hpp
Normal file
46
source/GUI/TextInputBox.hpp
Normal file
@@ -0,0 +1,46 @@
|
||||
#pragma once
|
||||
|
||||
#include "Utils.hpp"
|
||||
#include "GuiComponent.hpp"
|
||||
|
||||
class Minecraft;
|
||||
|
||||
// @NOTE: This is NOT original Mojang code.
|
||||
|
||||
#ifndef ORIGINAL_CODE
|
||||
|
||||
class TextInputBox : public GuiComponent
|
||||
{
|
||||
public:
|
||||
TextInputBox(int id, int x, int y);
|
||||
TextInputBox(int id, int x, int y, int width, int height);
|
||||
TextInputBox(int id, int x, int y, int width, int height, const std::string& placeholder);
|
||||
TextInputBox(int id, int x, int y, int width, int height, const std::string& placeholder, const std::string& text);
|
||||
|
||||
void init(Font* pFont);
|
||||
void setEnabled(bool bEnabled);
|
||||
void keyPressed(Minecraft*, int key);
|
||||
void charPressed(int chr);
|
||||
void render();
|
||||
void tick();
|
||||
void setFocused(bool b);
|
||||
void onClick(int x, int y);
|
||||
bool clicked(int x, int y);
|
||||
|
||||
private:
|
||||
int m_ID = 0;
|
||||
int m_xPos = 0;
|
||||
int m_yPos = 0;
|
||||
int m_width = 0;
|
||||
int m_height = 0;
|
||||
std::string m_placeholder;
|
||||
std::string m_text;
|
||||
bool m_bFocused = false;
|
||||
bool m_bEnabled = true;
|
||||
bool m_bCursorOn = true;
|
||||
int m_insertHead = 0;
|
||||
int m_lastFlashed = 0;
|
||||
Font* m_pFont = nullptr;
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user