D3D7Max2DDriver()

BlitzMax Forums/BlitzMax Beginners Area/D3D7Max2DDriver()

Proger(Posted 2005) [#1]
Why this code does not work?
Local driver:TD3D7Max2DDriver=D3D7Max2DDriver()
SetGraphicsDriver driver
Graphics 800, 600



FlameDuck(Posted 2005) [#2]
Because you haven't updated to the latest version. Works fine here (1.14).


Proger(Posted 2005) [#3]
hm... version 1.14. Sync mod has did today. Recompil all modules.
Code not work...
Function D3D7GraphicsDriver:TD3D7GraphicsDriver()

	Global _done
	Global _driver:TD3D7GraphicsDriver
	
	If _done Return _driver
	If DirectDrawCreateEx
		DirectDrawEnumerate enum_devices_callback,Null
'		Print "DirectDraw found "+DDDevices.Count()+" devices."
		If PrimaryDevice
			PrimaryDevice.Init
'			Print "PrimaryDevice reslist.count()="+PrimaryDevice.reslist.Count()
			If PrimaryDevice.reslist.Count()	
				 _driver=New TD3D7GraphicsDriver
			EndIf
		EndIf
	EndIf
	_done=True
	Return _driver
End Function

I think error here:
DirectDrawEnumerate enum_devices_callback,Null



tonyg(Posted 2005) [#4]
Works OK for me as well.
What error do you get?


Proger(Posted 2005) [#5]
Unhandled Exception: Attempt to acess field or method of Null object
...
Driver = null
Function enum_devices_callback(guid Ptr,desc:Byte Ptr,name:Byte Ptr,context Ptr) "win32"
	Local		device:TD3D7Device
	Local		devicedesc:Int Ptr,caps	
	
	devicedesc=Int Ptr(desc)
	caps=devicedesc[0]	
	If (caps&D3DDEVCAPS_HWRASTERIZATION)=0 Return
	device=New TD3D7Device
	device.guid=guid
	device.name=String.FromCString(name)	
	device.description=String.FromCString(desc)
	If Not primarydevice primarydevice=device
	DDDevices.AddLast device
	Return True
End Function

After this line:
If (caps&D3DDEVCAPS_HWRASTERIZATION)=0 Return

i get null in Driver...


Gabriel(Posted 2005) [#6]
Didn't you used to be Arkon, the BasicGL guy?


Proger(Posted 2005) [#7]
2Gabriel
No - he disappeared - account remained beside me. BasicGL I did not do.


Proger(Posted 2005) [#8]
After me comment line
'If (caps&D3DDEVCAPS_HWRASTERIZATION)=0 Return
Code became to work.


Proger(Posted 2005) [#9]
It's normal?? :)