r/pascal • • Jan 21 '23

mod volunteers?

12 Upvotes

Anyone would like to be added as a mod here? Bonus points for maintainers of projects such as Freepascal, Lazarus or any Pascal project.


r/pascal • • 5h ago

Vertex Art Physics Test in WasmPascal

1 Upvotes

r/pascal • • 10h ago

Constraint Driven Audio Synthesis/Generation

2 Upvotes

Just cross posting over here because the library is open source and pure pascal (minus some build scripts etc...)

Once I finish up the initial testing I'll publish the repo (still too much in flux) and make an _actual_ post for this community


r/pascal • • 20h ago

VertexArt - WasmPascal - spider, shadow, reflection, outline

8 Upvotes

The currently functional demo version does not include real-time light-and-shadow calculation or stencil shadows.


r/pascal • • 1d ago

Blaise v0.16.2: a bug-fix release of the self-hosting Pascal compiler

13 Upvotes

Hi all! Blaise v0.16.2 is out. Blaise is a native Object Pascal compiler, written in Blaise, with its own assembler and linker. It needs no FPC, cc or ld. It builds for macOS arm64, Linux x86-64, FreeBSD x86-64 and Windows x86-64.

This is a bug-fix release, and the main changes are:

  • Runtime errors you can read. A fatal error now prints a message, such as Runtime error 200: division by zero, and exits with the code FPC users know. Before, an unhandled exception aborted with no message, and division by zero ended the program with a signal.
  • pdr 0.5.0 is bundled. pdr is the debugger for the OPDF debug format. It now stops right where a program raises an exception or hits a runtime error. A breakpoint stops every thread of the program. This works on macOS, Linux and FreeBSD.
  • Nested routines can now take default parameters and overloads.
  • Hardening: exception handling is fixed when Exit, Break or Continue leaves a finally or except block. There are several arm64 fixes, one of which fixes TLS handshakes on macOS. OpenSSL is now only loaded when a program first uses TLS.

Each archive is self-contained: unpack it and compile hello.pas.

- Repo: https://github.com/graemeg/blaise
- Release and changelog: https://github.com/graemeg/blaise/releases/tag/v0.16.2

Feedback and bug reports are very welcome. Next up is porting the debugger itself to Blaise, then Windows debugging support.


r/pascal • • 21h ago

DCL5 – a scripting language for DBMS-backed desktop app UIs

Thumbnail
gallery
1 Upvotes

DCL5 is an interpreted scripting language for building the UI of applications backed by a DBMS. It describes what a dialog/form should contain and what actions should run when the described buttons are pressed.

When you write apps in DCL5, you don’t need to worry about placing or laying out visual elements — DCL5 handles that for you.

The core business logic is expected to live in the DBMS itself: stored procedures, triggers, etc.

The idea behind DCL5 is to let you build a full business application from a limited set of special visual components. These are macro-components that encapsulate several complex actions — sometimes hidden from the developer — so you don’t get bogged down in boilerplate. The app UI is assembled from these blocks.

Besides the UI layer, the language includes data-manipulation facilities and support for simple business logic. Code that operates on visual components is separated from data-manipulation and business-logic code, though this separation is not strict.

The platform has a granular permission system that can restrict application menus and can also be woven into configuration logic. For reporting, it integrates with two office suites and supports tabular and text-based reports, as well as plain-text file output. With document templates, you can build fairly complex reports.

The platform can run on virtually all desktop operating systems.

Build: Use the latest Lazarus release for your OS. The main project options are in DefineType.pas. Dependencies are only the base Lazarus packages.

https://github.com/Tango600/DCL_Platform


r/pascal • • 1d ago

VertexArt - Slotmachine - wasmpascal

10 Upvotes

library slotmachine5_wasm;

{ VertexArt - Kovács István }

uses

WEB, WEBGL, GLMATH;

const

NUM_REELS = 4;

NUM_FACES = 6;

REEL_RADIUS = 1.2;

REEL_LENGTH = 1.4;

REEL_SPACING = 1.7;

GRID_X = 8;

GRID_A = 8;

MAX_PARTICLES = 300;

PARTICLE_GRAVITY = -4.0;

WIN_BLINK_TIME = 3.0;

WIN_BLINK_FREQ = 5.0;

FLOATS_PER_VERTEX = 7;

REEL_VERTS = NUM_FACES * GRID_X * GRID_A * 6;

CUBE_VERTS = 36;

SND_SPIN = 0;

SND_REELSTOP = 1;

SND_HOLD = 2;

SND_WIN = 3;

SND_NOWIN = 4;

WIN_NOTES: array[0..3] of Single = (523.25, 659.25, 783.99, 1046.50);

FACE_R: array[0..NUM_FACES-1] of Single = (0.90, 0.12, 0.16, 0.98, 0.86, 0.16);

FACE_G: array[0..NUM_FACES-1] of Single = (0.12, 0.78, 0.35, 0.86, 0.20, 0.82);

FACE_B: array[0..NUM_FACES-1] of Single = (0.12, 0.20, 0.90, 0.16, 0.86, 0.86);

SYMBOL_PATTERN: array[0..NUM_FACES-1, 0..7] of Byte = (

($00, $18, $3C, $7E, $7E, $3C, $18, $00),

($00, $00, $FF, $FF, $FF, $00, $00, $00),

($18, $18, $18, $18, $18, $18, $18, $18),

($00, $18, $18, $3C, $3C, $7E, $7E, $FF),

($81, $42, $24, $18, $18, $24, $42, $81),

($18, $3C, $7E, $FF, $FF, $7E, $3C, $18)

);

CUBE_POS: array[0..35] of array[0..2] of Single = (

(-0.5,-0.5, 0.5), ( 0.5,-0.5, 0.5), ( 0.5, 0.5, 0.5),

(-0.5,-0.5, 0.5), ( 0.5, 0.5, 0.5), (-0.5, 0.5, 0.5),

( 0.5,-0.5,-0.5), (-0.5,-0.5,-0.5), (-0.5, 0.5,-0.5),

( 0.5,-0.5,-0.5), (-0.5, 0.5,-0.5), ( 0.5, 0.5,-0.5),

( 0.5,-0.5, 0.5), ( 0.5,-0.5,-0.5), ( 0.5, 0.5,-0.5),

( 0.5,-0.5, 0.5), ( 0.5, 0.5,-0.5), ( 0.5, 0.5, 0.5),

(-0.5,-0.5,-0.5), (-0.5,-0.5, 0.5), (-0.5, 0.5, 0.5),

(-0.5,-0.5,-0.5), (-0.5, 0.5, 0.5), (-0.5, 0.5,-0.5),

(-0.5, 0.5, 0.5), ( 0.5, 0.5, 0.5), ( 0.5, 0.5,-0.5),

(-0.5, 0.5, 0.5), ( 0.5, 0.5,-0.5), (-0.5, 0.5,-0.5),

(-0.5,-0.5,-0.5), ( 0.5,-0.5,-0.5), ( 0.5,-0.5, 0.5),

(-0.5,-0.5,-0.5), ( 0.5,-0.5, 0.5), (-0.5,-0.5, 0.5)

);

CUBE_SHADE: array[0..5] of Single = (1.0, 0.65, 0.85, 0.75, 0.95, 0.60);

STYLE_CSS =

'.gl_wrap{position:relative;width:100%;max-width:860px;min-height:260px;aspect-ratio:16/9;margin:0 auto;border:1px solid #1b2436;border-radius:8px;overflow:hidden;background:#1a0d2e}' +

'.gl_wrap canvas{width:100%;height:100%;display:block;outline:none}' +

'.gl_hud{position:absolute;left:10px;top:10px;padding:6px 10px;border-radius:4px;background:rgba(10,14,23,0.82);color:#e2e8f0;font:12px/1.45 monospace;pointer-events:none}' +

'.gl_ctrl{position:absolute;left:0;right:0;bottom:12px;display:flex;flex-wrap:wrap;justify-content:center;gap:6px;padding:0 12px;font:12px monospace;z-index:2}' +

'.gl_btn{padding:6px 12px;border:1px solid #334155;border-radius:4px;background:rgba(30,41,59,0.92);color:#f8fafc;cursor:pointer}' +

'.gl_btn:hover{background:#334155}' +

'.gl_btn_spin{background:rgba(37,99,235,0.95);border-color:#3b82f6}' +

'.gl_btn_spin:hover{background:#1d4ed8}' +

'.gl_btn_held{background:rgba(21,128,61,0.95);border-color:#22c55e}';

type

TReel = record

X, Angle, StartAngle, TargetAngle: Single;

SpinTime, SpinElapsed: Single;

Spinning, Held: Boolean;

end;

TParticle = record

X, Y, Z: Single;

VX, VY, VZ: Single;

Life, MaxLife: Single;

Size: Single;

R, G, B: Single;

Active: Boolean;

end;

var

web: TWeb;

gl: TGLContext;

cmd: TGLCmdBuf;

canvasH, wrapH, hudH, ctrlH: Integer;

btnSpinH, btnResetH: Integer;

btnHoldH: array[0..NUM_REELS-1] of Integer;

prog, uMVP: Integer;

audio_h: Integer = 0;

master_node: Integer = 0;

master_gain: Integer = 0;

reelVAO: array[0..NUM_REELS-1] of Integer;

reelVBO: array[0..NUM_REELS-1] of Integer;

reelPerm: array[0..NUM_REELS-1, 0..NUM_FACES-1] of Integer;

cubeVAO, cubeVBO: Integer;

cubeBuf: array[0..CUBE_VERTS * FLOATS_PER_VERTEX - 1] of Single;

reelBuf: array[0..REEL_VERTS * FLOATS_PER_VERTEX - 1] of Single;

reels: array[0..NUM_REELS-1] of TReel;

reelsStopped: Boolean;

particles: array[0..MAX_PARTICLES-1] of TParticle;

winRow: Integer;

winTimer: Single;

curW, curH: Integer;

lastMs, totalTime: Double;

camPos, camTarget, camUp: TVec3;

statusLine: string;

procedure BuildAudio;

var

dest: Integer;

begin

audio_h := web.NewAudioContext;

if audio_h = 0 then Exit;

master_node := web.CallMethodRet(audio_h, 'createGain');

master_gain := web.GetProperty(master_node, 'gain');

web.SetPropertyF64(master_gain, 'value', 0.25);

dest := web.GetProperty(audio_h, 'destination');

web.CallMethod1h(master_node, 'connect', dest);

web.ReleaseHandle(dest);

end;

procedure EnsureAudioRunning;

begin

if audio_h <> 0 then

web.CallMethod0(audio_h, 'resume');

end;

procedure EmitToneAt(wave: string; startFreq, endFreq, peakGain, startOffset, dur: Double);

var

osc, gn, freq_p, gain_p: Integer;

t0: Double;

begin

if (audio_h = 0) or (master_node = 0) then Exit;

t0 := web.GetPropertyF64(audio_h, 'currentTime') + startOffset;

osc := web.CallMethodRet(audio_h, 'createOscillator');

gn := web.CallMethodRet(audio_h, 'createGain');

web.SetPropertyStr(osc, 'type', wave);

freq_p := web.GetProperty(osc, 'frequency');

web.SetPropertyF64(freq_p, 'value', startFreq);

gain_p := web.GetProperty(gn, 'gain');

web.SetPropertyF64(gain_p, 'value', peakGain);

web.CallMethod1h(osc, 'connect', gn);

web.CallMethod1h(gn, 'connect', master_node);

if endFreq > 0.0 then

web.CallMethod2f(freq_p, 'exponentialRampToValueAtTime', endFreq, t0 + dur * 0.8);

web.CallMethod2f(gain_p, 'exponentialRampToValueAtTime', 0.001, t0 + dur);

web.CallMethod0(osc, 'start');

web.CallMethod1f(osc, 'stop', t0 + dur + 0.02);

web.ReleaseHandle(freq_p);

web.ReleaseHandle(gain_p);

web.ReleaseHandle(osc);

web.ReleaseHandle(gn);

end;

procedure PlaySoundKind(kind: Integer);

var

k: Integer;

begin

if (kind < 0) or (audio_h = 0) then Exit;

web.CallMethod0(audio_h, 'resume');

case kind of

SND_SPIN:

begin

EmitToneAt('triangle', 220.0, 65.0, 0.35, 0.0, 0.09);

web.AudioNoise(audio_h, master_node, 0.05, 0.15);

end;

SND_REELSTOP:

EmitToneAt('sine', 140.0, 28.0, 0.40, 0.0, 0.08);

SND_HOLD:

EmitToneAt('square', 660.0, 880.0, 0.22, 0.0, 0.05);

SND_WIN:

for k := 0 to 3 do

EmitToneAt('triangle', Double(WIN_NOTES[k]), 0.0, 0.35, Double(k) * 0.09, 0.14);

SND_NOWIN:

EmitToneAt('sine', 240.0, 90.0, 0.28, 0.0, 0.18);

end;

end;

function VertShaderSrc: string;

begin

VertShaderSrc :=

'#version 300 es'#10 +

'layout(location = 0) in vec3 aPos;'#10 +

'layout(location = 1) in vec4 aColor;'#10 +

'uniform mat4 uMVP;'#10 +

'out vec4 vColor;'#10 +

'void main() {'#10 +

' gl_Position = uMVP * vec4(aPos, 1.0);'#10 +

' vColor = aColor;'#10 +

'}'#10;

end;

function FragShaderSrc: string;

begin

FragShaderSrc :=

'#version 300 es'#10 +

'precision highp float;'#10 +

'in vec4 vColor;'#10 +

'out vec4 fragColor;'#10 +

'void main() {'#10 +

' fragColor = vColor;'#10 +

'}'#10;

end;

function RandUnit: Single;

begin

RandUnit := Single(Random(10000)) / 10000.0;

end;

function RandSigned: Single;

begin

RandSigned := RandUnit * 2.0 - 1.0;

end;

procedure WriteVert(var arr: array of Single; vIdx: Integer;

x, y, z, r, g, b, a: Single);

var

base: Integer;

begin

base := vIdx * FLOATS_PER_VERTEX;

arr[base + 0] := x;

arr[base + 1] := y;

arr[base + 2] := z;

arr[base + 3] := r;

arr[base + 4] := g;

arr[base + 5] := b;

arr[base + 6] := a;

end;

procedure InitUnitCube;

var

vi: Integer;

sh: Single;

begin

for vi := 0 to CUBE_VERTS - 1 do

begin

sh := CUBE_SHADE[vi div 6];

WriteVert(cubeBuf, vi,

CUBE_POS[vi][0], CUBE_POS[vi][1], CUBE_POS[vi][2],

sh, sh, sh, 1.0);

end;

end;

procedure BuildReelBuffer(reelIdx: Integer; r, l: Single);

var

i, ix, ia, vIdx, ci: Integer;

a0, a, aPrev, dA, x0, x1, dX, shade: Single;

cr, cg, cb, vr, vg, vb: Single;

patByte: Byte;

isLit: Boolean;

begin

vIdx := 0;

dX := l / Single(GRID_X);

dA := (2.0 * 3.14159265 / Single(NUM_FACES)) / Single(GRID_A);

for i := 0 to NUM_FACES - 1 do

begin

a0 := Single(i) * 2.0 * 3.14159265 / Single(NUM_FACES);

ci := reelPerm[reelIdx][i];

cr := FACE_R[ci];

cg := FACE_G[ci];

cb := FACE_B[ci];

for ia := 0 to GRID_A - 1 do

begin

patByte := SYMBOL_PATTERN[ci][ia];

for ix := 0 to GRID_X - 1 do

begin

isLit := (patByte and (1 shl (GRID_X - 1 - ix))) <> 0;

if isLit then

begin

vr := 1.0; vg := 1.0; vb := 0.92;

end

else

begin

shade := 1.0 + 0.08 * Sin(Single(ix) * 1.3 + Single(ia) * 2.1);

vr := cr * shade;

vg := cg * shade;

vb := cb * shade;

end;

x0 := -l * 0.5 + Single(ix) * dX;

x1 := x0 + dX;

a := a0 + Single(ia) * dA;

aPrev := a + dA;

WriteVert(reelBuf, vIdx, x0, r * Cos(a), r * Sin(a), vr, vg, vb, 1.0); Inc(vIdx);

WriteVert(reelBuf, vIdx, x0, r * Cos(aPrev), r * Sin(aPrev), vr, vg, vb, 1.0); Inc(vIdx);

WriteVert(reelBuf, vIdx, x1, r * Cos(a), r * Sin(a), vr, vg, vb, 1.0); Inc(vIdx);

WriteVert(reelBuf, vIdx, x1, r * Cos(a), r * Sin(a), vr, vg, vb, 1.0); Inc(vIdx);

WriteVert(reelBuf, vIdx, x0, r * Cos(aPrev), r * Sin(aPrev), vr, vg, vb, 1.0); Inc(vIdx);

WriteVert(reelBuf, vIdx, x1, r * Cos(aPrev), r * Sin(aPrev), vr, vg, vb, 1.0); Inc(vIdx);

end;

end;

end;

end;

procedure ShuffleReelPerm(reelIdx: Integer);

var

j, t, tmp: Integer;

begin

for j := 0 to NUM_FACES - 1 do

reelPerm[reelIdx][j] := j;

for j := NUM_FACES - 1 downto 1 do

begin

t := Random(j + 1);

tmp := reelPerm[reelIdx][j];

reelPerm[reelIdx][j] := reelPerm[reelIdx][t];

reelPerm[reelIdx][t] := tmp;

end;

end;

procedure SetupReelsAndBuffers;

var

i, strideBytes: Integer;

begin

strideBytes := FLOATS_PER_VERTEX * 4;

cubeVAO := gl.AllocVertexArray;

cubeVBO := gl.AllocBuffer;

cmd.CreateVertexArray(cubeVAO);

cmd.BindVertexArray(cubeVAO);

cmd.CreateBuffer(cubeVBO);

cmd.BindBuffer(GL_ARRAY_BUFFER, cubeVBO);

cmd.BufferDataFloats(GL_ARRAY_BUFFER, u/cubeBuf[0], CUBE_VERTS * FLOATS_PER_VERTEX, GL_STATIC_DRAW);

cmd.EnableVertexAttribArray(0);

cmd.VertexAttribPointer(0, 3, GL_FLOAT, False, strideBytes, 0);

cmd.EnableVertexAttribArray(1);

cmd.VertexAttribPointer(1, 4, GL_FLOAT, False, strideBytes, 12);

for i := 0 to NUM_REELS - 1 do

begin

ShuffleReelPerm(i);

BuildReelBuffer(i, REEL_RADIUS, REEL_LENGTH);

reelVAO[i] := gl.AllocVertexArray;

reelVBO[i] := gl.AllocBuffer;

cmd.CreateVertexArray(reelVAO[i]);

cmd.BindVertexArray(reelVAO[i]);

cmd.CreateBuffer(reelVBO[i]);

cmd.BindBuffer(GL_ARRAY_BUFFER, reelVBO[i]);

