Category Archives: General

Updating to NanoVG

I have been looking for a good way to create GUI in LWJGL since I started working on the IDE, I have been using simple texture atlas with few basic renderers until now. The performance wasn’t a problem since I used batch rendering, but creating anything was a tedious task and required multiple textures to get good effects.

The best solution I have found is NanoVG.

NanoVG

First I have heard about it was December 2015, specifically a tweet by LWJGL

NanoVG is available on github memononen/nanovg and so are LWJGL’s NanoVG examples.


The screenshot immediately caught my attention, the UI looked good and the “VG” part was really interesting since it indicated is was created using vector graphics which are simple to use (if you understand how they work).

I didn’t have time to really test out NanoVG until recently, I was surprised by how easy it was to use and after converting the current code to use it the performance also increased by 50-100%, while making everything look better with little to no effort.

Old OpenGL Renderer vs NanoVG Renderer

OpenGL Renderer (left) – NanoVG Renderer (right)


Improved font quality (right)


Buttons now have gradient and rounded corners (right)


Nice scrollbars (right)

Example button

Another interesting part is how well it connected with ISS (custom CSS-like styles), changing color, adding gradient, border or rounded corners is done using basic style properties and the rest is handled by NanoVG (usually few lines of code).

I will demonstrate it with a simple button, on the left is the ISS style and on the right screenshot of the button.

.tabsButton {
}

.tabsButton {
background-gradient: 0.3;
}

.tabsButton {
background-gradient: 0.3;
border-color: 255 255 255 100;
}

.tabsButton {
background-gradient: 0.3;
border-color: 255 255 255 100;
border-round: 10;
}

.tabsButton {
color: 255 255 255 255 !1;
background-color: 0 0 0 100 !1;
background-gradient: 0.3;
border-color: 255 255 255 100;
border-round: 10;
}


IDE current status

It’s been a long time since I last posted, I have got a lot of things done during that time, but most of those where interface-less automated utilities, so there wasn’t much to show.

Recently I have started working on the LUA Editor, you can expect more frequent updates on the IDE in the future. Currently I’m preparing it for release, adding few more features, finishing up all of them, removing crashes and fixing bugs.

LUA Editor

Currently the LUA editor has all of the basic text editor functions, copy&paste, undo&redo and syntax highlighting. The syntax highlighting is smart and dynamic, supports multi-line comments and only parses the code from where the change has happened to the point where it is safe to stop parsing further. It’s really fast even with huge files.

Planned next:

  • History saving, similar to git/svn but more integrated with the editor and with undo&redo saved
  • Auto-complete and hints, hooked up with the Eternus engine calls (later on also with lua files)
  • Code formatting
  • Basic Debugging (include, typos, syntax errors)

TXT (TUGON) Editor

The TXT (TUGON) loading and saving is done already, it works really well for automated tasks, the Recipe List (Crafting Guide) was generated using it. I also had a chance to put it to good use and clean up all of the TUG files and automate few really tedious tasks.

Once the LUA Editor is done, it will be really easy to get the TXT (TUGON) Editor working and the args for the class connected with the code. Another thing I’m looking into is proper schematics for the TXT (TUGON) files to eliminate typos.

Models

Currently the IDE can both load and save .obj files and also fix some of the problems with those, but only the loading and rending part is exposed to the GUI, saving is internal only.

The IDE is much more allowing and some models that don’t work in TUG still work in the IDE.

Planned:

  • Debugging models and textures (warning about why the model will/might not work in TUG)
  • Displaying _coll (collision) boxes/shapes
  • Moving/adding pivot and _atch points

Scripting

I’m not sure if I will be able to get it in for the first release, but I’m planning on adding a scripting language to the IDE, it will help with automating things, I still haven’t decided what scripting language it will be, I’m considering lua or a custom one.

The end goal of the scripting language is to allow thing like generating Recipe List (Crafting Guide), working with txt and model files, automating tedious tasks, extending the model viewer with new functions (displaying ghost objects, text, lines, even generating models and textures), automating lua scripting and generating reports/warnings.

 

Starting a blog

OK, so I’m starting a blog, I had one before but the domain it was on is now gone. Now that I have a cool domain again I can start a new one. This time I’m keeping the domain for sure!

I have decided to start the blog now as I don’t have a place to put my work in progress stuff and thoughts. I will be posting when I feel like it or when I have something interesting.

What you can expect:

  • TUG modding
  • TUG IDE
  • SteamPower (TUG mod)
  • Java stuff
  • General programming

Soon, hopefully within few days I will be posting stuff about the progress of the TUG IDE.