Skip to content
Snippets Groups Projects
Commit 84a32611 authored by Odilitime's avatar Odilitime
Browse files

new resize prototype, boundToPage, indices, onMouseDown/onMouseUp/onFocus/onBlur

parent ee08b50a
No related branches found
No related tags found
No related merge requests found
......@@ -12,6 +12,9 @@ struct rgba {
unsigned int a;
};
// should have 2 classes after this
// non-rendererable component (wtf are these?)
// and renderable component
class Component {
public:
virtual ~Component();
......@@ -30,8 +33,12 @@ public:
// since we update the window size before resize, why just not pass it
// well no need to pass it if it's just a window* and then we'd already have it
// but we may hang onto the variables to know what the state is set up for
virtual void resize();
// why pass it here? on resize we call layout no this...
virtual void resize(const int passedWindowWidth, const int passedWindowHeight);
void pointToViewport(float &rawX, float &rawY) const ;
void distanceToViewport(float &rawX, float &rawY) const ;
// HELP I'M LOOKING FOR YOUR OPINION
// a ptr to window would be less memory
// but it would increase Component's depenedencies
......@@ -46,7 +53,11 @@ public:
*/
int windowWidth;
int windowHeight;
bool boundToPage = true;
const unsigned int indices[6] = {
0, 1, 2,
0, 2, 3
};
bool verticesDirty = false;
std::shared_ptr<Component> parent = nullptr;
std::shared_ptr<Component> previous = nullptr;
......@@ -93,7 +104,12 @@ public:
bool isVisibile = true;
bool isInline = false; // text-only thing but there maybe other non-text inline
bool textureSetup = false;
// probably shoudl be vector (or maybe use the event emitter)
std::function<void(int x, int y)> onMousedown = nullptr;
std::function<void(int x, int y)> onMouseup = nullptr;
std::function<void()> onClick = nullptr;
std::function<void()> onFocus = nullptr;
std::function<void()> onBlur = nullptr;
};
#endif
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment