Graphics
Making a Graphic Screen
Ensure from BlazeSudio.graphics import Screen
is present. To make a graphic screen you make a class:
This class shouldn't remain empty (or it would be a very boring screen), so let's add some functions to it!
Functions
_LoadUI(self)
_LoadUI(self)
This is ran at the start of execution and whenever self.Reload()
is ran. The code always clears the screen before running, so you don't need to include that here.
This function is where you typically create most of the GUI elements that will be present in the screen.
// TODO: Finish other functions
Layers and stuff
To add elements to the screen, you need to add to the layers and stuff of the Screen. self.layers
is the list of layers present in the screen. You start off with one layer self.layers[0]
, but you can specify other layers (e.g. self.layers[1]
or self.layers[2]
) and it will automatically add them for you. Each element of self.layers
is a Stuff
element. How this works is you add categories to the Stuff
and sort your elements into these categories. Then, all you need to do is to call self['layername']
and it will automatically find the correct category for you!
Here is a clearer example:
Here is a JSON dictionary demonstrating the output of this:
THINGS TO NOTE ABOUT ORDER OF LAYERS
The lower down (i.e. index closer to 0) the layer is, the later it will be rendered (the layer with index 1 will be rendered before the layer of index 0)
If you have multiple categories with the same name;
If they are in the same layer making a new layer will override the existing layer
If they are in different layers specifying
self['layername']
will only find the category that is lower down in the list (e.g. if there was a 'Main' on layer 0 and 1 runningself['Main']
will return the list of the category from layer 0)
Last updated
Was this helpful?