17 December 2022

Pride Flag coded in qb64



 

06 November 2022

Snake Game (qb64)

Snake Game coded in QB64 (needs some refinements).

Sourcecode can be viewed / downloaded here.  

26 October 2022

HD Pentagram ;)

Pentagram - as a 64-bit scalable vector

Following on from the "Pentagram - as an 8-bit scalable vector" post. This updated version works in a similar way but as a 64-bit executable (.EXE) that runs on an actual PC this time ๐Ÿ˜‰

Written in QB64 and with more precise measurements, the vectors are stored in an array and the LINE command is used (as opposed to DRAW in Sinclair BASIC).

Given the massively increased processing speed and memory available since the previous 8-bit program, this allows for a lot more experimentation with loops and colour to create intricate patterns.

The main code that draws the pentagram is relatively short (less than 20 lines of code), when excluding the declaration and initialisation of variables and other additional functions / debug code.

The pentagrams on the screen shown (right) is created with the below code. The listing shows the main program and subroutine that draws the pentagram (I have omitted the additional debug code). 

The highlighted code below at line 32 to 41 does the heavy lifting. 


Below is the output showing some debug info (click to enlarge). 


05 October 2022

Pentagram - as a scalable vector - QB64 (PC 64-bit)

A reimagined version of my original 8-bit BASIC code for the ZX Spectrum, but this time written in QB64 and compiled (.EXE) to run on a 64-bit processor.

10 August 2022

Pentagram - as an 8-bit scalable vector (again)

Just recently revisited my previous attempt at creating a scalable vector graphic of an inverted pentagram on a ZX Spectrum (Fuse Emulator) as I  since made a QB64 HD version - you know, one that runs on regular computers :) Porting the original code to QB64 wasn't too straightforward as the way lines are drawn in each language is fundamentally different. Anyway, I still like the original code and learned a lot from it. See the original post here

x and y represent the centre of the cricle, the first starting point, i.e., the bottom point of the pentagram can be stated as x, y-r, this is the first point to be PLOTted. Each subsequent move along the x axis (minus for left, plus for right) and y axis (minus for down, plus for up) can be measured and then shown by its relationship to the length of the radius (i.e., the number it is either multiplied or divided by to be the same as the radius). This will result in scaling the lateral and vertical DRAW x,y points along with the radius.

If we take the radius to be 50px, then the first movement is 29px left and 90px up. Therefore;

-29/r => -29/50 = -0.58 => -0.58r
90/r => 90/50 = 0.555' => r/0.555'

So the first DRAWn x, y co-ordinates are;  -0.58r, r/0.555' ... The same method is then repeated a further four times to draw the line for each side of the pentagram. 



This results in the following set of vectors and can be implemented in BASIC with the code below (written for ZX Spectrum 128k on Fuse emulator);

x, y-r
-0.58r, r/0.555'
1.53r, -1.08/r
-1.88r, 0
1.53r, 1.08r
-0.58r, -(r/0.555')

Changing the x, y starting position and/or the radius (r) will redraw the pentagram according to the new values. To do this, each point on the pentagram, and hence each line can be represented as vectors.

04 June 2022

Amplexati Sunt Tenebrae - Calligraphy

Amplexati sunt Tenebrae - Gothic, Textualis Quadrata script with white ink on black parchment paper.


17 May 2022

Whiskey time ;)

Shop online at Black Serpent Clothing