cmd.BufferDataFloats(GL_ARRAY_BUFFER, u/reelBuf[0], REEL_VERTS * FLOATS_PER_VERTEX, GL_STATIC_DRAW);

cmd.EnableVertexAttribArray(0);

cmd.VertexAttribPointer(0, 3, GL_FLOAT, False, strideBytes, 0);

cmd.EnableVertexAttribArray(1);

cmd.VertexAttribPointer(1, 4, GL_FLOAT, False, strideBytes, 12);

end;

end;

procedure UpdateHoldButtonLabels;

var

i: Integer;

idxStr: string;

begin

for i := 0 to NUM_REELS - 1 do

begin

Str(i + 1, idxStr);

if reels[i].Held then

begin

web.SetInnerText(btnHoldH[i], 'Hold ' + idxStr + ': FOGVA');

web.SetClassName(btnHoldH[i], 'gl_btn gl_btn_held');

end

else

begin

web.SetInnerText(btnHoldH[i], 'Hold ' + idxStr);

web.SetClassName(btnHoldH[i], 'gl_btn');

end;

end;

end;

procedure InitReels;

var

i: Integer;

begin

for i := 0 to NUM_REELS - 1 do

begin

reels[i].X := (Single(i) - Single(NUM_REELS - 1) * 0.5) * REEL_SPACING;

reels[i].Angle := Single(Random(NUM_FACES)) * (2.0 * 3.14159265 / Single(NUM_FACES));

reels[i].StartAngle := reels[i].Angle;

reels[i].TargetAngle := reels[i].Angle;

reels[i].SpinTime := 0.0;

reels[i].SpinElapsed := 0.0;

reels[i].Spinning := False;

reels[i].Held := False;

end;

reelsStopped := True;

UpdateHoldButtonLabels;

end;

procedure InitParticles;

var

i: Integer;

begin

for i := 0 to MAX_PARTICLES - 1 do

particles[i].Active := False;

end;

function FindFreeParticle: Integer;

var

i: Integer;

begin

for i := 0 to MAX_PARTICLES - 1 do

if not particles[i].Active then

begin

FindFreeParticle := i;

Exit;

end;

FindFreeParticle := -1;

end;

procedure SpawnParticle(x, y, z, vx, vy, vz, life, sz, r, g, b: Single);

var

p: Integer;

begin

p := FindFreeParticle;

if p = -1 then Exit;

particles[p].X := x; particles[p].Y := y; particles[p].Z := z;

particles[p].VX := vx; particles[p].VY := vy; particles[p].VZ := vz;

particles[p].MaxLife := life; particles[p].Life := life;

particles[p].Size := sz;

particles[p].R := r; particles[p].G := g; particles[p].B := b;

particles[p].Active := True;

end;

function WinningRowY(row: Integer): Single;

begin

case row of

0: WinningRowY := REEL_RADIUS * 0.87;

1: WinningRowY := 0.0;

2: WinningRowY := -REEL_RADIUS * 0.87;

else

WinningRowY := 0.0;

end;

end;

procedure SpawnWinSparks(row: Integer);

var

i, k: Integer;

baseY, x, theta, spd: Single;

begin

baseY := WinningRowY(row);

for i := 0 to NUM_REELS - 1 do

begin

x := reels[i].X;

for k := 0 to 39 do

begin

theta := RandUnit * 2.0 * 3.14159265;

spd := 3.0 + RandUnit * 6.0;

SpawnParticle(

x + RandSigned * REEL_LENGTH * 0.4,

baseY + RandSigned * 0.1,

REEL_RADIUS * 0.9 + RandUnit * 0.3,

Cos(theta) * spd * 0.6,

2.0 + RandUnit * 6.0,

1.5 + RandUnit * 3.5,

0.6 + RandUnit * 0.9,

0.08 + RandUnit * 0.06,

1.0, 0.70 + RandUnit * 0.30, 0.12 + RandUnit * 0.31

);

end;

end;

end;

procedure UpdateParticles(dt: Single);

var

i: Integer;

begin

for i := 0 to MAX_PARTICLES - 1 do

begin

if not particles[i].Active then Continue;

particles[i].X := particles[i].X + particles[i].VX * dt;

particles[i].Y := particles[i].Y + particles[i].VY * dt;

particles[i].Z := particles[i].Z + particles[i].VZ * dt;

particles[i].VY := particles[i].VY + PARTICLE_GRAVITY * dt;

particles[i].Life := particles[i].Life - dt;

if particles[i].Life <= 0.0 then particles[i].Active := False;

end;

end;

procedure CheckWin;

var

i, k, iTop, iMid, iBot, wRow: Integer;

topC, midC, botC: array[0..NUM_REELS-1] of Integer;

topMatch, midMatch, botMatch: Boolean;

stepAngle: Single;

begin

stepAngle := 2.0 * 3.14159265 / Single(NUM_FACES);

for i := 0 to NUM_REELS - 1 do

begin

k := Round(reels[i].Angle / stepAngle) mod NUM_FACES;

if k < 0 then k := k + NUM_FACES;

iTop := ((0 - k) mod NUM_FACES + NUM_FACES) mod NUM_FACES;

iMid := ((1 - k) mod NUM_FACES + NUM_FACES) mod NUM_FACES;

iBot := ((2 - k) mod NUM_FACES + NUM_FACES) mod NUM_FACES;

topC[i] := reelPerm[i][iTop];

midC[i] := reelPerm[i][iMid];

botC[i] := reelPerm[i][iBot];

end;

topMatch := True; midMatch := True; botMatch := True;

for i := 1 to NUM_REELS - 1 do

begin

if topC[i] <> topC[0] then topMatch := False;

if midC[i] <> midC[0] then midMatch := False;

if botC[i] <> botC[0] then botMatch := False;

end;

wRow := -1;

if topMatch then wRow := 0

else if midMatch then wRow := 1

else if botMatch then wRow := 2;

if wRow >= 0 then

begin

winRow := wRow;

winTimer := WIN_BLINK_TIME;

SpawnWinSparks(wRow);

statusLine := 'NYERTES!';

PlaySoundKind(SND_WIN);

end

else

begin

winRow := -1;

winTimer := 0.0;

statusLine := 'Nem nyert';

PlaySoundKind(SND_NOWIN);

end;

end;

procedure SpinReel(i: Integer);

var

turns, extra: Integer;

stepAngle: Single;

begin

stepAngle := 2.0 * 3.14159265 / Single(NUM_FACES);

reels[i].StartAngle := reels[i].Angle;

turns := 2 + Random(3);

extra := Random(NUM_FACES);

reels[i].TargetAngle := reels[i].StartAngle + Single(turns) * 2.0 * 3.14159265 + Single(extra) * stepAngle;

reels[i].SpinTime := 1.5 + RandUnit * 1.5 + Single(i) * 0.35;

reels[i].SpinElapsed := 0.0;

reels[i].Spinning := True;

end;

procedure StartSpin;

var

i, spinning: Integer;

begin

EnsureAudioRunning;

if not reelsStopped then Exit;

winRow := -1;

winTimer := 0.0;

spinning := 0;

for i := 0 to NUM_REELS - 1 do

if not reels[i].Held then

begin

SpinReel(i);

spinning := spinning + 1;

end;

if spinning = 0 then

begin

statusLine := 'Minden tarcsa fogva';

Exit;

end;

reelsStopped := False;

statusLine := 'Porges...';

PlaySoundKind(SND_SPIN);

end;

procedure ToggleHold(i: Integer);

begin

EnsureAudioRunning;

if (i < 0) or (i >= NUM_REELS) then Exit;

if not reelsStopped then Exit;

reels[i].Held := not reels[i].Held;

UpdateHoldButtonLabels;

PlaySoundKind(SND_HOLD);

end;

procedure ResetGame;

var

i: Integer;

begin

EnsureAudioRunning;

for i := 0 to NUM_REELS - 1 do

begin

ShuffleReelPerm(i);

BuildReelBuffer(i, REEL_RADIUS, REEL_LENGTH);

cmd.BindBuffer(GL_ARRAY_BUFFER, reelVBO[i]);

cmd.BufferDataFloats(GL_ARRAY_BUFFER, u/reelBuf[0], REEL_VERTS * FLOATS_PER_VERTEX, GL_STATIC_DRAW);

end;

cmd.BindBuffer(GL_ARRAY_BUFFER, 0);

cmd.Flush(gl);

InitReels;

InitParticles;

winRow := -1;

winTimer := 0.0;

statusLine := 'Ujrainditva';

end;

procedure OnSpinClick(id: Integer);

begin

if id < 0 then Exit;

StartSpin;

end;

procedure OnHold1Click(id: Integer);

begin

if id < 0 then Exit;

ToggleHold(0);

end;

procedure OnHold2Click(id: Integer);

begin

if id < 0 then Exit;

ToggleHold(1);

end;

procedure OnHold3Click(id: Integer);

begin

if id < 0 then Exit;

ToggleHold(2);

end;

procedure OnHold4Click(id: Integer);

begin

if id < 0 then Exit;

ToggleHold(3);

end;

procedure OnResetClick(id: Integer);

begin

if id < 0 then Exit;

ResetGame;

end;

procedure UpdateReels(dt: Single);

var

i: Integer;

t, ease: Single;

anySpinning: Boolean;

begin

anySpinning := False;

for i := 0 to NUM_REELS - 1 do

begin

if not reels[i].Spinning then Continue;

reels[i].SpinElapsed := reels[i].SpinElapsed + dt;

if reels[i].SpinElapsed >= reels[i].SpinTime then

begin

reels[i].Angle := reels[i].TargetAngle;

reels[i].Spinning := False;

PlaySoundKind(SND_REELSTOP);

