Skip to the content.

Solar v1.0.3

Solar v1.0.3 is a major release focused on making Solar feel like a real language: user-defined functions, block control-flow, real expressions, and a first “pure Solar” Pygame layer for games.

Highlights

solar_def: Solar functions

YOU CANT MAKE FUNCTIONS WITH ARGS YET!! I WILL ADD IT IN 1.0.4!!

Define functions in Solar (no Python passthrough needed) and call them like normal Solar commands.

Example:

solar_def no_args:
     print "test func without args"
end

no_args

Notes:

Block syntax: if / elif / else / while / for

Solar now supports block statements terminated by end.

let score = 7

if score >= 10:
    print "great"
elif score >= 5:
    print "ok"
else:
    print "rip"
end

Loops:

let x = 0
while x < 5:
    print x
    let x = x + 1
end

for i in 0..3:
    print "i=" i
end

Real expressions

Expressions now support:

UI (customtkinter)

Solar UI syntax remains available and works with customtkinter widgets:

contain imports

contain <module> inserts a Python import into the compiled program.

contain pygame
contain pygame as pg

Pygame: Solar-only game loop (beta)

Solar v1.0.3 introduces a small Pygame DSL under pg so you can write a working loop in Solar syntax.

Supported commands:

Example game (Solar syntax)

A tiny “move the box” game using only Solar:

contain pygame

pg init
pg window 800 600 title "Solar v1.0.3 - Pygame demo"
pg fps 60

pg rect player 50 50 40 40 color 255 80 80
pg var vx 0
pg var vy 0

pg loop:
    pg event quit ->
        pg exit
    end

    # reset velocity each frame
    pg set vx 0
    pg set vy 0

    pg key held A ->
        pg set vx -5
    end
    pg key held D ->
        pg set vx 5
    end
    pg key held W ->
        pg set vy -5
    end
    pg key held S ->
        pg set vy 5
    end

    pg move player vx vy

    pg clear 20 20 25
    pg draw player
    pg flip
end

Notes / Limitations