Old School V – A Weird Sine Wave Scroller Made in Monkey X

This is getting to be a nightmare, this is the 5th Old School demonstration made in Monkey X. Probably the last in the series. I must have be bitten by a nostalgia bug.

In this version the lightning effect affects the font too — see the better quality video with new music:

Below is the source code:

The strange variable coefficient causes the weird sine wave effect.

In order to get the lightning effect working for the font, one must create in addition to font.png file files font_n.png and font_s.png. The Mojo2 renderer does the job from that on.

File font.png is light blue as color, font_n.png is graphically the same but white. Font_s.png is darkened version of font_n.png.

As mentioned in the first Old School post, n stands for normal, s stands for specular.

I hope you get the same nostalgic feeling from the video as I get… As always, feel free to use the source.

Old School IV – Yet Another Sine Wave Scroller made in Monkey X

Yet another sine wave scroller. Now the wave moves also — just like in the most traditional Amiga demos. 🙂

Below is the video (new version with smoother movement):

The angle for sin function is calculated from the x-coordinate again. 360 is divided by the screen width = 640 pixels, the quotient is 0.5625. The screen position (in pixels) from 0 to 640 – 1 is multiplied by this quotient which makes the sine wave to be positioned to full screen width.

That’s the idea. In the code the starting position can be negative (minus character’s width).

The variable addAngle is added to the screen position for the sin function, which makes the wave move. If the value of addAngle is negative, the wave moves to the other direction.

Below is the code:

Check the other Old School posts for more info and feel free to use this code.

Old School III – Another sine wave scroller made in Monkey X

Another sine wave scroller made in Monkey X. This one is more traditional..

In the video below the movement is a bit smoother since I used 15Hz update rate and fastened the video by 4x.

Below is the source code:


The idea behind this version is that each character is drawn with width of 1 pixel at y-coordinate that is calculated with sin from the screen x-position.

See the Font 2 PNG page for info about font.png and font.dat files.

Again, feel free to use and experiment with this code!


Old School II — Sine scroller made in Monkey X

I made today a scrolling version of the Old School Monkey X demo.

What’s new in this one is that it has sine wave text scrolling like in the good old Amiga demos in the late 80s. The font.png and font.dat are again made with my Font 2 PNG program.

See the video:

In the actuall program the movement is smooth.

This one has a very simple implementation of the sine scrolling.

The idea of the algorithm goes like this in short:

  • determine the width w of the first character to be drawn

  • draw a string that’s length in pixels is 640 + w starting from string index of the first character to be drawn

  • draw the determined string to position x (starting value of x is 0)

  • decrease x by 2 (speed)

  • when x <= w add the offset of the first character to drawn by 1 and set x = 0

These steps are repeated with checking if the end of the string is reached.

Mojo2 clips the graphics that are drawn out side the visible area.

The code presented here needs the string start and end with spaces so that always a string from chrStartOffset to chrEndOffset can be built and drawn to screen.

Not the best way to do the sine scrolling for each letter, but very simple. 🙂

Below is the Monkey X code:

Feel free to use the code.

What if BlitzMax full screen application freezes on exit

With Windows 7 BlitzMax full screen applications worked just fine on my system, but after upgrading to Windows 10 I ran into problems: The app started normally, execution of the app was ok, but sometimes when exiting the app, the application freezed. This problem is probably system related problem; on some systems this problem may not exist, but on some systems there is this problem.


It seems that the best solution for best compatibility is to let the user select between full screen and windowed mode. The problem really is Windows 10 related.

I first thought that setting the graphics driver in BlitzMax would help, but eventually the full screen apps freezed on exit… I also tried to set the the graphics driver to D3D11Max2DDriver (DirectX 11) since my system supports it, but that didn’t help either.