Iscn Posted October 10, 2012 Author Share Posted October 10, 2012 i have a little problem with this code.I am trying to load the pictures for my buttons from a folder but i am failling miserably.```Option ExplicitPublic Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)Public Declare Function GetTickCount Lib "kernel32" () As LongPublic DX8 As clsDX8Public verProcess As LongPublic inGame As Boolean' Store texture pointers in an arrayPublic splashScreenGraphic(1 To 2) As LongPublic GameFPS As LongPublic Sub Main()Dim verProcess_tmp As Long frmMain.Visible = True Set DX8 = New clsDX8 verProcess = -1 verProcess_tmp = 0 If verProcess = -1 Then If DX8.InitDirectX(frmMain.picScreen.hWnd, D3DCREATE_HARDWARE_VERTEXPROCESSING) = 0 Then verProcess_tmp = 1 If DX8.InitDirectX(frmMain.picScreen.hWnd, D3DCREATE_MIXED_VERTEXPROCESSING) = 0 Then verProcess_tmp = 2 If DX8.InitDirectX(frmMain.picScreen.hWnd, D3DCREATE_SOFTWARE_VERTEXPROCESSING) = 0 Then verProcess_tmp = -1 MsgBox "Couldn't start DX8 - 1!" End End If End If End If Else Select Case verProcess Case 0 If DX8.InitDirectX(frmMain.picScreen.hWnd, D3DCREATE_HARDWARE_VERTEXPROCESSING) = 0 Then verProcess_tmp = 1 If DX8.InitDirectX(frmMain.picScreen.hWnd, D3DCREATE_MIXED_VERTEXPROCESSING) = 0 Then verProcess_tmp = 2 If DX8.InitDirectX(frmMain.picScreen.hWnd, D3DCREATE_SOFTWARE_VERTEXPROCESSING) = 0 Then verProcess_tmp = -1 MsgBox "Couldn't start DX8 - 2!" End End If End If End If Case 1 verProcess_tmp = 1 If DX8.InitDirectX(frmMain.picScreen.hWnd, D3DCREATE_MIXED_VERTEXPROCESSING) = 0 Then verProcess_tmp = 0 If DX8.InitDirectX(frmMain.picScreen.hWnd, D3DCREATE_HARDWARE_VERTEXPROCESSING) = 0 Then verProcess_tmp = 2 If DX8.InitDirectX(frmMain.picScreen.hWnd, D3DCREATE_SOFTWARE_VERTEXPROCESSING) = 0 Then verProcess_tmp = -1 MsgBox "Couldn't start DX8 - 3!" End End If End If End If Case 2 verProcess_tmp = 2 If DX8.InitDirectX(frmMain.picScreen.hWnd, D3DCREATE_SOFTWARE_VERTEXPROCESSING) = 0 Then verProcess_tmp = 1 If DX8.InitDirectX(frmMain.picScreen.hWnd, D3DCREATE_MIXED_VERTEXPROCESSING) = 0 Then verProcess_tmp = 0 If DX8.InitDirectX(frmMain.picScreen.hWnd, D3DCREATE_HARDWARE_VERTEXPROCESSING) = 0 Then verProcess_tmp = -1 MsgBox "Couldn't start DX8 - 4!" End End If End If End If End Select End If loadSplashScreen inGame = True inGameActionEnd SubPublic Sub loadSplashScreen()splashScreenGraphic(1) = DX8.LoadTexture(App.path & "\bin\interface\menu\splashscreen.png")frmMain.picMain = DX8.LoadTexture(App.path & "\bin\interface\menu\main.png")frmMain.picLogIn(4) = DX8.LoadTexture(App.path & "\bin\interface\menu\buttons\login.png")frmMain.picRegister(3) = DX8.LoadTexture(App.path & "\bin\interface\menu\buttons\register.png")frmMain.picCredits(4) = DX8.LoadTexture(App.path & "\bin\interface\menu\buttons\credits.png")frmMain.picClose(0) = DX8.LoadTexture(App.path & "\bin\interface\menu\buttons\close.png")frmMain.picOptions(1) = DX8.LoadTexture(App.path & "\bin\interface\menu\buttons\options.png")End SubPublic Sub inGameAction()Dim TickFPS As LongDim FPS As LongDim tick As Long Do While inGame = True tick = GetTickCount If frmMain.Visible Then ' check if we have the form before drawing DX8.BeginScene 'Check for texture unloading DX8.UnloadTextures DX8.SetTexture splashScreenGraphic(1) Call DX8.DrawTexture(0, 0, 960, 640, 0, 0) Call DX8.DrawText(3, 3, Trim$("FPS: " & GameFPS), DX8.ARGB(255, 255, 255, 255)) DX8.EndScene End If ' Calculate fps If TickFPS < tick Then GameFPS = FPS TickFPS = tick + 1000 FPS = 0 Else FPS = FPS + 1 End If DoEvents Sleep 1 LoopEnd Sub``` Link to comment Share on other sites More sharing options...
blkcrow Posted October 11, 2012 Share Posted October 11, 2012 You are actually trying to load a direct x texture into a control? Link to comment Share on other sites More sharing options...
tslusny Posted October 11, 2012 Share Posted October 11, 2012 Really weird ![:P](http://www.touchofdeathforums.com/community/public/style_emoticons/<#EMO_DIR#>/tongue.png) Link to comment Share on other sites More sharing options...
Guest Posted October 11, 2012 Share Posted October 11, 2012 I think Blk is right. You should be drawing with GDI onto controls and drawing DX8 onto the main form, that might fix your issue. I could be very wrong though. Link to comment Share on other sites More sharing options...
Iscn Posted October 11, 2012 Author Share Posted October 11, 2012 > I think Blk is right. You should be drawing with GDI onto controls and drawing DX8 onto the main form, that might fix your issue. I could be very wrong though.Thanks i will try that Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now