end

else

begin

anySpinning := True;

t := reels[i].SpinElapsed / reels[i].SpinTime;

ease := 1.0 - (1.0 - t) * (1.0 - t) * (1.0 - t);

reels[i].Angle := reels[i].StartAngle + (reels[i].TargetAngle - reels[i].StartAngle) * ease;

end;

end;

if anySpinning then

reelsStopped := False

else if not reelsStopped then

begin

reelsStopped := True;

CheckWin;

end;

end;

procedure EmitCube(const viewProj, model: TMat4);

var

mvp: TMat4;

begin

mvp := Mat4Mul(viewProj, model);

cmd.BindVertexArray(cubeVAO);

cmd.UniformMatrix4fv(uMVP, False, u/mvp[0]);

cmd.DrawArrays(GL_TRIANGLES, 0, CUBE_VERTS);

end;

procedure Tick(id: Integer);

var

nw, nh, i: Integer;

nowMs, dtSec: Double;

dt, aspect, frameX, lifeRatio, sz, pulse, barH, totalW, y1, y2: Single;

proj, view, viewProj, model, mvp: TMat4;

begin

if id < 0 then Exit;

if web.CanvasResizeToDisplaySize(canvasH, nw, nh) then

begin

if nw > 0 then curW := nw;

if nh > 0 then curH := nh;

end;

if (curW <= 0) or (curH <= 0) then Exit;

nowMs := web.NowMs;

dtSec := (nowMs - lastMs) * 0.001;

lastMs := nowMs;

if dtSec < 0.0 then dtSec := 0.0;

if dtSec > 0.033 then dtSec := 0.033;

dt := Single(dtSec);

totalTime := totalTime + dtSec;

UpdateReels(dt);

UpdateParticles(dt);

if winTimer > 0.0 then winTimer := winTimer - dt;

if curH > 1 then aspect := Single(curW) / Single(curH) else aspect := Single(curW);

proj := Mat4Perspective(DegToRad(60.0), aspect, 0.1, 100.0);

view := Mat4LookAt(camPos, camTarget, camUp);

viewProj := Mat4Mul(proj, view);

cmd.Reset;

cmd.Viewport(0, 0, curW, curH);

cmd.ClearColor(0.10, 0.05, 0.18, 1.0);

cmd.Clear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT);

cmd.UseProgram(prog);

for i := 0 to NUM_REELS - 1 do

begin

model := Mat4Mul(Mat4Translate(reels[i].X, 0.0, 0.0), Mat4RotateX(reels[i].Angle));

mvp := Mat4Mul(viewProj, model);

cmd.BindVertexArray(reelVAO[i]);

cmd.UniformMatrix4fv(uMVP, False, u/mvp[0]);

cmd.DrawArrays(GL_TRIANGLES, 0, REEL_VERTS);

end;

for i := 0 to NUM_REELS do

begin

frameX := (Single(i) - Single(NUM_REELS) * 0.5) * REEL_SPACING;

model := Mat4Mul(

Mat4Translate(frameX, 0.0, REEL_RADIUS + 0.15),

Mat4Scale(0.15, REEL_RADIUS * 2.0 + 0.4, 0.25)

);

EmitCube(viewProj, model);

end;

model := Mat4Mul(

Mat4Translate(0.0, REEL_RADIUS + 0.18, REEL_RADIUS + 0.15),

Mat4Scale(Single(NUM_REELS) * REEL_SPACING + 0.3, 0.18, 0.25)

);

EmitCube(viewProj, model);

model := Mat4Mul(

Mat4Translate(0.0, -REEL_RADIUS - 0.18, REEL_RADIUS + 0.15),

Mat4Scale(Single(NUM_REELS) * REEL_SPACING + 0.3, 0.18, 0.25)

);

EmitCube(viewProj, model);

for i := 0 to NUM_REELS - 1 do

if reels[i].Held then

begin

model := Mat4Mul(

Mat4Translate(reels[i].X, REEL_RADIUS + 0.55, 0.0),

Mat4Scale(0.35, 0.35, 0.35)

);

EmitCube(viewProj, model);

end;

for i := 0 to MAX_PARTICLES - 1 do

begin

if not particles[i].Active then Continue;

lifeRatio := particles[i].Life / particles[i].MaxLife;

if lifeRatio < 0.0 then lifeRatio := 0.0;

sz := particles[i].Size * (0.3 + 0.7 * lifeRatio);

model := Mat4Mul(

Mat4Translate(particles[i].X, particles[i].Y, particles[i].Z),

Mat4Scale(sz, sz, sz)

);

EmitCube(viewProj, model);

end;

if (winTimer > 0.0) and (winRow >= 0) then

begin

pulse := 0.5 + 0.5 * Sin(Single(totalTime) * WIN_BLINK_FREQ * 2.0 * 3.14159265);

barH := 0.08 + 0.22 * pulse;

case winRow of

0: begin y1 := REEL_RADIUS * 0.5; y2 := REEL_RADIUS; end;

1: begin y1 := -REEL_RADIUS * 0.5; y2 := REEL_RADIUS * 0.5; end;

2: begin y1 := -REEL_RADIUS; y2 := -REEL_RADIUS * 0.5; end;

else begin y1 := 0.0; y2 := 0.0; end;

end;

totalW := Single(NUM_REELS - 1) * REEL_SPACING + REEL_LENGTH + 0.8;

model := Mat4Mul(Mat4Translate(0.0, y1, REEL_RADIUS + 0.30), Mat4Scale(totalW, barH, 0.2));

EmitCube(viewProj, model);

model := Mat4Mul(Mat4Translate(0.0, y2, REEL_RADIUS + 0.30), Mat4Scale(totalW, barH, 0.2));

EmitCube(viewProj, model);

end;

cmd.Flush(gl);

web.SetInnerText(hudH, 'SLOT MACHINE 5 | ' + statusLine);

end;

function MakeButton(parentH: Integer; const labelText, extraClass: string): Integer;

var

b: Integer;

begin

b := web.CreateElement('button');

if extraClass <> '' then

web.SetClassName(b, 'gl_btn ' + extraClass)

else

web.SetClassName(b, 'gl_btn');

web.SetInnerText(b, labelText);

web.AppendChild(parentH, b);

MakeButton := b;

end;

procedure BindControls;

begin

web.On(btnSpinH, 'click', OnSpinClick);

web.On(btnHoldH[0], 'click', OnHold1Click);

web.On(btnHoldH[1], 'click', OnHold2Click);

web.On(btnHoldH[2], 'click', OnHold3Click);

web.On(btnHoldH[3], 'click', OnHold4Click);

web.On(btnResetH, 'click', OnResetClick);

end;

var

stageH, i: Integer;

begin

Randomize;

web := TWeb.Create;

web.AddStyle(STYLE_CSS);

stageH := web.GetElementById('stage');

wrapH := web.CreateElement('div');

web.SetClassName(wrapH, 'gl_wrap');

web.AppendChild(stageH, wrapH);

curW := 800;

curH := 450;

canvasH := web.CanvasCreate(wrapH, curW, curH);

hudH := web.CreateElement('div');

web.SetClassName(hudH, 'gl_hud');

statusLine := 'Kesz';

web.SetInnerText(hudH, 'SLOT MACHINE 5 | ' + statusLine);

web.AppendChild(wrapH, hudH);

ctrlH := web.CreateElement('div');

web.SetClassName(ctrlH, 'gl_ctrl');

web.AppendChild(wrapH, ctrlH);

btnSpinH := MakeButton(ctrlH, 'Porgetes', 'gl_btn_spin');

for i := 0 to NUM_REELS - 1 do

btnHoldH[i] := MakeButton(ctrlH, 'Hold', '');

btnResetH := MakeButton(ctrlH, 'Reset', '');

BuildAudio;

gl := TGLContext.Create(canvasH, GL_OPT_DEFAULT);

if not gl.IsValid then

begin

web.SetInnerText(hudH, 'WebGL2 is not available in this browser.');

Exit;

end;

cmd := TGLCmdBuf.Create(262144);

prog := gl.CompileProgram(VertShaderSrc, FragShaderSrc);

if prog = 0 then

begin

web.SetInnerText(hudH, 'Shader error: ' + gl.LastError);

web.Log(gl.LastError);

Exit;

end;

uMVP := gl.AllocUniform;

InitUnitCube;

SetupReelsAndBuffers;

InitReels;

InitParticles;

winRow := -1;

winTimer := 0.0;

totalTime := 0.0;

camPos := Vec3(0.0, -0.35, 8.6);

camTarget := Vec3(0.0, -0.25, 0.0);

camUp := Vec3(0.0, 1.0, 0.0);

cmd.CacheUniformLocation(uMVP, prog, 'uMVP');

cmd.Enable(GL_DEPTH_TEST);

cmd.Flush(gl);

web.CanvasResizeToDisplaySize(canvasH, curW, curH);

if curW <= 0 then curW := 800;

if curH <= 0 then curH := 450;

BindControls;

lastMs := web.NowMs;

web.OnTick(Tick);

end.


r/pascal • • 1d ago

VertexArt - Sandbox - wasmpascal test

5 Upvotes

{$M 16777216}

library sandbox_web;

{ VertexArt - Kovács István }

uses

Web;

const

GRID_W = 200;

GRID_H = 200;

GRID_LEN = GRID_W * GRID_H;

PIX_BYTES = GRID_LEN * 4;

WATER_DISPERSION = 4;

type

TCellType = (ctEmpty, ctWall, ctSand, ctWater, ctTorch, ctFire, ctSmoke);

var

web: TWeb;

stage_h, panel_h, cv_h, status_h: Integer;

