This project might be a real head-scratcher, even for those normally willing to extend the benefit of the doubt to knowledge for knowledge's sake. It seems fairly common for folks to dig out their old childhood computers these days and look at them with new eyes. Less common, however, seems to be the impulse to dig out one's old childhood programming languages.
But we wanted a change of pace, and we do what we want! So here it is. A combination of a language we haven't touched in around 20 years with our most recent interest: OpenGL 1.0.
This is not an exhaustive tutorial. Putting together basic knowledge of Visual Basic with declare() statements and knowledge of the quirks below and the information from the tutorial linked in the previous paragraph should be enough to reproduce these results if one is so inclined.
This is merely a collection of notes and observations. With that out of the way...
We said this is not a tutorial, but Visual Basic is not difficult to pick up in a hurry if you're already familiar with programming. With that in mind, and because it's not exactly a popular language, these days, here are some basics for getting started:
A not-insignificant part of this project was re-learning Visual Basic 4. This was complicated by a factor somewhat common to learning all obsolete APIs and programming languages: there are newer versions out there. Some things that will work in Visual Basic 5 or 6 will not work in Visual Basic 4. VB.net is basically a completely different language. All of these seem to be much more popular than Visual Basic 4, specifically.
Below is a list of things to keep in mind using Visual Basic 4, not just in comparison to later versions of Visual Basic, but perhaps to modern languages in general:
This means that floats converted to integers will round to the nearest *even* number. This can catch you off-guard and be especially annoying if you're trying to bit shift via dividing by 2 because...
At least not that we could figure out! If it does, then please feel free to correct us on this. In order to compensate for this, you can do something like this:
|1||Public Function ShiftRight(ByVal x As Double)|
|2||Dim Out As Integer|
|4||If 0 = x Then|
|6||ShiftRight = 0|
|7||ElseIf x Mod 2 > 0 Then|
|8||'Subtract 1 to make the number even to avoid weird VB rounding.|
|9||ShiftRight = (x - 1) / 2|
|11||ShiftRight = x / 2|
There is no New operator in Visual Basic 4.
To instantiate controls, you must drag them onto a form at design time. From there, you can create a control array by setting their index property to 0. You may then address other indexes at run time and use the Load statement (e.g. Load ChkExample(1)) to instantiate a new control in that array, which you can then move around the form by changing its Left/Top properties.
For more abstract uses, there are custom types, which are closer to structs. You can declare variables with them and pass them around ByRef or ByVal. They can also be marshaled into C function calls, where they behave as structs.