• Register
Post news Report RSS New Features: Dynamic Lightning and new UI Elements

Currently we are working on a Dynamic Light System and a new upgraded ui system. Often, creating a good user interface is one of the biggest tasks in developing a game. We would like to make this as efficient as possible with Genesis, for this reason we would now like to introduce the new UI system a bit closer.

Posted by on

Often, creating a good user interface is one of the biggest tasks in developing a game. We would like to make this as efficient as possible with Genesis, for this reason we would now like to introduce the new UI system a bit closer.

The base on which every user interface builds is the canvas or the render target. An infinite number of controls can be added to this. By activating and deactivating a canvas, different UIs can be created. For example, an inventory UI, the skill system, a merchant menu, and one of the game settings.

UI 1

Currently the engine has a progressbar, a label, a button, a gridview, a picturebox. Planned or in progress are a listbox, a listview with subitems, a textbox, a combox and many more. We are always open for suggestions and suggestions. The abstract class UIElement can also be used to design very unique user elements.

Here is a sample code for creating a user interface:

// 4. Create a Canvas
 Canvas MySampleUI = new Canvas(new Vector2(0,0), new Vector2(800,600));
 
 
 // 5. Create your Controls
 label = new Label("Mein Label", "Mouse Position");
 label.setLocation(new Vector2(20,20));
 label.setSize(new Vector2(200, 30));
 MySampleUI.AddElement(label);
 MySampleUI.AddUIActionListener(new CanvasActionListener(label));
 
 Label MyButtonLabel = new Label("MyButtonLabel", "Nothing has happened yet!");
 MyButtonLabel.setLocation(new Vector2(20, 50));
 MyButtonLabel.setSize(new Vector2(200,30));
 MySampleUI.AddElement(MyButtonLabel);
 
 Button btn = new Button("MeinButton", "Button1");
 btn.setLocation(new Vector2(20, 150));
 btn.setSize(new Vector2(200, 35));
 btn.AddUIActionListener(new ButtonActionListener(MyButtonLabel));
 MySampleUI.AddElement(btn);
 
 Progressbar bar = new Progressbar();
 bar.setLocation(new Vector2(20, 80));
 bar.setSize(new Vector2(200, 20));
 bar.setCurrent(60);
 bar.setSpace(1);
 bar.setIncrementValue(10);
 MySampleUI.AddElement(bar);
 
 Button MyProgressbarBtn = new Button("MeinProgressbarBtn", "Increase");
 MyProgressbarBtn.setLocation(new Vector2(230, 80));
 MyProgressbarBtn.setSize(new Vector2(60, 20));
 MyProgressbarBtn.AddUIActionListener(new ProgressbarUpdater(bar));
 MySampleUI.AddElement(MyProgressbarBtn);
 
 Button MyProgressbarBtn2 = new Button("MeinProgressbarBtn2", "Decrease");
 MyProgressbarBtn2.setLocation(new Vector2(292, 80));
 MyProgressbarBtn2.setSize(new Vector2(60, 20));
 MyProgressbarBtn2.AddUIActionListener(new ProgressbarDecrease(bar));
 MySampleUI.AddElement(MyProgressbarBtn2);
 
 PictureBox picB = new PictureBox(new Vector2(20, 190), new Vector2(300, 300), ImageIO.read(this.getClass().getResource("images/Human.png")));
 MySampleUI.AddElement(picB);
 
 GridView grid = new GridView("Grid", new Vector2(370, 20), 8, 4, 48, 48);
 grid.AddUIActionListener(new ListViewActionListener());
 grid.AddItem(new GridViewItem("MyGridItem", "GridViewItem", ImageIO.read(this.getClass().getResource("images/Sprite.png"))));
 grid.AddItem(new GridViewItem("MyGridItem", "GridViewItem", ImageIO.read(this.getClass().getResource("images/Sprite.png"))));
 grid.AddItem(new GridViewItem("MyGridItem", "GridViewItem", ImageIO.read(this.getClass().getResource("images/Sprite.png"))));
 grid.AddItem(new GridViewItem("MyGridItem", "GridViewItem", ImageIO.read(this.getClass().getResource("images/Sprite.png"))));
 MySampleUI.AddElement(grid);
 
 game.AddCanvas(MySampleUI);

In addition, we are currently working on a GUI for the engine in which, among other things, the dynamic and static lighting can be edited. You can add any number of lightmaps to a scene. These are then rendered either Dynamic or Static.

Editor

Post a comment

Your comment will be anonymous unless you join the community. Or sign in with your social account: