evolve

Console

Console

Evolve has no GUI it can only be used in the console window however there are commands that can improve the user experience.

Clearing the console window

To clear the console window and position the cursor at the top left hand corner use the con_cls command.

Set Text and Background Colour

The foreground and back ground colour can be changed using the con_colour command.

This takes two arguments the first is the foreground colour and the second is the background colour.

The follow constant values can be used where the constants with _INT are high intensity versions of the colour.

#BLACK, #BLUE, #GREEN, #CYAN, #RED, #MAGENTA, #YELLOW, #WHITE, #BLACK_INT, #BLUE_INT, #GREEN_INT, #CYAN_INT, #RED_INT, #MAGENTA_INT, #YELLOW_INT, #WHITE_INT

Alternatively you can write the colour values as bytes where the bits values relate to the following colours.

Blue = 1

Green = 2

Red = 4

High Intensity = 8

So for white the value would be 7 and for blue the value would be 1.

//---------------------------------------

// File: Colours.e

//---------------------------------------

//---------------------------------------

// Block: go

//---------------------------------------

block Go

Background = 0

while Background < 16

Foreground = 0

while Foreground < 16

con_colour Foreground Background

out "*"

++ Foreground

_while

++ Background

_while

con_colour 15 0

new_line

con_colour #BLACK #WHITE

outl "BLACK"

con_colour #BLUE #BLACK

outl "BLUE"

con_colour #GREEN #BLACK

outl "GREEN"

con_colour #CYAN #BLACK

outl "CYAN"

con_colour #RED #BLACK

outl "RED"

con_colour #MAGENTA #BLACK

outl "MAGENTA"

con_colour #YELLOW #BLACK

outl "YELLOW"

con_colour #WHITE #BLACK

outl "WHITE"

con_colour #BLACK_INT #WHITE

outl "BLACK Intense"

con_colour #BLUE_INT #BLACK

outl "BLUE Intense"

con_colour #GREEN_INT #BLACK

outl "GREEN Intense"

con_colour #CYAN_INT #BLACK

outl "CYAN Intense"

con_colour #RED_INT #BLACK

outl "RED Intense"

con_colour #MAGENTA_INT #BLACK

outl "MAGENTA Intense"

con_colour #YELLOW_INT #BLACK

outl "YELLOW Intense"

con_colour #WHITE_INT #BLACK

outl "WHITE Intense"

_block

Positioning Text

Text can be positioned anywhere on the screen with the con_xy command, this simply sets the cursor position at the X and Y coordinates passed as arguments.

//---------------------------------------

// File: XY.e

//---------------------------------------

//---------------------------------------

// Block: go

//---------------------------------------

block Go

con_cls

con_title "Moving Evolve"

Key = 0

con_cursor false

while Key == 0

key_in Key

X = 0

while X < 20

++ X

con_xy X 5

out " evolve"

sleep 50

_while

con_xy X 5

out " "

new_line

_while

con_cursor true

_block

Other Console Commands

If you have studied the previous example will have noticed two additional commands

con_title This sets the title of the console window. Unless you change the console window then evolve will display the name of the currently loaded file as the title.

con_title “Name”

con_enablecursor This enables and disables the cursor, if you are displaying data then it is often cleaner to turn the cursor off unless you are waiting for user input.

con_enablecursor true