btn_erase, btn_wall, btn_sand, btn_water, btn_torch, btn_fire, btn_smoke: Integer;

GridType: array[0..GRID_LEN - 1] of TCellType;

Updated: array[0..GRID_LEN - 1] of Byte;

SimSeed: array[0..GRID_LEN - 1] of Byte;

CellLife: array[0..GRID_LEN - 1] of Byte;

SmokeVx: array[0..GRID_LEN - 1] of ShortInt;

Pixels: array[0..GRID_LEN - 1] of LongWord;

CanvasDirty: Boolean = True;

SimRunning: Boolean = True;

StepParity: Integer = 0;

WindStrength: Integer = 25;

CurrentTool: TCellType = ctSand;

BrushRadius: Integer = 3;

MouseDown: Boolean = False;

LastGX, LastGY: Integer;

HasLastG: Boolean = False;

rect_left, rect_top: Double;

rect_scale_x, rect_scale_y: Double;

{ ---------- segédfüggvények ---------- }

function ClampByte(v: Integer): Byte;

begin

if v < 0 then Result := 0

else if v > 255 then Result := 255

else Result := Byte(v);

end;

function ClampInt(v, lo, hi: Integer): Integer;

begin

if v < lo then Result := lo

else if v > hi then Result := hi

else Result := v;

end;

function InBounds(gx, gy: Integer): Boolean;

begin

Result := (gx >= 0) and (gx < GRID_W) and (gy >= 0) and (gy < GRID_H);

end;

function CellToColor(idx: Integer): LongWord;

var

t: TCellType;

seed: Byte;

v, lifeVal, alphaVal: Integer;

rr, gg, bb, aa: Byte;

begin

rr := 0; gg := 0; bb := 0; aa := 255;

t := GridType[idx];

seed := SimSeed[idx];

v := (seed mod 21) - 10;

if t = ctEmpty then begin

rr := 14; gg := 16; bb := 22; aa := 255;

end

else if t = ctWall then begin

rr := ClampByte(95 + v div 2);

gg := ClampByte(100 + v div 2);

bb := ClampByte(115 + v div 2);

end

else if t = ctSand then begin

rr := ClampByte(222 + v);

gg := ClampByte(184 + v);

bb := ClampByte(96 + v div 2);

end

else if t = ctWater then begin

rr := ClampByte(35 + v div 3);

gg := ClampByte(135 + v);

bb := ClampByte(225 + v);

end

else if t = ctTorch then begin

rr := ClampByte(155 + v);

gg := ClampByte(85 + v div 2);

bb := ClampByte(35 + v div 4);

end

else if t = ctFire then begin

lifeVal := ClampInt(Integer(CellLife[idx]) * 4, 0, 200);

rr := ClampByte(225 + v);

gg := ClampByte(55 + lifeVal + v);

bb := ClampByte(15 + (lifeVal div 3) + (v div 3));

end

else begin

v := (seed mod 15) - 7;

lifeVal := ClampInt(Integer(CellLife[idx]) * 3, 0, 255);

alphaVal := 25 + (lifeVal * 180) div 255;

rr := ClampByte(95 + (lifeVal div 3) + v);

gg := ClampByte(98 + (lifeVal div 3) + v);

bb := ClampByte(108 + (lifeVal div 3) + v);

aa := ClampByte(alphaVal);

end;

Result := LongWord(rr) or (LongWord(gg) shl 8) or

(LongWord(bb) shl 16) or (LongWord(aa) shl 24);

end;

function WindDirection: Integer;

begin

if WindStrength > 0 then Result := 1

else if WindStrength < 0 then Result := -1

else Result := 0;

end;

function WindPushChance(baseScale: Integer): Boolean;

var absW, chance: Integer;

begin

Result := False;

if WindStrength = 0 then Exit;

absW := Abs(WindStrength);

chance := (absW * baseScale) div 100;

if chance < 1 then chance := 1;

if chance > 95 then chance := 95;

Result := Random(100) < chance;

end;

procedure SwapCells(idxA, idxB: Integer);

var

tmpT: TCellType; tmpS, tmpL: Byte; tmpVx: ShortInt;

begin

tmpT := GridType[idxA]; GridType[idxA] := GridType[idxB]; GridType[idxB] := tmpT;

tmpS := SimSeed[idxA]; SimSeed[idxA] := SimSeed[idxB]; SimSeed[idxB] := tmpS;

tmpL := CellLife[idxA]; CellLife[idxA] := CellLife[idxB]; CellLife[idxB] := tmpL;

tmpVx := SmokeVx[idxA]; SmokeVx[idxA] := SmokeVx[idxB]; SmokeVx[idxB] := tmpVx;

Updated[idxA] := 1; Updated[idxB] := 1;

CanvasDirty := True;

end;

procedure SetCell(gx, gy: Integer; t: TCellType);

var idx: Integer;

begin

if not InBounds(gx, gy) then Exit;

idx := gy * GRID_W + gx;

{ Tűz és füst: csak üres cellára kerülhet, semmit nem ír felül }

if (t = ctFire) or (t = ctSmoke) then

begin

if GridType[idx] <> ctEmpty then Exit;

end

else

begin

{ Egyéb anyagok: ha ugyanaz már ott van, ne írjuk újra }

if GridType[idx] = t then Exit;

end;

GridType[idx] := t;

SimSeed[idx] := Byte(Random(256));

if t = ctFire then

begin

CellLife[idx] := Byte(16 + Random(22)); SmokeVx[idx] := 0;

end

else if t = ctSmoke then

begin

CellLife[idx] := Byte(55 + Random(55));

if WindStrength <> 0 then SmokeVx[idx] := ShortInt(WindDirection)

else SmokeVx[idx] := ShortInt(Random(3) - 1);

end

else

begin

CellLife[idx] := 0; SmokeVx[idx] := 0;

end;

Updated[idx] := 1; CanvasDirty := True;

end;

procedure StampBrush(gx, gy: Integer; t: TCellType; r: Integer);

var dx, dy, r2: Integer;

begin

r2 := r * r;

for dy := -r to r do

for dx := -r to r do

if (dx * dx + dy * dy) <= r2 then

begin

{ Homok: 55% kihagyás → lazább, hézagosabb kupac }

if (t = ctSand) and (r > 1) and (Random(100) < 55) then Continue;

{ Tűz/füst: 35% kihagyás }

if ((t = ctFire) or (t = ctSmoke)) and (r > 1) and (Random(100) < 35) then Continue;

SetCell(gx + dx, gy + dy, t);

end;

end;

procedure StampLine(x0, y0, x1, y1: Integer; t: TCellType; r: Integer);

var dx, dy, sx, sy, err, e2: Integer;

begin

dx := Abs(x1 - x0);

dy := -Abs(y1 - y0);

if x0 < x1 then sx := 1 else sx := -1;

if y0 < y1 then sy := 1 else sy := -1;

err := dx + dy;

while True do

begin

StampBrush(x0, y0, t, r);

if (x0 = x1) and (y0 = y1) then Break;

e2 := 2 * err;

if e2 >= dy then begin err := err + dy; Inc(x0, sx); end;

if e2 <= dx then begin err := err + dx; Inc(y0, sy); end;

end;

end;

procedure ClearGrid;

var j: Integer;

begin

for j := 0 to GRID_LEN - 1 do

begin

GridType[j] := ctEmpty; Updated[j] := 0;

SimSeed[j] := Byte(Random(256)); CellLife[j] := 0; SmokeVx[j] := 0;

end;

CanvasDirty := True;

end;

{ ---------- szimuláció ---------- }

function CanSandDisplace(t: TCellType): Boolean;

begin Result := (t = ctEmpty) or (t = ctWater) or (t = ctSmoke); end;

function CanWaterDisplace(t: TCellType): Boolean;

begin Result := (t = ctEmpty) or (t = ctSmoke); end;

procedure StepSandCell(x, y, idx: Integer);

var

belowY, belowIdx, dir1, dir2, d, nx, nIdx, wDir: Integer;

airborne: Boolean;

begin

belowY := y + 1;

if belowY >= GRID_H then Exit;

belowIdx := belowY * GRID_W + x;

airborne := CanSandDisplace(GridType[belowIdx]);

{ Szél }

if airborne and (WindStrength <> 0) and WindPushChance(45) then

begin

wDir := WindDirection; nx := x + wDir;

if (nx >= 0) and (nx < GRID_W) then

begin

nIdx := belowY * GRID_W + nx;

if CanSandDisplace(GridType[nIdx]) then begin SwapCells(idx, nIdx); Exit; end;

end;

end;

if airborne then

begin

{ Ha víz van alatta, oldalra toljuk a vizet }

if GridType[belowIdx] = ctWater then

begin

dir1 := -1; dir2 := 1;

if Random(2) = 1 then begin dir1 := 1; dir2 := -1; end;

for d := 0 to 1 do

begin

if d = 0 then nx := x + dir1 else nx := x + dir2;

if (nx >= 0) and (nx < GRID_W) then

begin

nIdx := belowY * GRID_W + nx;

if CanWaterDisplace(GridType[nIdx]) then

begin

{ Víz oldalra, homok lefelé, eredeti hely üres }

GridType[nIdx] := ctWater;

SimSeed[nIdx] := SimSeed[belowIdx];

CellLife[nIdx] := CellLife[belowIdx];

SmokeVx[nIdx] := SmokeVx[belowIdx];

Updated[nIdx] := 1;

GridType[belowIdx] := ctSand;

SimSeed[belowIdx] := SimSeed[idx];

CellLife[belowIdx] := 0;

SmokeVx[belowIdx] := 0;

Updated[belowIdx] := 1;

