ScreenLib is a PROS library that handles screen drawing functions, primarily printing each game's field. It provides a powerful way to draw any possible field without requiring experience with lvgl
- Go over to releases and download the latest version
- Open a terminal wherever you downloaded it(try shift + right click in file explorer)
prosv5 c fetch screenlib@VERSION.zip, replacing VERSION with the version
prosv5 c apply screenlibin your project directory to install
The first digit refers to the vex game: Tower Takeover will be version 1.X.X, while next year's game will be 2.X.X
The second digit refers to any new features that may be added.
The third digit refers to any bug fixes or minor improvements to existing features.
This software uses the MIT License. See LICENSE for more information.
Object drawing is mostly done through a
Field object, by giving a position enum class and a bitfield of which cubes to print.
Most objects on the screen are referred to by
far (near refers to the bottom of the screen while far refers to the top)
Make sure screen::initializeStyles() is called during initialization
An example of this is:
Let's take a look at how the field is represented
Each of the cube group names are in the enum class
each of the tower names are in the enum class
each of the scoring zone names are in the enum class
The numbers on the cube show the bit that represents them in their bitfield:
a 0 means it's looking at bit 0:
a 1 means it's looking at bit 1:
and so on.
This is done so the presence of every cube in a group can be given by a number
say you want the cubes labeled 3, 1, and 0, the bitfield would be
For the stacks near the middle, the cubes in the stack but not on top, are still represented by the bits that follow the top cube's bit (the 3 cubes under a cube on bit 3 are represented by bits 2, 1, and 0)
Alternatively, macros can be used for more verbose code; here is the equivalent of the previous example:
field.draw(screen::cubeGroup::right4, CUBE_HIGHEST + CUBE_2LOWEST);
CUBE_HIGHEST represents the highest cube in the stack, followed by
CUBE_2HIGHEST (the 2nd highest), followed by
CUBE_2LOWEST (the 2nd lowest), and finally
CUBE_NEAR are for the cube sectors farLeft and farRight
CUBE_NEAR_RIGHT are used for the five cube stack on the near side
and finally, all macros starting with
TOWER_CUBE_ refer to the cubes around a tower
Scored cubes are drawn along with where they are, either in a tower or a scoring zone. In a tower the second parameter describes the color of the cube,
screen::color::). In a scoring zone the second parameter does the same however, two colors can be placed in an array to denote two stacks. In addition,
a third parameter is used to display "stack height", a number printed on top to describe how many cubes are in the stack.
screen::color::none to abstain from printing a scored cube in that position
The field can be repositioned with
and can be resized using
when changing size, if you are unsatisfied with the numbers printed on the cubes, you can modify the
NumberConfig, which is given as the 4th parameter in the constructor. More information is available in field.hpp
This directory (specifically opcontrol.cpp) is a usage example (it produces the image at the top of this page)
smallfont.c is converted version of the digits 0-9 from Synchronizer NBP Font by total FontGeek DTF, Ltd. all credit regarding the font to them.
Thanks to Potatehoes from 914M for beta testing, as well as Hotel from the PROS team, Salmon from Okapilib, and Theo from 7842F, for giving some advice on improving the code here