GithubHelp home page GithubHelp logo

fruxo / turbobadger Goto Github PK

View Code? Open in Web Editor NEW
576.0 576.0 84.0 10.68 MB

Small footprint UI library for hardware accelerated games & applications

CMake 0.56% C++ 97.55% Objective-C 0.12% Makefile 0.40% C 0.47% Java 0.82% Batchfile 0.08%

turbobadger's People

Contributors

cleroth avatar codecat avatar fruxo avatar fungos avatar l0calh05t avatar littlecodingfox avatar mgerhardy avatar mrgnu avatar nsf avatar rongzhou avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

turbobadger's Issues

Splitter

Is there a way to get a splitter control ?

thanks

Improve connection support (or remove it?)

The widget connections (TBWidgetConnection/TBWidgetValue) only have one global name space and isn't super useful.

It would be much more usable if widgets could be connected to node values in TBNodeRefTree. Then the connections would have different name spaces (by tree and request), and could f.ex connect directly to persistent node tree (f.ex settings).

Font description in skin

I can set text color in skin but can't set font description (name, size end etc), I think it is a little strange :) When I need to describe a lot of text wigets in resource I also need set font's attributes for every widget, but I could desctibe this in skin once!

Canvas widget ? (Integration with nanoVG)

Congrats for such an impressive engine, it is really nicely architectured, very lean CPU usage wise and can give a terrific look to desktop applications.

I know the TB engine is bitmap based, but it would be nice to be able to integrate nanovg (very small C header only vector renderer) to have some vector rendering available.

One (of many) hurdles to overcome is that currently nanovg provided backends use at least OpenGL 2.0 (fragment shaders required) so I wonder if it could be done.

So I suppose my real question is: Do you plan adding a canvas widget to turbobadger ?

Allow Ctrl+wheel to be used for zoom on TBScrollContainer.

In my own copy of tb_scroll_container.cpp, I've made the following change to allow Ctrl-wheel events to be used for zooming. The current code applies all wheel events to the scroll bar. I tried return true in my application message handling, but it seems the scroll had already been applied.

