Giter Club home page Giter Club logo

sdlui's Introduction

SDLUI

SDLUI is a bare bones GUI library made with SDL, for SDL, and written in a style that resembles SDL. It depends on standard SDL extensions (SDL_image, SDL_ttf). Its purpose is to have a convenient way to build small apps, utilities and tools right within SDL, without much hassle to set-up.

How to use

Include sdlui.h in your project. See the example skeleton SDL app (main.cpp).

The boilerplate are 4 functions:

  • SDLUI_Init
  • SDLUI_EventHandler
  • SDLUI_WindowHandler
  • SDLUI_Render

Control creation and usage is a mix between retained and immediate mode. That means there's a separate function to create a control, yet there are no callbacks, and using a control is similar to the immediate mode paradigm. The idea is to "prepare" the entirety of the UI beforehand, and then call each control's usage function inside the main application loop. e.g.:

// Create a button in previously created window "my_window1"
SDLUI_Control_Button *btn1 = SDLUI_CreateButton(my_window1, 10, 40, "PushButton");
...
...
...
// In main application loop
if(SDLUI_Button(btn1))
{
	// Do something on button click...
}

Every control resides in a window, and its placement is relative to its parent window position.

List of controls

  • Window
  • Button
  • SliderInt
  • CheckBox
  • Text
  • ToggleButton
  • RadioButton
  • TabContainer
  • ScrollArea / List
  • TextBox

Known issues/incomplete features

  • TextBox not fully implemented. Need to handle scrolling past the textbox capacity, selection, copy/paste, etc.
  • More work needed on scrollbars and detection of TextArea's client rect.
  • Enable/disable of controls not implemented yet. This should resemble Windows' greyed-out appearance.
  • Windows changes in scaling are not detected. Everything is currently drawn in the same size.
  • Doesn't probably handle scaling when dragging the main window between monitors (currently untested)
  • Apart from the included skeleton application everything is completely untested!

screenshot

sdlui's People

Contributors

abakobo avatar immortalx74 avatar noah11012 avatar

Watchers

 avatar

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.