SDL

From Céupédia
Jump to: navigation, search

This page is about running the Céu programming language under the SDL platform.

1 Installation

You can either download a virtual machine preloaded with Céu, or install it manually from the git repository:

2 Examples

The distribution comes with some samples ready for playing with Céu.

   $ cd ceu-sdl/
   $ make CEUFILE=samples/<example.ceu>
   $ ./samples/<example.exe>

2.1 Hello world!

A reactive "Hello world!" can be written as follows:

   loop do                        // an infinite loop that:
       await 1s;                  //   - awaits 1 second
       _printf("Hello world!");   //   - prints "Hello world!"
   end                            //   - repeats

Choose your favorite editor to copy the code and compile with the following command:

   $ vi samples/hello_0.ceu             # edit
   $ make CEUFILE=samples/hello_0.ceu   # compile
   $ ./samples/hello_0.exe              # run

The program is a loop that awaits 1 second, then prints "Hello world!", and repeats the process over and over.

3 Applications

The distribution comes with two fully working games, which are a good source for learning the language.

3.1 Rocks

More information: http://thesynchronousblog.wordpress.com/2013/10/08/the-rocks-game-in-ceu-sdl/

   $ cd ceu-sdl/rocks/
   $ make
   $ ./rocks

The source code of "Rocks" is well commented and is the best reference for learning how to program games in Céu.

3.2 Ultimate Tic-Tac-Toe

   $ cd ceu-sdl/ult-tic-tac-toe/
   $ make
   $ ./ult-tic-tac-toe