get RectBase worki

This commit is contained in:
2024-07-30 14:04:36 -04:00
parent 0283d43c44
commit 25134fee1d
3 changed files with 27 additions and 1 deletions

View File

@@ -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});

View File

@@ -2,6 +2,8 @@
namespace JUI {
RectBase::RectBase() {}
bool RectBase::GetClipsDescendants() const { return clips_descendants;}
void RectBase::SetClipsDescendants(bool clipping) { clips_descendants = clipping;}

View File

@@ -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;
}
}