A very basic View Engine for Unix.
To run UnixEngine simply copy the code below and add your code in the functions.
#include "../engine/engine.h"
using namespace std;
// Function called when command is written in the console
void command_written(string command);
// Function called before the next frame is rendered
void render_frame(Canvas *canvas);
int main()
{
UnixEngine *engine = new UnixEngine();
engine->set_canvas(120, 40);
engine->start(render_frame, command_written);
delete engine;
return 0;
}
To launch Draw you need to compile the app and the engine and then launch it.
> make draw
> ./draw
In Draw you can paint views on a canvas by setting its various properties to create the exact view you want.
x
> View(x:10)
y
> View(y:10)
Width
> View(width:10)
Height
> View(height:10)
Background color
> View(background_color:10)
Style
> View(style:10)
Border width
> View(border_width:10)
Border Style
> View(border_style:10)
Border color
> View(border_color:10)
To create a view you can combine any these properties in any order you want.
> View(width: 20, height: 10, style: #)
> View(x: 10, y: 5, width: 5, height: 5, background_color: magenta, style: *)
> View(x: 10, y: 5, width: 20, height: 10, border_width: 2, border_color: red, border_style: *)
> View(x: 20, y: 5, width: 25, height: 7, background_color: magenta, style: *, border_width: 1, border_color: red, border_style: #)
You can also draw views on top of each other.
> View(x: 10, y: 5, width: 20, height: 10, border_width: 2, border_color: blue, border_style: *)
> View(x: 20, y: 5, width: 25, height: 7, background_color: magenta, style: *, border_width: 1, border_color: red, border_style: #)