GridType[idx] := ctEmpty;

SimSeed[idx] := Byte(Random(256));

CellLife[idx] := 0;

SmokeVx[idx] := 0;

Updated[idx] := 1;

CanvasDirty := True;

Exit;

end;

end;

end;

{ Ha nincs hely oldalra, a homok megáll }

Exit;

end;

SwapCells(idx, belowIdx);

Exit;

end;

{ Oldalra csúszás, ha lefelé nem megy }

if Random(2) = 0 then begin dir1 := -1; dir2 := 1; end

else begin dir1 := 1; dir2 := -1; end;

for d := 0 to 1 do

begin

if d = 0 then nx := x + dir1 else nx := x + dir2;

if (nx >= 0) and (nx < GRID_W) then

begin

nIdx := belowY * GRID_W + nx;

if CanSandDisplace(GridType[nIdx]) then begin SwapCells(idx, nIdx); Exit; end;

end;

end;

end;

procedure StepWaterCell(x, y, idx: Integer);

var

belowY, belowIdx, dir1, dir2, d, nx, nIdx, step, curX, bestIdx, wDir: Integer;

begin

belowY := y + 1;

if belowY < GRID_H then

begin

belowIdx := belowY * GRID_W + x;

if CanWaterDisplace(GridType[belowIdx]) then

begin

if (WindStrength <> 0) and WindPushChance(30) then

begin

wDir := WindDirection; nx := x + wDir;

if (nx >= 0) and (nx < GRID_W) and

CanWaterDisplace(GridType[belowY * GRID_W + nx]) then

begin SwapCells(idx, belowY * GRID_W + nx); Exit; end;

end;

SwapCells(idx, belowIdx); Exit;

end;

end;

if Random(2) = 0 then begin dir1 := -1; dir2 := 1; end

else begin dir1 := 1; dir2 := -1; end;

if belowY < GRID_H then

begin

for d := 0 to 1 do

begin

if d = 0 then nx := x + dir1 else nx := x + dir2;

if (nx >= 0) and (nx < GRID_W) and (GridType[y * GRID_W + nx] <> ctSand) then

begin

nIdx := belowY * GRID_W + nx;

if CanWaterDisplace(GridType[nIdx]) and

((belowY + 1 >= GRID_H) or (GridType[(belowY + 1) * GRID_W + nx] <> ctSand)) then

begin SwapCells(idx, nIdx); Exit; end;

end;

end;

end;

if (WindStrength <> 0) and WindPushChance(25) then

begin dir1 := WindDirection; dir2 := -dir1; end;

for d := 0 to 1 do

begin

if d = 0 then nx := dir1 else nx := dir2;

bestIdx := -1; curX := x;

for step := 1 to WATER_DISPERSION do

begin

curX := curX + nx;

if (curX < 0) or (curX >= GRID_W) then Break;

nIdx := y * GRID_W + curX;

if not CanWaterDisplace(GridType[nIdx]) then Break;

bestIdx := nIdx;

if (belowY < GRID_H) and CanWaterDisplace(GridType[belowY * GRID_W + curX]) then Break;

end;

if bestIdx <> -1 then begin SwapCells(idx, bestIdx); Exit; end;

end;

end;

procedure StepTorchCell(x, y, idx: Integer);

var topY, topIdx, spawnX, wDir: Integer;

begin

topY := y - 1;

if topY < 0 then Exit;

topIdx := topY * GRID_W + x;

if GridType[topIdx] = ctWater then

begin

GridType[idx] := ctEmpty; CellLife[idx] := 0; SmokeVx[idx] := 0;

CanvasDirty := True; Exit;

end;

if Random(100) < 65 then

begin

if (WindStrength <> 0) and WindPushChance(75) then wDir := WindDirection

else wDir := Random(3) - 1;

spawnX := x + wDir;

if (spawnX >= 0) and (spawnX < GRID_W) then

begin

topIdx := topY * GRID_W + spawnX;

if GridType[topIdx] = ctEmpty then

begin

GridType[topIdx] := ctFire;

CellLife[topIdx] := Byte(16 + Random(22));

SmokeVx[topIdx] := ShortInt(wDir);

SimSeed[topIdx] := Byte(Random(256));

Updated[topIdx] := 1; CanvasDirty := True;

end;

end;

end;

end;

procedure StepFireCell(x, y, idx: Integer);

var upY, nx, nIdx, d: Integer;

begin

if (y > 0) and (GridType[(y - 1) * GRID_W + x] = ctWater) then

begin

GridType[idx] := ctSmoke; CellLife[idx] := Byte(45 + Random(40));

SmokeVx[idx] := ShortInt(WindDirection); Updated[idx] := 1;

CanvasDirty := True; Exit;

end;

if CellLife[idx] <= 1 then

begin

if Random(100) < 45 then

begin

GridType[idx] := ctSmoke; CellLife[idx] := Byte(50 + Random(50));

if WindStrength <> 0 then SmokeVx[idx] := ShortInt(WindDirection)

else SmokeVx[idx] := ShortInt(Random(3) - 1);

end

else

begin

GridType[idx] := ctEmpty; CellLife[idx] := 0; SmokeVx[idx] := 0;

end;

Updated[idx] := 1; CanvasDirty := True; Exit;

end;

Dec(CellLife[idx]); CanvasDirty := True;

upY := y - 1;

if upY < 0 then

begin

GridType[idx] := ctEmpty; CellLife[idx] := 0; SmokeVx[idx] := 0;

CanvasDirty := True; Exit;

end;

if (WindStrength <> 0) and WindPushChance(85) then d := WindDirection

else d := Random(3) - 1;

nx := x + d;

if (nx >= 0) and (nx < GRID_W) then

begin

nIdx := upY * GRID_W + nx;

if GridType[nIdx] = ctEmpty then begin SwapCells(idx, nIdx); Exit; end;

end;

nx := x + d;

if (nx >= 0) and (nx < GRID_W) then

begin

nIdx := y * GRID_W + nx;

if GridType[nIdx] = ctEmpty then begin SwapCells(idx, nIdx); Exit; end;

end;

end;

procedure StepSmokeCell(x, y, idx: Integer);

var upY, nx, nIdx, dir: Integer;

begin

if CellLife[idx] <= 1 then

begin

GridType[idx] := ctEmpty; CellLife[idx] := 0; SmokeVx[idx] := 0;

Updated[idx] := 1; CanvasDirty := True; Exit;

end;

Dec(CellLife[idx]); CanvasDirty := True;

if (WindStrength <> 0) and WindPushChance(35) then

SmokeVx[idx] := ShortInt(WindDirection)

else if Random(100) < 18 then

SmokeVx[idx] := ShortInt(Random(3) - 1);

upY := y - 1;

if upY < 0 then

begin

GridType[idx] := ctEmpty; CellLife[idx] := 0; SmokeVx[idx] := 0;

Updated[idx] := 1; CanvasDirty := True; Exit;

end;

dir := Integer(SmokeVx[idx]);

if dir = 0 then dir := Random(3) - 1;

nx := x + dir;

if (nx >= 0) and (nx < GRID_W) then

begin

nIdx := upY * GRID_W + nx;

if GridType[nIdx] = ctEmpty then begin SwapCells(idx, nIdx); Exit; end;

end;

nIdx := upY * GRID_W + x;

if GridType[nIdx] = ctEmpty then begin SwapCells(idx, nIdx); Exit; end;

nx := x + dir;

if (nx >= 0) and (nx < GRID_W) then

begin

nIdx := y * GRID_W + nx;

if GridType[nIdx] = ctEmpty then begin SwapCells(idx, nIdx); Exit; end;

end;

nx := x - dir;

if (nx >= 0) and (nx < GRID_W) then

begin

nIdx := y * GRID_W + nx;

if GridType[nIdx] = ctEmpty then

begin SmokeVx[idx] := ShortInt(-dir); SwapCells(idx, nIdx); Exit; end;

end;

end;

procedure StepSandbox;

var x, y, idx: Integer; t: TCellType;

begin

FillChar(Updated[0], GRID_LEN, 0);

StepParity := 1 - StepParity;

for y := GRID_H - 1 downto 0 do

begin

if StepParity = 0 then

begin

for x := 0 to GRID_W - 1 do

begin

idx := y * GRID_W + x;

if Updated[idx] <> 0 then Continue;

t := GridType[idx];

if t = ctSand then StepSandCell(x, y, idx)

else if t = ctWater then StepWaterCell(x, y, idx);

end;

end

else

begin

for x := GRID_W - 1 downto 0 do

begin

idx := y * GRID_W + x;

if Updated[idx] <> 0 then Continue;

t := GridType[idx];

if t = ctSand then StepSandCell(x, y, idx)

else if t = ctWater then StepWaterCell(x, y, idx);

end;

end;

end;

for y := 0 to GRID_H - 1 do

begin

if StepParity = 0 then

begin

for x := 0 to GRID_W - 1 do

begin

idx := y * GRID_W + x;

if Updated[idx] <> 0 then Continue;

t := GridType[idx];

if t = ctTorch then StepTorchCell(x, y, idx)

else if t = ctFire then StepFireCell(x, y, idx)

else if t = ctSmoke then StepSmokeCell(x, y, idx);

end;

end

else

begin

for x := GRID_W - 1 downto 0 do

begin

idx := y * GRID_W + x;

if Updated[idx] <> 0 then Continue;

t := GridType[idx];

if t = ctTorch then StepTorchCell(x, y, idx)

else if t = ctFire then StepFireCell(x, y, idx)

else if t = ctSmoke then StepSmokeCell(x, y, idx);

end;

end;

end;

end;

