-
-
Notifications
You must be signed in to change notification settings - Fork 78
DrawingAPI
There are two low-level ways to draw 2d graphical objects.
- One is via creating ParaUIObject controls (like buttons, containers, editbox). These controls are managed in C++ and created in NPL scripts.
- The other is creating owner draw ParaUIObject, and do all the drawings with Painting API in NPL scripts, such as draw rect, lines, text, etc.
Moreover, there a number of high-level graphical libraries written in NPL which allows you to create 2D user interface more easily.
- IDE controls is NPL wrapper of the low-level C++ API. It provides more versatile controls than the raw ParaUIObjects.
- One old implementation is based on ParaUIObject controls.
- One new implementation is based on Painting API, in
System.Window.UIElement
namespace.
- MCML/NPL is a HTML/JS like mark up language to create user interface.
- One old implementation is based on ParaUIObject controls.
- One new implementation is based on Painting API, in
System.Window.mcml
namespace.
This article is only about low-level drawing API in C++ side, which are exposed to NPL.
In ParaEngine/NPL, we support loading fonts from *.ttf
files.
One can install custom font files at fonts/*.ttf
, and use them with filename, such as Verdana;bold
.
Please note, all controls in ParaEngine uses "System" font by default. "System" font maps to the system font used by the current computer by default. However, one can change it to a different custom font installed in fonts/*.ttf
.
Suppose you have a font file at fonts/ParaEngineThaiFont.ttf
, you can map default System font to it by calling.
Config.AppendTextValue("GUI_font_mapping","System");
Config.AppendTextValue("GUI_font_mapping","ParaEngineThaiFont");
It is a pair of function calls, the first is name, the second is value.
We recommend doing it in script/config.lua
, it is loaded before any UI control is created. Please see that file for details.
Please note, for each font with different size, weight, and name, we will create a different internal temporary image file for rendering. So it is recommended to use just a few fonts in your application.
Download Paracraft | ParacraftSDK | copyright by tatfook 2016 | upload image