USAGE

Initialize a project:

$ schemer init project-name

Run a project (in the projects' directory):

$ shemer run [--] arguments for program

Run a standalone file

$ shemer file-name.scm [--] arguments for program

FUNCTIONS

Chibi scheme is used as the language for schemer, it is extended with various functions.

(text string x y) draws string at (x y)

(define-background-color c) defines background color

(define-font-color c) defines font color

(draw-square c x y w h) draws a filled square, colored c, at (x y) with size w h

(draw-line c x1 y1 x2 y2) draws a line from (x1 y1) to (x2 y2) with color c

(get-window-size) returns (window-width window-height)

(is-mouse-pressed) returns #t or #f

(get-mouse-pos) returns (mouse-x mouse-y)

(get-key-pressed) returns currently pressed key

(is-key-pressed x) checks if x is pressed

(system s) calls system command s (see EXTENSIONS -> core -> sys)

(dont-init-graphics) - do not init raylib (see EXTENSIONS -> core -> set-window-option)

(set-window-size w h) - set window size to w by h

(set-window-resizable b) - set window to resizable or not (see EXTENSIONS -> core -> set-window-option)

(rand) - get a random float from 0 to 1

(ffi-load ...) - (see EXTENSIONS -> ffi)

(ffi-call ...) - (see EXTENSIONS -> ffi)

(ffi-define ...) - (see EXTENSIONS -> ffi)

(use string) adds a library or a file. if string is one of:

MAIN LOOP

When graphics are loaded, schemer executes (on-load), which should be defined in your program.

Every frame, schemer will call (update-screen), and it hopes it is defined.

TUTORIAL

todo. (lmao)

well, you probably want to

(use "core")

because it includes some nice functions, and init-7.scm from chibi-scheme that defines important stuff.

then you need to define

(define update-screen
  (lambda ()
    (text "hello" 50 50)))

and you're good to go

EXTENSIONS

Extensions are loaded using the (use) method. The builtin ones are defined in scm/* and compiled into schemer. Loading builtin extensions is as simple as (use "ext-name"), where ext-name is the file name without the extension (so for scm/colors.scm - the colors extension - you would write (use "colors")).

List of extensions and their description:

EXAMPLES

THE "COMPILER"

The executable built will be big and clumsy, because compiler.c is not a compiler, but more of a bundler. It bundles all defined files in one executable. It does it by compiling every resource (images, *.scm, etc.) to a .c file, that contains a list of bytes of the file, and some getters. It IS a braindead approach, but i don't like having dynamic dependencies scattered all over my system, so that was my idea.

All resources and sources should be defined in make.scm, using (define-resource). The bundler will then know what files to bundle (lmao), and on runtime, when files are accessed through schemers' builtin functions with given filenames, it will not read them from disk, but load them through the getters (when compiled).

For example, if make.scm defines:

(use "make")
(define-resource "scm/init.scm")
(define-resource "res/image.png")

(make)

and scm/init.scm defines:

(define img #f)

(define on-load
  (lambda ()
    (set! img (load-image "res/image.png"))))

(define update-screen
  (lambda ()
    (show-image img 0 0)))

After running:

$ schemer build
$ ./a.out

res/image.png will be copiled to build/resources/image.png.c, and then built into a.out, and then accessed not from the disk, but using a getter defined in the .c file.