GithubHelp home page GithubHelp logo

kallisti5 / guisan Goto Github PK

View Code? Open in Web Editor NEW
67.0 4.0 21.0 1.42 MB

A C++ SDL2 user interface library based on guichan. ~~~~ Oct, 2023 - This project is not abandoned, just not under active development. Pull requests will be accepted and new releases will be generated for new features / bug fixes.

License: Other

Python 0.79% C++ 99.21%
sdl sdl2 guichan opengl gui-construction-toolkit

guisan's Introduction

GUISAN

logo

An SDL2 GUI construction toolkit

Build Status

Guisan was forked from Guichan to create a simple GUI construction toolkit that is compatible with SDL 2.0.0+

Features:

  • Statically links to your applications to reduce runtime requirements
  • Small, but effective

Build requirements:

  • scons

Runtime requirements:

  • SDL 2.0+
  • SDL2_image
  • SDL2_ttf
  • SDL2_mixer

Example

openglwidget

License:

Released under the BSD license. See COPYING for more details

guisan's People

Contributors

finalman avatar gbaudic avatar jarod42 avatar kallisti5 avatar midwan avatar olofn 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

Watchers

 avatar  avatar  avatar  avatar

guisan's Issues

Cannot type capital letters in TextField widget

Even when testing in the included Examples, the TextField does not seem to accept capital letters.
Using Shift (LShift or RShift) and/or Caps Lock, we always get small case letters instead.

To recreate:

  • compile the included examples
  • run sdlwidgets
  • try to type capital letters in a TextField

Is this a known issue?

HiDPI Scaling

Guisan really needs to support some kind of pixel-doubling or scaling when run on HiDPI systems.
Deciding when to scale should be automatic, and cross platform (Which might be a bit tricky)

At minimum we need an API call to force these changes manually and let the end developer decide.

Button widgets don't trigger mouseEntered properly

I noticed this on the Raspberry Pi platforms, but not on others. Even with the provided sample/demo applications.

The issue is:

  • Clicking on a Button widget with the left mouse button, selects the button but does not trigger/push it.
  • Clicking on a Button and moving the mouse by at least 1 pixel, works as expected (the button is pushed).

From all the widgets I tested, only buttons seem to have this issue.

I managed to track this down to the src/widgets/button.cpp file, and specifically to this:

The mouseReleased() event is not triggered if we have a left mouse button event, because mHasMouse is false.

mHasMouse is changed by the mouseEntered() and mouseExited() events. These events are triggered correctly only when the mouse is "dragged" over a button, but not when it's clicked.

As a simple work around, I removed the requirement for mHasMouse to be true for the mouseReleased() event, and I also changed isPressed() slightly to return the status of mMousePressed instead of mHasMouse, for updating the draw event properly.

I didn't notice any issues with this approach. Is there something else we could do, that might be a better solution?

API Documentation

The original Guichan website documentation seems offline. Some documentation needs to be written / generated around Guisan to assist developers beyond the example code.

Black screen

Hello!
I am trying to add this GUI system into my game engine, but all I get is a black screen when calling gui->draw(). Has anyone experienced this?

SDL2 - Guisans rendertarget combined with SDL_Colorkey

At the moment i am experimenting with guisan within my little project. Everything is done sofar with SDL_Texture except Guisan which as you best know utilize SDL_Surfaces instead SDL_Texture for rendering itself if SDL2 is chosen as "Graphics Engine"

Per sé this is absolutly fine. When guisan has finished rendering stuff on its SDL_Surface target I simply convert this Surface into an SDL_Texture or to be more precise I Update an pre-existing SDL_Texture and then Render this specific SDL_Texture. This works perfectly.

Till here everything is fine. I can interact with my GUI and the rest of my application. Then i thought at some point why not use an colour key (0xff00ff) to make the target of guisan transparent except for the parts it is drawing his stuff.

So i started calling:

SDL_FillRect(guisanTarget,NULL,*0xff00ff*);
To Fill my Target with the colour key i am about to hide away, with this call:
SDL_SetColorKey(guisanTarget,SDL_TRUE,SDL_MapRGB(guisanTarget->format,0xff,0x00,0xff));

And here is where my problem occurs... if i try to set my colour key the result will be a black screen. No visible GUI to interact with. If I DO NOT set the colour key via SDL_SetColorKey then i get my GUI with the background colour i filled my Target via SDL_FillRect.

I have no clue why... If anyone has an idea what the reason for this behaviour is please let me know i would appreciate it a lot.

Management of darker and lighter color

In several widgets (at least Scrollarea and Button with its derived classes), some computation on the colors are done to get darker or lighter colors, for example to make a button look pressed down. Unfortunately, the code to do this always follows a pattern similar to:

highlightColor = faceColor + 0x303030;

I am afraid that while it works perfectly on grey shades, it is going to be unsuitable if the widgets are made to be colored in almost every other color.
A possible solution I see would be, instead of adding or subtracting a fixed amount on red, green and blue channels, to use a multiplicative coefficient on these three channels so the hue is kept but only the luminosity varies.

Cannot type numbers using keypad in TextBox/TextField

While trying to solve #4 , I noticed another issue regarding text input: I cannot type numbers using the keypad.
A quick investigation shows that in the Key class, the codes corresponding to the key pad are SDLK_KP_x instead of SDLK_x (with x a number). Unfortunately, according to the SDL docs, SDLK_KP_x has a corresponding integer value way higher than the corresponding ASCII character. This prevents proper insertion of the character in the widget classes.

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.