Problem with dabooda's engine
TrooperI get this error... Invalid procedure call or argument when using Engine.Render() Following the first tuorial. Anyone know whats wrong?
SionPrehabs. If the error occurs when closing a program, the reason is that the Engine-class is unloaded but the program still tries to execute a function from that class because the loop isn't ended. The trick is to make sure the loop is ended before closing the application. The following code ends the loop to get a clean unload procedure. [code] Private Sub Form_Unload(Cancel As Integer) 'If loop isn't ended If Running = True Then Cancel = 1 'Cancel the termination of the app Running = False 'End the loop at first given chance End If End Sub [/code]
SionSorry, I'll try to read the question before answering next time. I didn't read that you were trying to run the first tutorial - the error I talked about also throws an "Automation error...". But I think I know what wrong. Wait a min, better read you question again... No, actually I don't. I thought it was something, but the tested it at it wasn't that. If you still havn't figured out what is wrong (and if you havn't changed anything) then try removing the reference to the engine DLL and add all the classes from the engine source instead. This way, when you encounter the error hit "Debug" and you'll get a more specific debugging answer than error in "Engine.Render".
TrooperOkay, heres my code. What I"m trying to do is just get the image to move around the screen with the arrow keys... I"m using Visual Basic.net 2003 FYI [code] Option Explicit On Imports DaBoodaTurbo2DEngine Public Class Form1 Inherits System.Windows.Forms.Form #Region " Windows Form Designer generated code " Public Sub New() MyBase.New() 'This call is required by the Windows Form Designer. InitializeComponent() 'Add any initialization after the InitializeComponent() call End Sub 'Form overrides dispose to clean up the component list. Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) If disposing Then If Not (components Is Nothing) Then components.Dispose() End If End If MyBase.Dispose(disposing) End Sub 'Required by the Windows Form Designer Private components As System.ComponentModel.IContainer 'NOTE: The following procedure is required by the Windows Form Designer 'It can be modified using the Windows Form Designer. 'Do not modify it using the code editor. <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent() ' 'Form1 ' Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13) Me.ClientSize = New System.Drawing.Size(1016, 752) Me.Name = "Form1" Me.Text = "Form1" End Sub #End Region Dim Engine As New DBTurbo2DEngine Dim BLooping As Boolean Dim Angle As Single Dim sSize As Single Dim imgX As Integer = 400 Dim imgY As Integer = 300 Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Me.Show() System.Windows.Forms.Application.DoEvents() Engine = New DBTurbo2DEngine Engine.InitializeDisplay(Me.Handle.ToInt32, True, 800, 600, 0, 1) Engine.SetUpMapView(0, 0, 800, 600, 0) Engine.DBFPS.SetFrameRate(60) Engine.SetMaxLevel(1) 'Sets the background colors With Engine .SetBackColorBlue(0) .SetBackColorGreen(0) .SetBackColorRed(0) End With With Engine.DBTexture .SetFolder("c:\") .Add(256, "Ball", , 2) End With With Engine.DBOverlay .Add() .SetTextureReference(1, 1) .SetVisible(1, True) .QMSetGetRectangle(1, 0, 0, 256, 256) .QMSetPutRectangle(1, -123, -123, 256, 256) .SetXPosition(1, 400) .SetYPosition(1, 300) .ULSetColor(1, 255, 0, 0) .URSetColor(1, 0, 255, 0) .LLSetColor(1, 255, 255, 255) .LRSetColor(1, 0, 0, 255) End With With Engine.DBText .CreateFont("timenewroman", 16) .Add() .SetVisible(1, True) .SetText(1, "FPS - ") .QMSetPutRectangle(1, 0, 0, 100, 30) End With With Engine.DBKeyInput .Initialize(Me.Handle.ToInt32) .Add(DxVBLibA.CONST_DIKEYFLAGS.DIK_UP) .Add(DxVBLibA.CONST_DIKEYFLAGS.DIK_DOWN) .Add(DxVBLibA.CONST_DIKEYFLAGS.DIK_LEFT) .Add(DxVBLibA.CONST_DIKEYFLAGS.DIK_RIGHT) .Add(DxVBLibA.CONST_DIKEYFLAGS.DIK_ESCAPE) .SetAutoFire(1, True) .SetAutoFire(2, True) .SetAutoFire(3, True) .SetAutoFire(4, True) End With Angle = 0 : sSize = 128 : BLooping = True 'Main loop Do While BLooping = True 'Check keys With Engine 'Poll keyboard '.DBKeyInput.PollKeyBoard() 'check up If .DBKeyInput.ReturnKeyDown(1) = True Then imgX = imgX - 5 Engine.DBMath.SpriteAngleIncrementUp(1, 5) End If 'check(down) If .DBKeyInput.ReturnKeyDown(2) = True And sSize <> 2 Then imgX = imgX - 5 Engine.DBMath.SpriteAngleIncrementDown(1, 5) End If 'check(Left) If .DBKeyInput.ReturnKeyDown(3) = True Then imgY = imgY - 5 Engine.DBMath.SpriteAngleIncrementLeft(1, 5) End If 'check right If .DBKeyInput.ReturnKeyDown(4) = True Then imgY = imgY + 5 Engine.DBMath.SpriteAngleIncrementRight(1, 5) End If 'Check(escape) If .DBKeyInput.ReturnKeyDown(5) = True Then BLooping = False End If End With 'This is redundant 'System.Windows.Forms.Application.DoEvents() 'Update the FPS Text Engine.DBText.SetText(1, "FPS - " & Format(Engine.DBFPS.GetFPS, "000")) Engine.Render() Loop 'Destroy DBTurbo2DTurbo object 'UPGRADE_NOTE: Object Engine may not be destroyed until it is garbage collected. Click for more: 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="vbup1029"' End Sub Private Sub Form_Unload(ByVal Cancel As Integer) 'If loop isn't ended If BLooping = True Then Cancel = 1 'Cancel the termination of the app Engine = Nothing BLooping = False 'End the loop at first given chance End If End Sub End Class [/code]
SionEhh, the engine could work with VB .NET in theory but that is defiantly not supported and will most likely result in some very strange behaviours. The engine is coded in Visual Basic 5 and its target language platform is Visual Basic 5 and Visual Basic 6. I probably can't help you with VB .NET issues with the engine, but I've got VB .NET (the 2002 version) installed, so I'll take a look at it tomorrow. It's 10 minutes past 2 AM in Denmark, and I should probably go to bed.