@@ -217,9 +219,12 @@ bool TBScrollContainer::OnEvent(const TBWidgetEvent &ev)
217 219     }
218 220     else if (ev.type == EVENT_TYPE_WHEEL)
219 221     {
220     -       double old_val = m_scrollbar_y.GetValueDouble();
221     -       m_scrollbar_y.SetValueDouble(old_val + ev.delta_y * TBSystem::GetPixelsPerLine());
222     -       return m_scrollbar_y.GetValueDouble() != old_val;
222 +       if (0 == (TB_CTRL & ev.modifierkeys))
223 +       {
224 +           double old_val = m_scrollbar_y.GetValueDouble();
225 +           m_scrollbar_y.SetValueDouble(old_val + ev.delta_y * TBSystem::GetPixelsPerLine());
226 +           return m_scrollbar_y.GetValueDouble() != old_val;
227 +       }
223 228     }
224 229     else if (ev.type == EVENT_TYPE_KEY_DOWN)
225 230     {

tooltips on onenter/onexit events

Hi,

I learning your turbo badger gui library and I think it amazing, light,
and elegant gui library. Thank you very much for your work!
Just one question: I trying to implement tooltips for my custom widget
(derived from TBWidget) used in desktop application. I created my
TBTooltip derived from TBPopupWindow but I need event (or something
like) where I can show and hide tooltip. I think the best way are events
on mouse enter and mouse exit to widget, but I didn't found them in
turbo badger. It would be great if you implement this events in future,
it will be useful for custom widgets in desktop applications.

Could you point me simplest way to implement tooltips? I think about
"EVENT_TYPE_POINTER_MOVE and timers" solution but I don't like this.

Thank you!

Mingw compile error: 'strdup' was not declared in this scope

I am trying to compile turbobadger from source with Cmake and Mingw32
I ran into some troubles during build-process in eclipse:

cd /d C:\Users\xxx\devel\turbobadger-master\BUILD\src\tb && C:\MinGW\bin\g++.exe    -std=c++11 -fno-exceptions -fno-rtti -Wall -Wextra -Wno-unused-parameter @CMakeFiles/TurboBadgerLib.dir/includes_CXX.rsp   -o CMakeFiles\TurboBadgerLib.dir\tb_node_tree.cpp.obj -c C:\Users\Jan\Desktop\turbobadger-master\src\tb\tb_node_tree.cpp
C:\Users\Jan\Desktop\turbobadger-master\src\tb\tb_node_tree.cpp: In static member function 'static tb::TBNode* tb::TBNode::Create(const char*)':
C:\Users\xxx\devel\turbobadger-master\src\tb\tb_node_tree.cpp:26:37: error: 'strdup' was not declared in this scope
  if (!n || !(n->m_name = strdup(name)))
                                     ^
src\tb\CMakeFiles\TurboBadgerLib.dir\build.make:750: recipe for target 'src/tb/CMakeFiles/TurboBadgerLib.dir/tb_node_tree.cpp.obj' failed
mingw32-make[2]: *** [src/tb/CMakeFiles/TurboBadgerLib.dir/tb_node_tree.cpp.obj] Error 1 

Which is strange, because eclipse recognizes that function and links to the string.h file.
I believe, that this could have to do with the -std=c++11 flag. Any ideas on this?

Need help in figuring out the right way to clip TBRect in SetClipRect method

Hi,

I've managed to port a SDL OpenGL version's TurboBadgerDemo based on the OpenGL renderer (tb_renderer_gl.*) and sample files from TurboBadger-Urho3D integration and port_glfw as an exercise in order to know more about this wonderful library. Now I'm trying a batched OpenGL renderer to do the rendering. I've got almost everything done except for the clipping of the rects in the SetClipRect method. Here's an image to illustrate that;

Is there any tips or hints on how should I proceed to solve this? The camera is already inverted so the origin of Y coordinate is from the top.

Many thanks,

Cheers,

Set the disabled opacity for a single child widget.

Hi

This is more of a question than an issue. I apologize if there is another place where questions can be asked that I did not manage to find.

Currently I'm busy with a project where I have a parent widget with 3 children editfields. When I disable the parent all children also gets disabled which is as expected and hoped for, but is there any way to change the disabled opacity of a single child editfield when the parent is disabled.

I've tried a few things without changing any of the turbobadger code to no avail. Is there a way you can suggest maybe?

Submitting renderbatches to custom OpenGL renderer

Hi,

I'm trying to integrate TurboBadger with my application that uses a custom OpenGL render batches. The pseudo format for the custom render batches is as the following;
RenderBatch(destination rect, source UV rect, GLuint GL texture id, depth float);

From what I understand, TB would generate a texture atlas for all the loaded texture resources before binding it to OpenGL. My question is, how can I get the source UV rect from the texture atlas so that I can supply that to the custom render batcher above?

Also, as TB is a good GUI library, is there any plan for a simple beginner tutorial probably using glut to highlight best practices using TB, as that could help those whom are interested in using the GUI lib?

Thanks.

Windows in windows

Is there a way to create a MDI like application ?
A way to insert (or more specifically dock) windows in a larger parent windows
like all traditionall desktop application provide.

I tried to nest TBWindows in resources but without effect.

Two question.

It's good UI lib for game programming I think.
I have two question, first, I saw the example for Android. Does it support IOS? I want to use it in some ios app.
Second, When using TBLayout or TBContainer, or anything, How can I get SAME width Button. F.ex button with text "a" and Botton with text "LONG BUTTON" have the same Width.
Thanks

TU-independent type identification - DSO support

Currently, the type IDs are represented by static class members, which are not shared across translation unit (so/dll) boundaries, so the TypeID-based methods between them fail.

Otherwise, TB seems to work well in shared builds.

I was able to generate TU-independent TypeIDs with TBGetHash(ClassName) which is resolved at compile-time with constexpr. Did not finish the implementation, but it may be an idea.

Child receives input when parent is invisible.

According to comment, a widget receives input only if WIDGET_VISIBILITY == WIDGET_VISIBILITY_VISIBILE. When I set my parent to not visible, the parent and child does not show, even though child has WIDGET_VISIBILITY_VISIBLE. This is probably correct behaviour, since setting parent visible again should preserve the WIDGET_VISIBILITY of each child.

However, since my child has WIDGET_VISIBILITY_VISIBLE and in addition is the focused widget, it continues to receive input even if it is not shown.

Glut dependency because of TBSystem::RescheduleTimer

turbobadger currently doesn't work on Windows without glut due to TBSystem::RescheduleTimer. The implementation for this on windows is empty and commented out. I uncommented out and it seems to work just fine. Is TBSystem::RescheduleTimer really required?

lilili

At line 452, tb_widgets.h: SetVisibilility

Advanced glyph scan and render algorithms

I have problem with fonts which rasterized in picture with anti-aliasing (in photoshop). Current glyph scan algoritm calculating wrong glyph size and the lettering in TB looks ugly (because spaces between) symbols are incorrect. And the constant advance_delta is not enough to compensate this.
I see two ways:
Easy: setting advance_delta per glyph in font description. Only for glyph that scanned wrong/
Advances: with font bitmap also setting font bitmap mask, where glyphs rasterized in same coordinates but without anti-aliasing (and shadows/blurs and etc). Glyphs scan algoritm must use these mask to calculate logical glyph size and advance.

Turbobadger hangs on `TB_KEY_TAB`

๐Ÿชฒ :

My root TBWidget do not contain any focusable child (GetIsFocuable() == false): only a TBWindow with TBLayout, TBImageWidget and TBTextField. When I press tab, the TB_KEY_TAB is invoked on my root, and the call eventually ends up MoveFocus(bool ). And then the while (current) loop runs forever: No child handles the focus, current becomes nullptr, and the loop start again with the first child of root (tb_widgets.cpp:620 current = forward ? root->GetFirstChild() : root->GetLastLeaf();).

I thank you much for this nice library, @fruxo :) :)

