Browse Source

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

pull/2/head
Odilitime 5 years ago
parent
commit
84a3261144
  1. 20
      src/graphics/components/Component.h

20
src/graphics/components/Component.h

@ -12,6 +12,9 @@ struct rgba { @@ -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: @@ -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: @@ -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: @@ -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

Loading…
Cancel
Save