Close

Argentum's Hello World with SDL, OpenGL and SKIA

A project log for Argentum programming language

It automatically prevents all memory leaks. It doesn't use GC, so no pauses. It's compiled to machine code. It's crazy safe and fast.

andrey-kalmatskiyAndrey Kalmatskiy 4 days ago0 Comments

Argentum integrated with SDL2/SKIA (backed by OpenGL renderer) this allows to create portable GUI frameworks.

Code example:

using sys { Blob, log }
using guiPlatform { Canvas, Paint, Rect, Font, Image }

class MyApp {
    +guiPlatform_App {
        onStart() {
            font.fromName("Arial Bold");
            img.fromBlob(Blob.{ _.loadFile("sd.png") : log("Img sd.png not loaded") });
        }
        onPaint(c Canvas) {
            phase += 1s;
            c.clear(0xff_ffffffs);
            p = Paint;
            c.drawRect(Rect.setXYWH(50f, 50f, 100f, 100f), p.color(0xff_ff0000s));
            forRangeFStep(0f, 700f, 4f)`i
                c.drawLine(i, 0f, 0f, 700f - i, p.color(0xff_008800s | (short(i) + phase)));
            c.drawSimpleText(48f, 16f, "Hello", font, 16f, p.color(0xff_004400s));
            c.drawImage(108f, 100f, img);
        }
        onKey(pressed bool, key short, shifts short) {
            pressed && key == keyEsc ? setMainObject(?MyApp)
        }
   }
   phase = 0s;
   font = Font;
   img = Image;
}
MyApp.run("Hello AG", 120) // Start GUI app with windows title and given FPS

Result: 

More details: https://aglang.org/gui-platform/

Discussions