TurboBadgerDemo can not load UI on mac

OSX 10.10.4

run ./TurboBadgerDemo

image

console output:

Initiating Turbo Badger - version 0.1.1
Running tests...
PASS: "tb_widget_value_listener/change_with_no_widgets"
PASS: "tb_widget_value_listener/change_with_widgets"
PASS: "tb_widget_value_listener/change_widget"
PASS: "tb_widget_value_int/connect"
PASS: "tb_widget_value_int/change_value"
PASS: "tb_widget_value_int/change_widget"
PASS: "tb_widget_value_text/connect"
PASS: "tb_widget_value_text/change_value"
PASS: "tb_widget_value_text/change_widget"
PASS: "tb_value/node_create_on_get"
PASS: "tb_test_multiple_calls/test_1"
PASS: "tb_test_multiple_calls/test_2"
PASS: "tb_test/single_test"
PASS: "tb_tempbuffer/append_path_1"
PASS: "tb_tempbuffer/append_path_2"
PASS: "tb_tempbuffer/append_path_3"
PASS: "tb_tempbuffer/append_string"
PASS: "tb_editfield/settext_singleline"
PASS: "tb_editfield/settext_multiline"
PASS: "tb_editfield/settext_singleline_malformed_utf8"
PASS: "tb_editfield/settext_undoredo_ins"
PASS: "tb_editfield/settext_undoredo_ins_scattered"
PASS: "tb_editfield/settext_undoredo_ins_multiline"
PASS: "tb_editfield/settext_undoredo_del"
PASS: "tb_editfield/settext_undoredo_ins_linebreak_1"
PASS: "tb_editfield/settext_undoredo_ins_linebreak_2"
PASS: "tb_editfield/settext_undoredo_ins_linebreak_3"
PASS: "tb_editfield/settext_undoredo_ins_linebreak_4"
PASS: "tb_editfield/settext_undoredo_bugfix1"
PASS: "tb_editfield/settext_insert_linebreaks_move"
PASS: "tb_editfield/multiline_overflow_1"
PASS: "tb_space_allocator/free_when_full"
PASS: "tb_space_allocator/free_all"
PASS: "tb_space_allocator/free_scattered"
PASS: "tb_parser/strings"
PASS: "tb_parser/strings_compact"
PASS: "tb_parser/numbers"
PASS: "tb_parser/numbers_compact"
PASS: "tb_parser/numbers_with_unit"
PASS: "tb_parser/compact_with_children"
PASS: "tb_parser/compact_no_value"
PASS: "tb_parser/arrays_numbers"
PASS: "tb_parser/arrays_dimensions"
PASS: "tb_parser/strings_multiline"
PASS: "tb_parser/comments_and_space"
PASS: "tb_parser/include_file"
PASS: "tb_parser/include_locally"
PASS: "tb_parser/conditions"
TBNodeRefTree::ResolveNode - Node not found on request "@>defines>colors>broken"
TBNodeRefTree::ResolveNode - Reference loop detected on request "@>defines_test>cycle" from node "@>defines_test>cycle"
PASS: "tb_parser/local_ref"
PASS: "tb_object/safe_cast"
PASS: "tb_node_ref_tree/change_on_set"
PASS: "tb_node_ref_tree/reference_value"
TBNodeRefTree::ResolveNode - Reference loop detected on request "@test_bar>bar_circular" from node "@test_foo>foo_circular"
TBNodeRefTree::ResolveNode - Node not found on request "@test_foo>foo_broken_node"
TBNodeRefTree::ResolveNode - No tree found for request "@test_bad_tree>foo" from node "@test_bad_tree>foo"
TBNodeRefTree::ResolveNode - Reference loop detected on request "@test_bar>bar_circular" from node "@test_foo>foo_circular"
TBNodeRefTree::ResolveNode - No tree found for request "@test_bad_tree>does_not_exist" from node "@test_bad_tree>does_not_exist"
PASS: "tb_node_ref_tree/reference_value_recurse"
PASS: "tb_node_ref_tree/reference_include"
PASS: "tb_node_ref_tree/reference_local_include"
PASS: "tb_node_ref_tree/reference_condition"
PASS: "tb_node_ref_tree/reference_condition_branch_insert_order"
PASS: "tb_linklist/iteration_while_delete_all"
PASS: "tb_linklist/iteration_while_delete"
PASS: "tb_linklist/iteration_while_list_delete"
PASS: "tb_linklist/forward_iterator"
PASS: "tb_linklist/backward_iterator"
PASS: "tb_linklist/multiple_iterators_assign"
PASS: "tb_linklist/multiple_iterators_assign_swap_list"
PASS: "tb_linklist/autodelete"
PASS: "tb_geometry/TBRegion_include"
PASS: "tb_geometry/TBRegion_include_adjecent_coalesce"
PASS: "tb_geometry/TBRegion_include_overlap_coalesce"
PASS: "tb_geometry/TBRegion_include_overlap_multi_coalesce"
PASS: "tb_geometry/TBRegion_exclude"
PASS: "tb_dimension_converter/set_from_string_unspecified"
PASS: "tb_dimension_converter/set_from_string_px"
PASS: "tb_dimension_converter/set_from_string_dp"
PASS: "tb_color/set_from_string_rrggbbaa"
PASS: "tb_color/set_from_string_rrggbb"
PASS: "tb_color/set_from_string_rgba"
PASS: "tb_color/set_from_string_rgb"
PASS: "tb_color/set_from_string_invalid"
Test results: 78 passed, 0 failed.
Program ended with exit code: 0

