• Stars
    star
    316
  • Rank 132,587 (Top 3 %)
  • Language
    C
  • License
    MIT License
  • Created over 9 years ago
  • Updated over 8 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Game GUI is a skin-able GL based Widget Class for Games

Game GUI - A Simple GUI with skin-support for OpenGL Games

License : MIT

http://opensource.org/licenses/MIT

Summary

After trying several gui's more or less suited for games (LibRocket, Qt, NVWidgets, CEgui, etc), I found that none of them was really light weight, easy to use and fully skinable at the same time. This was the reason I started to write my own GUI / C++. The project was completed in about one month.

Screenshot1

Features

  • Advanced skin scaling: define how the inner and borders of a texture shall be scaled ( simple scale, repeating inner pattern or constant outer frame )
  • UTF8 Support
  • TTF Support
  • Easy skinning support
  • Alpha support (RGBA), so you can have transparent windows/widgets etc
  • direct access to all controls and their members
  • Non-blocking visualization
  • Callback support
  • No need to mess with inheritance and virtual functions
  • Different from most GUIs, Widgets and windows are stored completely inside the GUI, so no need to define any window or widget variables in your code.
  • Directory: Controls are stored and accessed by a tree structure that is rendered every time like a scene graph
  • No event loop, show function or update function
  • No need to have a timer that calls an update function
  • Lightweight: Only Depends on GL and libFreetype and DevIL
  • Can easily be used in SDL, Qt and other environments. Just plug in the keyboard and mouse events and call the gui's draw function from your main render loop.
  • Config file support for default variables (font,padding etc) and skin textures+scaling parameters
  • Only 2000 lines of code for the entire Gui class including all widgets. Therefore easy to modify and extend.
  • Comes with a simple file-browser (See screenshot1)
  • MIT license
  • Multi-screen support (same as multiple Desktops). You can have a title screen, loading screen, ingame screen etc. Simply create them at the beginning and the switch between by setting gui.active_screen=number;
  • Window manager
  • Context menu
  • Custom mouse pointer
  • Widget Classes : Window, Menu, Label, Button, CheckBox, Tab, Combo, Textedit, Radio
  • Controls have support for custom user variables like control.var.string["myvar"]="hello"

Most important is the access by the directory structure and using simple assigns '=' to create a new instance of a widget or window.

The usage is basically as follows:

Create (and instantly show) a window:

gui.window["id1"]=Gui::Window("Title",100,100,250,350);

Adding a button :

gui.window["id1"].button["load"] = Gui::Button("Load",20,20,50,30); 

Adding a simple callback

gui.window["id1"].button["load"].callback_pressed=
    [](Gui::Window *window,Gui::Button* control,int index)
    {
        window->close();
    };

Setting a custom skin:

gui.window["id1"].button["load"].skin=Skin("normal.png","hover.png","pressed.png");

Also you have direct access to a skin's texture to use it as output of a FBO e.g. The 3D viewer of the screenshot below uses that.

gui.window["id1"].button["load"].skin.texture_normal=fbo.texture_id;

Duplicating a window is easy: The duplicate is instantaneously visible (works also for controls)

gui.window["id2"] = gui.window["id1"]

The GUI is not fully optimized, yet you have like 700 fps with 20 simple windows on the screen on a notebook PC. Controls are stored in a std vector as share ptr. For rendering, it is not necessary to evaluate the string keys.

Mathlib included from http://sourceforge.net/projects/nebuladevice/

(C) by Sven Forstmann in 2015

Screenshot1
Screenshot2

Screenshot3

More Repositories

1

Fast-Quadric-Mesh-Simplification

Mesh triangle reduction using quadrics
C
1,458
star
2

Planet-LOD

Planet Rendering: Adaptive Spherical Level of Detail based on Triangle Subdivision
C
335
star
3

Sparse-Voxel-Octree-Raycasting

Sparse Voxel Octree Raycasting with Image Warping exploiting Frame-to-Frame Coherence in OpenCL
C
107
star
4

Game-NET

RPC Network Library for Multiplayer Games
C++
74
star
5

HVOX-Engine

Visualization of Large Procedural Voxel-Terrains using ISO-Surfaces based on nested Clip-Boxes
C++
56
star
6

OutStar.VoxelGame

Voxel Editor and Game in One
C
44
star
7

Terrain-HeightMap-Generator

Terrain Generator with Erosion
C
40
star
8

RLE-based-Voxel-Raycasting

CUDA based Voxel Raycasting - Paper: Efficient, High-Quality, GPU-Based Visualization of Voxelized Surface Data
C
39
star
9

OpenCL-Voxel-Splatting

Splatting using OpenCL can reach more than 2 Bln Splats/s !
C
38
star
10

Procedural-Geometry-Maps

The Maps are visualized using the Tessellation Shader
C
32
star
11

Geometry-Clipmap-Tutorial-in-OpenGL

Simple Terrain Engine in 200 Lines of Code
C
30
star
12

Voxel-Terrain-Raycasting-with-SSDM

Procedural Voxel Terrain Raycaster with Hitpoint Refinement and Screen Space Displacement Mapping
C
25
star
13

Pulsar-Voxel-Engine-1996

Tile based Voxel Engine written in Pascal/Assembly using Protected Real Mode in DOS
Pascal
24
star
14

Voxel-Raycasting-using-True-Impostors

Experimental Code to Render a Voxel Volume using 6 Height Maps (+-XYZ) to define the Object
C
20
star
15

OpenGL-Voxel-Splatting

OpenGL Voxel Splatting
C
20
star
16

Skinned-Skeletal-Animation-in-OpenGL

Skeletal Animation Tutorial using Shaders to Transform the Vertices. Based on the OGRE Mesh Format
C
17
star
17

1K-3D-Voxel-Engines-1990s-

3D Voxel Engines with 1K Turbo Pascal Source Code
Pascal
15
star
18

Deformation-Styles-using-Spline-Skinning

Deformation Styles using Spline Skinning
C
12
star
19

Stereo-Matching

Dynamic Programming Dense Stereo Matching Tutorial
C++
10
star
20

Java-Random-Texture-Generator

Texture Generator in Java
Java
7
star
21

CodeFlash

Create simple shortcuts for long text phrases (usable for programming, chatting, writing emails etc)
AutoHotkey
1
star