{ ---------- megjelenítés ---------- }

procedure RebuildPixels;

var j: Integer;

begin

for j := 0 to GRID_LEN - 1 do

Pixels[j] := CellToColor(j);

end;

procedure RenderFrame;

begin

if CanvasDirty then begin RebuildPixels; CanvasDirty := False; end;

web.RenderCanvas(Integer(@Pixels[0]), PIX_BYTES);

end;

{ ---------- gomb handlerek ---------- }

procedure ClickErase(id: Integer); begin CurrentTool := ctEmpty; web.SetInnerText(status_h, 'Tool: Erase'); end;

procedure ClickWall(id: Integer); begin CurrentTool := ctWall; web.SetInnerText(status_h, 'Tool: Wall'); end;

procedure ClickSand(id: Integer); begin CurrentTool := ctSand; web.SetInnerText(status_h, 'Tool: Sand'); end;

procedure ClickWater(id: Integer); begin CurrentTool := ctWater; web.SetInnerText(status_h, 'Tool: Water'); end;

procedure ClickTorch(id: Integer); begin CurrentTool := ctTorch; web.SetInnerText(status_h, 'Tool: Torch'); end;

procedure ClickFire(id: Integer); begin CurrentTool := ctFire; web.SetInnerText(status_h, 'Tool: Fire'); end;

procedure ClickSmoke(id: Integer); begin CurrentTool := ctSmoke; web.SetInnerText(status_h, 'Tool: Smoke'); end;

{ ---------- egér / pointer ---------- }

procedure RefreshRect;

var

rect: Integer;

rw, rh: Double;

begin

if cv_h = 0 then Exit;

rect := web.CallMethodRet(cv_h, 'getBoundingClientRect');

rect_left := web.GetPropertyF64(rect, 'left');

rect_top := web.GetPropertyF64(rect, 'top');

rw := web.GetPropertyF64(rect, 'width');

rh := web.GetPropertyF64(rect, 'height');

web.ReleaseHandle(rect);

if rw > 0.5 then rect_scale_x := Double(GRID_W) / rw;

if rh > 0.5 then rect_scale_y := Double(GRID_H) / rh;

end;

procedure EventToGrid(var gx, gy: Integer);

begin

gx := Trunc((web.EventClientX - rect_left) * rect_scale_x);

gy := Trunc((web.EventClientY - rect_top) * rect_scale_y);

end;

procedure HandlePointerDown(id: Integer);

var gx, gy: Integer;

begin

RefreshRect;

EventToGrid(gx, gy);

if InBounds(gx, gy) then

begin

StampBrush(gx, gy, CurrentTool, BrushRadius);

LastGX := gx; LastGY := gy;

HasLastG := True; MouseDown := True;

end;

RenderFrame;

end;

procedure HandlePointerMove(id: Integer);

var gx, gy: Integer;

begin

if not MouseDown then Exit;

EventToGrid(gx, gy);

if InBounds(gx, gy) then

begin

if HasLastG then

StampLine(LastGX, LastGY, gx, gy, CurrentTool, BrushRadius)

else

StampBrush(gx, gy, CurrentTool, BrushRadius);

LastGX := gx; LastGY := gy; HasLastG := True;

end

else

HasLastG := False;

RenderFrame;

end;

procedure HandlePointerUp(id: Integer);

begin

MouseDown := False;

HasLastG := False;

end;

procedure HandleTick(id: Integer);

begin

if id < 0 then Exit;

if SimRunning then StepSandbox;

RenderFrame;

end;

{ ---------- főprogram ---------- }

begin

ClearGrid;

StampLine(0, GRID_H - 2, GRID_W - 1, GRID_H - 2, ctWall, 2);

StampLine(0, 0, 0, GRID_H - 1, ctWall, 1);

StampLine(GRID_W - 1, 0, GRID_W - 1, GRID_H - 1, ctWall, 1);

web := TWeb.Create;

web.AddStyle(

'.sandbox{padding:10px;background:#0d1017;color:#cdd7ea;font-family:monospace}' +

'.sandbox button{margin:2px;padding:6px 12px;background:#1b2436;color:#cdd7ea;' +

'border:1px solid #2b3446;border-radius:3px;cursor:pointer;font-size:13px}' +

'.sandbox button:hover{background:#2b3446;border-color:#3b6fd6}' +

'.sandbox .status{font-size:12px;color:#9c9;margin-top:8px}' +

'#stage canvas{width:400px;height:400px;border:1px solid #555;image-rendering:pixelated;cursor:crosshair;display:block;margin-top:8px}'

);

stage_h := web.GetElementById('stage');

if stage_h <= 0 then

begin

web.Log('stage not found');

Exit;

end;

panel_h := web.CreateElement('div');

web.SetClassName(panel_h, 'sandbox');

web.AppendChild(stage_h, panel_h);

cv_h := web.MakeCanvas(panel_h, GRID_W, GRID_H);

if cv_h <= 0 then

begin

web.Log('MakeCanvas failed');

Exit;

end;

btn_erase := web.CreateElement('button');

web.AppendChild(panel_h, btn_erase);

web.SetInnerText(btn_erase, 'Erase');

web.On(btn_erase, 'click', ClickErase);

btn_wall := web.CreateElement('button');

web.AppendChild(panel_h, btn_wall);

web.SetInnerText(btn_wall, 'Wall');

web.On(btn_wall, 'click', ClickWall);

btn_sand := web.CreateElement('button');

web.AppendChild(panel_h, btn_sand);

web.SetInnerText(btn_sand, 'Sand');

web.On(btn_sand, 'click', ClickSand);

btn_water := web.CreateElement('button');

web.AppendChild(panel_h, btn_water);

web.SetInnerText(btn_water, 'Water');

web.On(btn_water, 'click', ClickWater);

btn_torch := web.CreateElement('button');

web.AppendChild(panel_h, btn_torch);

web.SetInnerText(btn_torch, 'Torch');

web.On(btn_torch, 'click', ClickTorch);

btn_fire := web.CreateElement('button');

web.AppendChild(panel_h, btn_fire);

web.SetInnerText(btn_fire, 'Fire');

web.On(btn_fire, 'click', ClickFire);

btn_smoke := web.CreateElement('button');

web.AppendChild(panel_h, btn_smoke);

web.SetInnerText(btn_smoke, 'Smoke');

web.On(btn_smoke, 'click', ClickSmoke);

status_h := web.CreateElement('div');

web.SetClassName(status_h, 'status');

web.AppendChild(panel_h, status_h);

web.SetInnerText(status_h, 'Tool: Sand');

web.On(cv_h, 'pointerdown', HandlePointerDown);

web.On(cv_h, 'pointermove', HandlePointerMove);

web.On(cv_h, 'pointerup', HandlePointerUp);

web.On(cv_h, 'pointerleave', HandlePointerUp);

RenderFrame;

web.OnTick(HandleTick);

web.Log('sandbox: ready');

end.


r/pascal • • 2d ago

Finally got WebGL working in WasmPascal

Post image
23 Upvotes

Ok this took a while, but I think I have it working. I've been trying to get WebGL integration working for my WasmPascal project for a while now, but it required a lot of compiler updates and changes in the background. Plus work interfered a bit, but I think I've made progress. There's some bugs and memory issues in edge cases, but in general, WebGL is now useable.

I've pasted the source code to create the above in WasmPascal 1.1.9. I still need to update the CLI compiler but that's on the task list. I don't think anyone is actually using it, apart from me, but that's to be expected!

Anyway, the code. I have a WEB and WEBGL unit that the environment provides which gives you all the goodies required.

library webgl_basic;

// A minimal batched WebGL2 demo for WasmPascal: the classic rotating RGB

// vertex colored triangle. Clear, bind, uniform, and draw travel to

// JavaScript as one command buffer via TGLCmdBuf.Flush per frame.

uses WEB, WEBGL;

const

STYLE_CSS =

'.gl_wrap{position:relative;width:100%;max-width:720px;min-height:240px;aspect-ratio:4/3;margin:0 auto;border:1px solid #1b2436;border-radius:8px;overflow:hidden;background:#0d1017}' +

'.gl_wrap canvas{width:100%;height:100%;display:block;outline:none}' +

'.gl_hud{position:absolute;left:10px;top:10px;padding:4px 8px;border-radius:4px;background:rgba(10,14,23,0.78);color:#cdd7ea;font:12px monospace;pointer-events:none}';

var

web: TWeb;

gl: TGLContext;

cmd: TGLCmdBuf;

canvasH, wrapH, hudH: Integer;

prog, vao, vbo, uAngle: Integer;

curW, curH: Integer;

startMs: Double;

vertices: array[0..14] of Single;

function VertShaderSrc: string;

begin

VertShaderSrc :=

'#version 300 es'#10 +

'layout(location = 0) in vec2 aPos;'#10 +

'layout(location = 1) in vec3 aColor;'#10 +

'uniform float uAngle;'#10 +

'out vec3 vColor;'#10 +

'void main() {'#10 +

' float c = cos(uAngle);'#10 +

' float s = sin(uAngle);'#10 +

' vec2 p = vec2(aPos.x * c - aPos.y * s, aPos.x * s + aPos.y * c);'#10 +

' gl_Position = vec4(p, 0.0, 1.0);'#10 +

' vColor = aColor;'#10 +

'}'#10;

end;

function FragShaderSrc: string;

begin

FragShaderSrc :=

'#version 300 es'#10 +

'precision highp float;'#10 +

'in vec3 vColor;'#10 +

'out vec4 outColor;'#10 +

'void main() {'#10 +

' outColor = vec4(vColor, 1.0);'#10 +

'}'#10;

end;

