# 0.2.7-2
- Start dev on UI7 IO - Add NoRezize flag and rezising - Fix Bug in DebugLabels - Use view Area for Menu Pos and Size - Only set Viewarea once in BeginMenu
This commit is contained in:
@ -38,7 +38,8 @@ enum UI7MenuFlags_ {
|
||||
UI7MenuFlags_NoBackground = 1 << 4, ///< Dont Render Menu Background
|
||||
UI7MenuFlags_NoClipRect = 1 << 5, ///< Disable clip render area of the Menu
|
||||
UI7MenuFlags_NoCollapse = 1 << 6, ///< Disable Menu Collapse
|
||||
UI7MenuFlags_NoMove = 1 << 7, ///< Disable Window Movement
|
||||
UI7MenuFlags_NoMove = 1 << 7, ///< Disable Menu Movement
|
||||
UI7MenuFlags_NoResize = 1 << 8, ///< Disable Menu Resize
|
||||
// Enable Horizontal and Vertical Scrolling
|
||||
UI7MenuFlags_Scrolling = UI7MenuFlags_HzScrolling | UI7MenuFlags_VtScrolling,
|
||||
};
|
||||
|
60
include/pd/ui7/io.hpp
Normal file
60
include/pd/ui7/io.hpp
Normal file
@ -0,0 +1,60 @@
|
||||
#pragma once
|
||||
|
||||
/*
|
||||
MIT License
|
||||
Copyright (c) 2024 - 2025 René Amthor (tobid7)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <pd/core/common.hpp>
|
||||
#include <pd/core/timer.hpp>
|
||||
#include <pd/ui7/drawlist.hpp>
|
||||
#include <pd/ui7/flags.hpp>
|
||||
#include <pd/ui7/menu.hpp>
|
||||
#include <pd/ui7/theme.hpp>
|
||||
|
||||
namespace PD {
|
||||
namespace UI7 {
|
||||
/**
|
||||
* Shared Configuration and Runtime Data for a UI7 Context
|
||||
*/
|
||||
class IO : public SmartCtor<IO> {
|
||||
public:
|
||||
/**
|
||||
* IO Constructor setting UP References
|
||||
*/
|
||||
IO(Hid::Ref input_driver) {
|
||||
Time = Timer::New();
|
||||
Theme = UI7::Theme::New();
|
||||
Inp = input_driver;
|
||||
};
|
||||
~IO() = default;
|
||||
|
||||
float Framerate = 0.f;
|
||||
float Delta = 0.f;
|
||||
Timer::Ref Time;
|
||||
Hid::Ref Inp;
|
||||
UI7::Theme::Ref Theme;
|
||||
float MenuPadding = 5.f;
|
||||
DrawList::Ref Back;
|
||||
DrawList::Ref Front;
|
||||
};
|
||||
} // namespace UI7
|
||||
} // namespace PD
|
@ -158,7 +158,7 @@ class Menu : public SmartCtor<Menu> {
|
||||
* Get the Cursor Position
|
||||
* @return Cursor Pos
|
||||
*/
|
||||
vec2 Cursor() const { return pos + cursor; }
|
||||
vec2 Cursor() const { return view_area.xy() + cursor; }
|
||||
/**
|
||||
* Set the Cursor position
|
||||
* @note The old Position can be restored with RestoreCursor
|
||||
@ -347,7 +347,7 @@ class Menu : public SmartCtor<Menu> {
|
||||
vec2 cursor; ///< Current Cursor Position
|
||||
vec2 bcursor; ///< Backup Cursor
|
||||
vec2 slcursor; ///< Sameline Cursor
|
||||
vec4 view_area; ///< view Area
|
||||
vec4 view_area; ///< view Area (Position and Size)
|
||||
vec4 main_area; ///< Main Area [Input related]
|
||||
vec2 scrolling_off; ///< Scrolling Position
|
||||
bool scrolling[2]; ///< Is Hz or Vt Scrolling Enabled
|
||||
@ -356,7 +356,7 @@ class Menu : public SmartCtor<Menu> {
|
||||
bool scrollbar[2]; ///< Is Hz or Vt Scrollbar rendered
|
||||
bool scroll_allowed[2]; ///< Is Hz or Vt Scrolling Alowed
|
||||
bool has_touch; ///< Menu has touch (depends on screen)
|
||||
bool is_open = true; ///< For Collapse Event
|
||||
bool is_open = true; ///< For Collapse Event
|
||||
|
||||
Container::Ref tmp_parent; ///< Parent Container (for better alignment etc)
|
||||
|
||||
@ -378,7 +378,6 @@ class Menu : public SmartCtor<Menu> {
|
||||
vec2 mouse; ///< Mouse/Touch Position
|
||||
vec2 bslpos; ///< Before Sameline Position
|
||||
vec2 last_size; ///< Last Object Size
|
||||
vec2 pos; ///< Menu Position
|
||||
|
||||
// Theme
|
||||
Theme::Ref theme;
|
||||
|
@ -28,6 +28,7 @@ SOFTWARE.
|
||||
#include <pd/ui7/drawlist.hpp>
|
||||
#include <pd/ui7/flags.hpp>
|
||||
#include <pd/ui7/id.hpp>
|
||||
#include <pd/ui7/io.hpp>
|
||||
#include <pd/ui7/menu.hpp>
|
||||
#include <pd/ui7/theme.hpp>
|
||||
/**
|
||||
@ -36,7 +37,7 @@ SOFTWARE.
|
||||
* Major Minor Patch Build
|
||||
* 0x01010000 -> 1.1.0-0
|
||||
*/
|
||||
#define UI7_VERSION 0x00020701
|
||||
#define UI7_VERSION 0x00020702
|
||||
|
||||
namespace PD {
|
||||
namespace UI7 {
|
||||
@ -58,6 +59,7 @@ class Context : public SmartCtor<Context> {
|
||||
/// Set the Internal References
|
||||
this->ren = ren;
|
||||
this->inp = hid;
|
||||
io = IO::New(hid);
|
||||
/// Init Theme and Front / Back Drawlists
|
||||
theme = Theme::New();
|
||||
back = DrawList::New(ren);
|
||||
@ -125,6 +127,9 @@ class Context : public SmartCtor<Context> {
|
||||
/** Get the Root Layer of the Menu */
|
||||
int RootLayer() const { return root_layer; }
|
||||
|
||||
/** Get IO Reference */
|
||||
IO::Ref GetIO() { return io; }
|
||||
|
||||
// Debugging / Demo / About
|
||||
|
||||
/** About Menu */
|
||||
@ -167,6 +172,9 @@ class Context : public SmartCtor<Context> {
|
||||
|
||||
// Deltatime Average
|
||||
TimeStats::Ref s_delta;
|
||||
|
||||
// IO
|
||||
IO::Ref io;
|
||||
};
|
||||
} // namespace UI7
|
||||
} // namespace PD
|
Reference in New Issue
Block a user