Port to cinder's problem

I want to port this gui lib to cinder. But I has a trouble. short to say.

void TestUiApp::draw()
{
// clear out the window with black
gl::clear( Color( 0, 0, 0 ) );
glClearDepth(1.0f);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
drawPoints();
gl::pushMatrices();
drawUi();
gl::popMatrices();
}

void TestUiApp::drawUi() {
m_renderer->BeginPaint(getWindowWidth(), getWindowHeight());
m_root.InvokePaint(TBWidget::PaintProps());
m_renderer->EndPaint();

// If animations are running, reinvalidate immediately
if (TBAnimationManager::HasAnimationsRunning())
    m_root.Invalidate();

}

i called drawUI but it's show nothing.
why?

TB_RENDERER_GL seems not used

I want to build minimal version of turbobadger, e.g. not using default renderer etc. Is this possible now? According to CMakeLists.txt from src/tb, all the source file are go to the build. Do you plan to support modular building?

Add CMake build files

I am using Mingw 4.8.2 on Qt creator but the Makefile provided odoes not support Windows(except by modifying the code). Currently, there are options for Linux and Mac OSX but not for Windows. Is it possible to have some Makefile options or special configurations for Windows? Or CMakeFiles.txt?
Thank you

Moving towards enabling -Wall -Wextra -Wno-unused-parameter

Just want to open an issue to track the progress on that thing.

