You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

40 lines
1.2 KiB

#ifndef INPUTCOMPONENT_H
#define INPUTCOMPONENT_H
#include <GL/glew.h>
#include <string>
#include "BoxComponent.h"
#include "TextComponent.h"
#include "../../scheduler.h"
class Window;
class InputComponent : public BoxComponent {
public:
//: BoxComponent(rawX, rawY, rawWidth, rawHeight, passedWindowWidth, passedWindowHeight) { }
InputComponent(const float rawX, const float rawY, const float rawWidth, const float rawHeight, const int passedWindowWidth, const int passedWindowHeight);
// or
//using BoxComponent::BoxComponent;
void resize(const int passedWindowWidth, const int passedWindowHeight);
void render();
void addChar(char c);
void backSpace();
void updateCursor();
void updateText();
std::string value="";
TextComponent *userInputText = nullptr;
BoxComponent *cursorBox = nullptr;
std::function<void(std::string value)> onEnter = nullptr;
// needed for our shader's resizing
int lastRenderedWindowHeight;
bool focused = false;
bool showCursor = true;
std::shared_ptr<timer_handle> cursorTimer = nullptr;
// store for cursor
int cursorStartAtX;
int cursorStartAtY;
TagNode *node = nullptr;
bool multiLine = false; // textarea control
};
#endif