procedure InitVertices;

begin

// Top vertex (red)

vertices[0] := 0.0; vertices[1] := 0.65;

vertices[2] := 1.0; vertices[3] := 0.0; vertices[4] := 0.0;

// Bottom left vertex (green)

vertices[5] := -0.65; vertices[6] := -0.45;

vertices[7] := 0.0; vertices[8] := 1.0; vertices[9] := 0.0;

// Bottom right vertex (blue)

vertices[10] := 0.65; vertices[11] := -0.45;

vertices[12] := 0.0; vertices[13] := 0.0; vertices[14] := 1.0;

end;

procedure Tick(id: Integer);

var

nw, nh: Integer;

angle: Single;

begin

if id < 0 then Exit;

if web.CanvasResizeToDisplaySize(canvasH, nw, nh) then

begin

if nw > 0 then curW := nw;

if nh > 0 then curH := nh;

end;

if (curW <= 0) or (curH <= 0) then Exit;

angle := (web.NowMs - startMs) * 0.001;

cmd.Reset;

cmd.Viewport(0, 0, curW, curH);

cmd.ClearColor(0.05, 0.06, 0.09, 1.0);

cmd.Clear(GL_COLOR_BUFFER_BIT);

cmd.UseProgram(prog);

cmd.BindVertexArray(vao);

cmd.Uniform1f(uAngle, angle);

cmd.DrawArrays(GL_TRIANGLES, 0, 3);

cmd.Flush(gl);

end;

var

stageH: Integer;

begin

web := TWeb.Create;

web.AddStyle(STYLE_CSS);

stageH := web.GetElementById('stage');

wrapH := web.CreateElement('div');

web.SetClassName(wrapH, 'gl_wrap');

web.AppendChild(stageH, wrapH);

curW := 640;

curH := 480;

canvasH := web.CanvasCreate(wrapH, curW, curH);

hudH := web.CreateElement('div');

web.SetClassName(hudH, 'gl_hud');

web.SetInnerText(hudH, 'WebGL2 Rotating Triangle (1 batched flush/frame)');

web.AppendChild(wrapH, hudH);

gl := TGLContext.Create(canvasH, GL_OPT_DEFAULT);

if not gl.IsValid then

begin

web.SetInnerText(hudH, 'WebGL2 is not available in this browser.');

Exit;

end;

cmd := TGLCmdBuf.Create(4096);

prog := gl.CompileProgram(VertShaderSrc, FragShaderSrc);

if prog = 0 then

begin

web.SetInnerText(hudH, 'Shader error: ' + gl.LastError);

web.Log(gl.LastError);

Exit;

end;

vao := gl.AllocVertexArray;

vbo := gl.AllocBuffer;

uAngle := gl.AllocUniform;

InitVertices;

cmd.CreateVertexArray(vao);

cmd.BindVertexArray(vao);

cmd.CreateBuffer(vbo);

cmd.BindBuffer(GL_ARRAY_BUFFER, vbo);

cmd.BufferDataFloats(GL_ARRAY_BUFFER, u/vertices[0], 15, GL_STATIC_DRAW);

cmd.EnableVertexAttribArray(0);

cmd.VertexAttribPointer(0, 2, GL_FLOAT, False, 5 * 4, 0);

cmd.EnableVertexAttribArray(1);

cmd.VertexAttribPointer(1, 3, GL_FLOAT, False, 5 * 4, 2 * 4);

cmd.CacheUniformLocation(uAngle, prog, 'uAngle');

cmd.Flush(gl);

web.CanvasResizeToDisplaySize(canvasH, curW, curH);

if curW <= 0 then curW := 640;

if curH <= 0 then curH := 480;

startMs := web.NowMs;

web.OnTick(Tick);

end.


r/pascal • • 4d ago

PlayOnTV

13 Upvotes

A lightweight, native 10-foot TV launcher for Windows and Linux, designed for living-room navigation with TV remotes, gamepads, and keyboards.

https://github.com/nightranger73/PlayOnTV

if paired with antimicrox it will launch PWA with a gamepad profile to emulate mouse and open the virtual keyboard for input


r/pascal • • 4d ago

🎉 BlaiseUI v0.1.0 is out: a cross-platform GUI toolkit for Blaise - macOS, Linux, FreeBSD and Windows

Thumbnail
github.com
32 Upvotes

I hope you enjoy! As always... Built with ❤ for the Pascal community.


r/pascal • • 4d ago

🎉 Hexagram v0.1.0: a first preview of the Blaise IDE

Thumbnail
github.com
17 Upvotes

You can't have a compiler and cross-platform GUI toolkit without and IDE right (yes, I'm looking at you Embarcadero 😉). Happy coding, and looking forward to your feedback.

As always... Built with ❤ for the open-source Pascal community.


r/pascal • • 5d ago

Needed a few bug fixes, but I got it working

11 Upvotes

Ok so it turns out my memory fill code had some, errr, challenges. But I eventually figured it out and got this working without insane For X, For Y loops being needed to clear buffers. The framerate went from meh to pretty acceptable. Code at https://github.com/ewaldhorn/wasmpascal_examples/tree/main/demoscene/copperbars - I think anyone who played with this kind of thing in the 1980's and 1990's will recognise pretty much all of this.


r/pascal • • 6d ago

🎉 PasBuild v1.11.0 is out — now written in Blaise, and it knows your compiler · graemeg PasBuild · Discussion #39

Thumbnail
github.com
27 Upvotes

r/pascal • • 6d ago

Simplified things a bit

Post image
21 Upvotes

I've been busy with work, but I did find some time to simplify a few things in WasmPascal. The above was generated using this code:

library colour_canvas;

uses WEB;

const

W = 320;

H = 200;

PIXEL_BUFFER_SIZE = W * H * 4;

STYLE_CANVAS = '#stage canvas{border:1px solid #FF3030;cursor:crosshair;image-rendering:pixelated}';

var

web: TWeb;

pixels: array[0..PIXEL_BUFFER_SIZE - 1] of Byte;

procedure FillPixels;

var

i, x, y: Integer;

begin

i := 0;

for y := 0 to H - 1 do

begin

for x := 0 to W - 1 do

begin

pixels[i] := Byte(x * 255 div W); // R: left to right

pixels[i + 1] := Byte(y * 255 div H); // G: top to bottom

pixels[i + 2] := 48;

pixels[i + 3] := 255; // opaque

i := i + 4;

end;

end;

web.RenderCanvas(Integer(@pixels), PIXEL_BUFFER_SIZE);

end;

procedure HandleTick(id: Integer);

begin

begin

FillPixels;

end;

end;

begin

web := TWeb.Create;

web.AddStyle(STYLE_CANVAS);

web.MakeCanvas(web.GetElementById('stage'), W, H);

web.OnTick(HandleTick);

end.

And that's it. Comments removed to show how short it is. Full code at https://github.com/ewaldhorn/wasmpascal_examples/blob/main/demoscene/colour_canvas/colour_canvas.pas of course.


r/pascal • • 6d ago

is envy a good thing?

Thumbnail
reddit.com
1 Upvotes

i feel envy, they got a good new start


r/pascal • • 6d ago

🎉 Blaise v0.16.0 is out — hello, Windows (and a debugger in the box)! · graemeg blaise · Discussion #271

Thumbnail
github.com
21 Upvotes

Hi everyone,

I'm delighted to announce Blaise v0.16.0. Two big things this time: Windows x86-64 is now a shipped target, and every macOS, Linux and FreeBSD archive now includes the pdr debugger, so you can step through a Blaise program straight after unpacking.

Here's what the last 396 commits brought...


r/pascal • • 9d ago

WallCycle, a Wallpaper changer for Plasma, Gnome, Xfce, Niri, Umbriel, Hyperland and Windows

Thumbnail
github.com
9 Upvotes

r/pascal • • 11d ago

VertexArt - VideoDownloader demo

12 Upvotes

I have completed a video downloader program. It handles downloads that encounter errors, ensuring the final result is a successful download. When downloading an entire playlist, the program automatically creates a folder named after the playlist and places the corresponding videos or audio files inside. This tool is particularly useful for educational, testing, or demonstration videos—it makes it much easier to access your preferred learning materials once they have been downloaded.

Pure Free Pascal 3.2.2
DOD
Windows x64
Custom MiniGUI
yt-dlp integration
Playlist batch processing
Automatic playlist folder creation
Download error handling
MP4 video and MP3 formats
FFmpeg integration in progress


r/pascal • • 13d ago

Cross-platform CLAP Oscilloscope Plugin

23 Upvotes

A lightweight, GPU-rendered audio analysis plugin. Works in any DAW that supports CLAP.

I shared an earlier version here recently: https://www.reddit.com/r/pascal/comments/1vhsbkd/oscilloscope_clap_plugin/

Since then, I've made a ton of improvements and added support for macOS and Linux.

Download / Source Code:

https://sakhnovkrg.github.io/lzScope/


r/pascal • • 13d ago

FreePascalOS: An experimental 64-bit OS written in Free Pascal.

Thumbnail
github.com
82 Upvotes

r/pascal • • 13d ago

SVG loading (rendering, conversion) in Castle Game Engine thanks to FPC 3.3.1

Thumbnail
castle-engine.io
12 Upvotes

r/pascal • • 14d ago

Does the knowledge of Pascal help to understand C better?

27 Upvotes

People who know both Pascal and C, can you recommend to learn Pascal before C or it is unnecessary today?


r/pascal • • 14d ago

kbmMemTable 8.25.00 for Delphi and MPC adds full-text search, faster indexed queries, SQL transactions and journal recovery

Thumbnail
reddit.com
6 Upvotes