As dayjob the intracacies of C#/ASP.NET is the way to pay my bills but am a n00b to BlitzMax.
After having looked at the excellent http://www.blitzbasic.com/Community/posts.php?topic=42519 [a href="http://www.blitzbasic.com/Community/posts.php?topic=42519]Beginners tutorial[/a] by wave i got a good idea that Blitzmax is capable at OOP possibilities. Though some things BlitzMax vs C# doesnt make sense to me yet.
Though, its unclear to me if;
1. BlitzMax have support for properties inside its Type?
2. Can have Constructors in Type?
3. Function overloading, such as clsEnemy.Create(posX) and clsEnemy.Create(posX) not possible?
A example of what i can do in C#, but no idea how in BlitzMax is the following example:
1. Create a class clsMain
2. create class clsEnemy.
3. Instantiate a enemy in clsMain.
4. Set a property such as <enemyobject>.PosX+=1;
5. then in a clsMain loop, waiting for keypress ESC, I do
<enemyobject>.Update();
5.1 Inside of <enemyobject>.Update() i read the property of PosX then do a Drawxxxxx position update.
I cant get to figure out how to do (4) then use (5.1) as it seems the property PosX is incasseble inside clsEnemy.Update().
See here below:
* a C# code example
* a BlitzMax implementation of the code, but Blitzmax dont work, or i dont know what i do wrong?
This is the code which i would make for c#, it is more or less the same as per the Wave' tutorial, but this is in C#, provided here for refrence clarfication.
I'd really appreciate it if someone can look at my code, and point me out the difference between C# and BlitzMax?
TIA!
After having looked at the excellent http://www.blitzbasic.com/Community/posts.php?topic=42519 [a href="http://www.blitzbasic.com/Community/posts.php?topic=42519]Beginners tutorial[/a] by wave i got a good idea that Blitzmax is capable at OOP possibilities. Though some things BlitzMax vs C# doesnt make sense to me yet.
Though, its unclear to me if;
1. BlitzMax have support for properties inside its Type?
2. Can have Constructors in Type?
3. Function overloading, such as clsEnemy.Create(posX) and clsEnemy.Create(posX) not possible?
A example of what i can do in C#, but no idea how in BlitzMax is the following example:
1. Create a class clsMain
2. create class clsEnemy.
3. Instantiate a enemy in clsMain.
4. Set a property such as <enemyobject>.PosX+=1;
5. then in a clsMain loop, waiting for keypress ESC, I do
<enemyobject>.Update();
5.1 Inside of <enemyobject>.Update() i read the property of PosX then do a Drawxxxxx position update.
I cant get to figure out how to do (4) then use (5.1) as it seems the property PosX is incasseble inside clsEnemy.Update().
See here below:
* a C# code example
* a BlitzMax implementation of the code, but Blitzmax dont work, or i dont know what i do wrong?
This is the code which i would make for c#, it is more or less the same as per the Wave' tutorial, but this is in C#, provided here for refrence clarfication.
I'd really appreciate it if someone can look at my code, and point me out the difference between C# and BlitzMax?
// ----------------------------------------------------------------- //'---------- Start C# code fragment. using System; public class clsMain { //this is the constructor public clsMain() { } //this is the main loop; public void Main() { clsEnemy badguy1 = new clsEnemy(); for(int intLoop; intLoop < 10; intLoop++) { badguy1.posX+=1; badguy1.Update(); } } } // this is our enemy class public class clsEnemy { private int _posX; //declare a global variable to store public asccesable posX value. public clsEnemy() { _posX = 0; } public void Update() { // please note, here i use the public property, something which BlitzMax seems not to be able to do?? Console.WriteLine("I was updated to " + this.posX); } // a simple property. public int posX { get { return _posX; } set { _posX = value; } } }
// ----------------------------------------------------------------- //'Now here follows how i try to implement the above code in BlitzMax. 'This application was written with BLIde <a href="http://www.blide.org" target="_blank">http://www.blide.org</a> 'Application: 'Author: 'Description: ' Strict Local appInstance1:clsMain = New clsMain; appInstance1.Main(); Type clsMain Method Main() Local badguy1:clsEnemy = New clsEnemy; Graphics 800, 600, 0 '// this is the main loop, in the c# example i used a for-loop. While not KeyHit(KEY_ESCAPE) Cls; badguy1.posX:+1; badguy1.Update(); Flip; Wend End Method End Type Type clsEnemy Field posX:Int; '// this would be the public accessbale property as in C#?? Method Update() DrawText ("I was updated to " + Self.posX, Self.posX, 20); End Method End Type // -----------------------------------------------------------------
TIA!