Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Dx8 Base Help


Iscn
 Share

Recommended Posts

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 Explicit

Public Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)

Public Declare Function GetTickCount Lib "kernel32" () As Long

Public DX8 As clsDX8

Public verProcess As Long

Public inGame As Boolean

' Store texture pointers in an array

Public splashScreenGraphic(1 To 2) As Long

Public GameFPS As Long

Public 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

inGameAction

End Sub

Public 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 Sub

Public Sub inGameAction()

Dim TickFPS As Long

Dim FPS As Long

Dim 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

Loop

End Sub

```
Link to comment
Share on other sites

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...