WOWCube device emulation
An emulator is software application that enables one computer system (called the host) to act like another computer system (called the guest).
Emulation refers to the ability of a computer program to imitate another program or device.
WOWCube emulator is an essential part of WOWCube Development Kit.
Along with WOWCube SDK, this application allows to create and run cubeapps right on your development computer without the need of uploading them each time to a physical WOWCube device.
It also provides a set of useful features for controlling emulated device parameters and seeing how fast your application runs.
But the most useful feature of the emilator is a console.
WOWCube emulator provides eight independent output consoles for each module of the device. The cubeapp that runs on module can print to the output console at practically any moment of its runtime.
The console
Printing to the console is done via logging functions with different verbosity levels:
| Function name | Verbosity level |
|---|---|
| LOG_a(...) | Assertion |
| LOG_e(...) | Error |
| LOG_w(...) | Warning |
| LOG_i(...) | Information |
| LOG_d(...) | Debug |
The following placeholder codes are supported:
| Placeholder | Description |
|---|---|
| %c | print a charater |
| %d | print an integer value (in decimal radix) |
| %f,r | print a floating-point value in normal (fixed-point) notation |
| %q,r | print a fixed-point value |
| %x | print an integer value (in hexadecimal radix) |
| %s | print a null-terminating string buffer |
| % | print a percent character) |
You may optionally put a number between the % and the letter of the placeholder code. This number indicates the field width; if the size of the parameter to print at the position of the placeholder is smaller than the field width, the field is expanded with spaces.
Current version of WOWCube emulator does not support coloured output to console
The example
To demonstrate how the console may come in handy, we will take the Time and Timers example and change it slightly.
As in the previous example, the cubeapp will be counting ticks and seconds. This time, however, the values will be seen in the console, and not on the screen.
Why would we want to do that?
Well, the answer is simple: not everything that you may have in your cubeapp app can be rendered on screens. Surely, there will be some variable that you may want to make visible on the screen during the whole time of gameplay.
But what about others, tens of others variables that you may have as well?
How do you know what variable gets what value in a given moment of time? (remember there is no debugger)
Of course, you can print them out to a console! Print them as much as you want, with or without any texts, everything that you need to see.
So let's do some printing...
ON_Init() callback is modified the way we can see when it is started and when it is finished.
The SELF_ID built-in variable is used to read the number of a module and print it out too. You will see different module numbers printed by cubeapps that run on different modules.
Now, as we know, the logic of any cubeapp is processed in ON_Tick() callback. So let's change it too:
This will make the cubeapp printing a block of text and values on timer. Pay attention each value has different type: we print out an integer value, a fixed point value, a string and a hex.
As a result, you should see the following output to all eight consoles in the WOWCube emulator: