get RectBase worki
This commit is contained in:
2
main.cpp
2
main.cpp
@@ -12,6 +12,7 @@
|
||||
#include <iostream>
|
||||
#include <JGL/JGL.h>
|
||||
#include "JUI/Widgets/Rect.hpp"
|
||||
//#include "JUI/Widgets/Button.hpp"
|
||||
#include "JUI/Widgets/Scene.hpp"
|
||||
#include "JUI/Widgets/Text.hpp"
|
||||
#include <rewindow/types/window.h>
|
||||
@@ -26,6 +27,7 @@ JUI::Scene* CreateScene() {
|
||||
Scene* root = new Scene();
|
||||
|
||||
Rect* element = new Rect(root);
|
||||
//Button* element = new Button(root);
|
||||
element->SetName("JimBob");
|
||||
//element->BGColor({0,255,0});
|
||||
element->BGColor({0, 64, 0});
|
||||
|
@@ -2,6 +2,8 @@
|
||||
|
||||
|
||||
namespace JUI {
|
||||
RectBase::RectBase() {}
|
||||
|
||||
bool RectBase::GetClipsDescendants() const { return clips_descendants;}
|
||||
|
||||
void RectBase::SetClipsDescendants(bool clipping) { clips_descendants = clipping;}
|
||||
|
@@ -1 +1,23 @@
|
||||
#include <JUI/Widgets/Button.hpp>
|
||||
#include <JUI/Widgets/Button.hpp>
|
||||
#include <jlog/jlog.hpp>
|
||||
|
||||
namespace JUI
|
||||
{
|
||||
Button::Button(): Widget() {}
|
||||
|
||||
Button::Button(Widget *parent): Button() {
|
||||
this->SetParent(parent);
|
||||
};
|
||||
|
||||
bool Button::IsMouseInside() const {
|
||||
DEBUG("IM A BUTTON DADDY")
|
||||
float x = last_known_mouse_pos.x;
|
||||
float y = last_known_mouse_pos.y;
|
||||
auto pos = GetAbsolutePosition();
|
||||
auto size = GetAbsoluteSize();
|
||||
|
||||
if (x > pos.x && y > pos.y && x < pos.x + size.x && y < pos.y + size.y)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user