SEC-Lab-3
The third Lab of Software Engineering Components
Contributors:
- Igor Novikov
- Maxim Sachko
- Andriy Tymoshenko
How to use:
- Open terminal & clone repo to your pc:
$ git clone https://github.com/KPI-team-labs/event-loop.git
- Go to your local repo directory:
$ cd event-loop/
- Run local:
$ go run cmd/painter
-
Open the event-loop\script\index.html page in your browser
-
Use ready-made scripts or write commands manually to control the graphics window.
For example:
white
update
This script will fill the background with white color.
List of commands:
- white
- Fills the background with white color.
- green
- Fills the background with green color.
- update
- Updates content in graphics window.
- bgrect x1 y1 x2 y2
- Draws a black rectangle over the background at the given coordinates (Upper left and lower right corners). Only the last requested rectangle will be displayed.
- figure x y
- Draws a "T" figure centered at coordinates (x;y) over the background.
- move x y
- Moves the object horizontally by X, and vertically by Y.
- reset
- Cleans information about background and all added objects created with "figure" and "bgrect". And fills the background in black.
Ready scripts
- Script 1 (Green border)
Contains the following commands:
reset
green
bgrect 0.02 0.02 0.98 0.98
update
This script creates a black rectangle in a bold green frame (background).
- Script 2 (Diagonal movement of the figure)
Contains the following commands (1st request):
reset
white
figure 0.1 0.1
update
2nd request (Sent every second, 9 times in total):
move 0.1 0.1
update
This script makes a white background and moves our figure around the perimeter of the window at certain intervals.
Custom scripts
You can also write your own scripts to control the graphics window: