43 lines
988 B
C++
43 lines
988 B
C++
#ifndef TEXTINPUTNODE_H
|
|
#define TEXTINPUTNODE_H
|
|
|
|
#include "scene/gui/guinode.h"
|
|
#include <iostream>
|
|
|
|
#include "scene/textnode.h"
|
|
#include "scene/gui/callback.h"
|
|
|
|
class TextInputNode : public GUINode
|
|
{
|
|
glm::vec2 m_dimension;
|
|
bool m_hasFocus;
|
|
float m_font_size;
|
|
|
|
TextNode* m_text_mesh;
|
|
std::string m_text;
|
|
glm::vec3 m_text_color;
|
|
|
|
MeshNode* m_cursor_mesh;
|
|
unsigned int m_cursor_pos;
|
|
|
|
int m_move_cursor_left;
|
|
int m_move_cursor_right;
|
|
|
|
CallBack* m_callback;
|
|
|
|
public:
|
|
TextInputNode(glm::vec2 dimension);
|
|
void update();
|
|
glm::vec2 getDimension(){return m_dimension;}
|
|
|
|
void setFocus(bool focus);
|
|
void setTextColor(glm::vec3 color);
|
|
std::string getText();
|
|
void setCallBack(CallBack* callback){m_callback = callback;}
|
|
void setMoveCursorLeft(int action){m_move_cursor_left = action;}
|
|
void setMoveCursorRight(int action){m_move_cursor_right = action;}
|
|
void clearText(){m_text.clear();}
|
|
};
|
|
|
|
#endif // TEXTINPUTNODE_H
|