At the moment there are three major sources of warnings left:

  1. utf8.cpp

    It is buggy and I'll fix it. I must add that I will not include a fix for TBCaret, because it will take more time for me to figure out what the blocks are and what all the logic is. (I'm new to turbobadger).

  2. Demo/platform/port_glfw.cpp - unused drop_callback function.

    #if (GLFW_VERSION_MAJOR >= 3 && GLFW_VERSION_MINOR >= 1)
        glfwSetDropCallback(mainWindow, drop_callback);
    #endif

    I guess I'll wrap the function around that if condition as well. It's not pretty, but for the sake of getting the warning out.

  3. 3rd party libraries.

    Here, it's stb_image.h, all of the warnings are unused functions, because of #define STB_IMAGE_STATIC. Which is a correct thing, maybe we should ignore the warnings or disable them. Disabling warnings is a compiler-specific feature. I can disable it for clang/gcc.

What are your thoughts on that?

Event binding

I don't see a way currently to bind events to custom functions. Therefore, this seems to be the current way of handling events:

bool ParentWindow::OnEvent(const TBWidgetEvent &ev)
{
if (ev.type == EVENT_TYPE_CLICK)
{
if (ev.target->GetID() == TBIDC("new"))
{
.....
}
else if (ev.target->GetID() == TBIDC(...))
{
....
}
else if (ev.target->GetID() == TBIDC(...))
{
....
}
}

Surely there has to be a better way! Is there a way to bind the functions to our own implementations using something like std:bind, for example? Or one of these methods: http://docs.wxwidgets.org/trunk/overview_events.html

This is a fantastic library, were it not for this seemingly missing functionality.

Positioning & size improvements in skin

Positioning and sizing of child elements is not really as powerful as it can be.
When creating skin elements without bitmaps, it doesn't know which size to use.

Add width & height. Perhaps a box-size (or positioning method) applied to all types of skin elements (and color fills). Clean up how it's applied to widgets.

SetClickByKey on TBEditField prevents space character

It would be nice to let enter trigger an event when typing characters in a TBEditField (for example when sending a short message). TBWidget::SetClickByKey() does this partly: TBEditField does not handle the EVENT_TYPE_CLICK created by enter click , so the parent widget is able to receiver this event (TBEditField::OnEvent() == false).

However, SetClickByKey() also works for space, making it impossible to type space character in the editfield (unless modifier key down, like shift).

Maybe a listener for each character typed in a TBEditField is a good idea?

TBEditField: caret and tags considering

Styling not affect on moving of text cursor.
When styling switched on, the caret move through text without consider the tags, and we can edit "invisible" text of tags.

Detecting when a pointer event was consumed

Something I noticed is that clicking doesn't have a way to check if the input was handled in some way by TB, which is a problem since for games you often want input to be interrupted halfway through if the UI uses it somehow: A click, mouse drag, anything that affects a widget would fit this criteria in this case.

I tried sending a manual event but it won't work, how should I extend TB to do this?

Support for node tree references and reference conditions

In addition to the file includes support (which is already implemented), it would be nice with support for:

-Reference to branches and/or values from same file or other node trees.
-Branch conditions (checking reference value to take/discard branch)

This would give it the power to work like Androids bucket & resource look up systems if wanted.

Double paste with (ctrl-v) in Linux

When doing Ctrl-C then Ctrl-V under Linux, I get a double paste. I managed to fix it by making the following change: (In Demo/thirdparty/glfw/src/x11_window.c)

@@ -515,10 +515,10 @@ static void processEvent(XEvent *event)
515 515              const int mods = translateState(event->xkey.state);
516 516              const int character = translateChar(&event->xkey);
517 517  
518     -            _glfwInputKey(window, key, event->xkey.keycode, GLFW_PRESS, mods);
519     -
520 518              if (character != -1)
521 519                  _glfwInputChar(window, character);
520 +            else
521 +                _glfwInputKey(window, key, event->xkey.keycode, GLFW_PRESS, mods);
522 522  
523 523              break;
524 524          }

While this fixes the problem for me, I'm not sure that it's the right place to make this change.

Message scheduleing bug in demo

Prerequisites for linux:
Implement the missing timer scheduling in Demo/platform/glfw_extra_linux.cpp (use by mac too). May use glfwPostEmptyEvent in the next version (>3.0.4) of glfw. This should stop the busy looping.

Cross platform bug:
Painting (glfwSwapBuffers) is currently throttling message processing due to vsync (in glfwSwapBuffers). Need to process messages in multiple cycles (as long as there is instant messages or until it's time to paint or pending input events).

support input unicode character

Currently it seems turbobadger doesn't support input unicode character (e.g., Chinese). Is there any plan to add this support? Thanks.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.