Came up with this cool animation engine.

Miscellaneous Forums/General Discussion/Came up with this cool animation engine.

Well, I came up with this animation engine for Blitz 3D already, which is cool, and it involves a four-frame .PNG file, and appears to do some good. However, I am looking at porting this and converting this to VB 2005 code so I can port this into my Pocket PC. So, my question to you, is, what are some pointers to converting Blitz code into Visual Basic code? I have used VB for about 10 years (VB 2005 I've only used for a month, but VB in general since the mid-90s), and Blitz 3D, I've used for about a year now. However, this is my first time to actually convert one format to another with this type of code. I haven't even named this animation engine yet, either. I could even make a smaller frameset and do a better program. I only wish I'd develop more than a screen saver this day in age.

Just lemme find the code for this, and I'll see where to go with this.

Okay, without further ado, here's the code that I am looking at converting to VB 2005:

; Animotion.bb - This clever animation engine takes two to four frames from one .PNG file, and turns your frames into motion.

Graphics 800,600

; Handle this image from the center of the screen
AutoMidHandle True

; Load the wheel animation
objectimage = LoadAnimImage("frames.png",256,256,0,4)

; Create a variable to count the rotations of this wheel
motioncount = 0

; MAIN LOOP
While Not KeyDown(1)

; Make the screen clear
Cls

; Display the number of rotations, and tell user how to quit program
Text 0,0, "Frames:\>  " + motioncount
Text 0,12, "Press <ESC> to Quit:  "

; Draw the proper frames for the wheel images
DrawImage objectimage,400,300,motioncount Mod 4

; Increate the rotation count variable by 1
motioncount = motioncount + 1

; Wait for a delay 
Delay 100

Flip

Wend
; END OF MAIN LOOP


Sound like fairly simple code. It may involve using timers, and picture boxes, etc... However, would the physical code change that much with VB 2005 at all?

I've used vb.net maybe twice, but I do use c# on a daily basis.

You won't really have problems converting the logic over, but you may be in for a ride when it comes to System.Drawing. System.Drawing( aka gdi+ ) is terribly slow, I've cursed at it very much lately :)

Its also a bit more intricate to just draw things. In blitz, you just plot or drawimage, etc.

In system drawing, you will have to get a Graphics object, and use one of the Graphics.DrawImage() methods. Theres a number of overloads--

Be aware that gdi+ uses a transformation system, so unless thats all set up right, you may have graphics coming out at odd sizes....also make sure you dispose of your graphic objects ( graphics, pens, brushes, images ) when you are done with them. I assume vb.net has an equivalent to the using statement, which people tend to wrap graphics objects in.

all in all gdi+ is a pita compared to blitz. If you plan on doing anything serious, avoid gdi+ and use managed directx or tao.sdl / sdl.net.

*edit* actually, if you use a picture box, you may not have to go thru all that madness */edit*