Small WinBlitz3D Test

Blitz3D Forums/Blitz3D Programming/Small WinBlitz3D Test

Hi

Ive Uploaded a little test to see how it functions on other peoples pc. this example is in .dll form for now, it enables gadgets directly onto blitz3d's runtime window. theres not much functionality.

Please read the readme in the .zip

download here.
http://myweb.tiscali.co.uk/blitzbasic/WinBlitz3DTest.zip

Works fine for me.

No problem here.

All good here too...

Thumbs up here. And your test is directly responsible.

Works here.

/Alienforce

Nice, but since some of us did this 2 years ago, show us some controls that are the diffucult ones: Keystrokes to Text boxes and menus.

There's a problem getting that stable. Problem was originally solve by somebody, by installing a keyboard hook, and running translate message and such from there.

Before that we had:
http://home.tiscali.dk/scheutz/blitz/bbwincon/bbwincon.zip

which was ok but not good enough really.

This might be fun too: http://home.tiscali.dk/scheutz/blitz/kidnap/kidnap.zip

thanks guys,

Peter the examples are like that of early WinBlitz3D before i stopped using .dll and coded it fully in blitz3d. using the asm custom winproc. the example will if everything works will also be ported using the same method.

i will look into the menus's and edit boxes, well ive allready been looking into edit boxes keydown messages. and like you say this is going to be a problem. but maybe using SetWindowsHook on the WH_KEYBOARD message might be possable.

in the above example's is the runtime window made a child to a main window?

kev

below is PoweBasic code, for a dll, That I *think* made Blitz proces the keystrokes, so that they came throug, and it was possible to catch them in a subclass procedure.

#Compile Dll "d:\blitz3d\userlibs\bbhook.dll"


#Include "WIN32API.INC"

Global gKBHook As Long


Function LibMain(ByVal hInstance As Long, _
                 ByVal Reason    As Long, _
                 ByVal Reserved  As Long) _
                 Export As Long

  Select Case Reason
    Case %DLL_PROCESS_ATTACH
      LibMain = 1
      Exit Function
    Case %DLL_PROCESS_DETACH
      Exit Function
    Case %DLL_THREAD_ATTACH
      Exit Function
    Case %DLL_THREAD_DETACH
'
      Exit Function
  End Select

  LibMain = 0   'failure!
End Function

Function KeyboardHookProc(ByVal code As Long,ByVal wParam As Dword ,lParam As tagmsg) As  Dword
    'Static Msg As tagMsg

    If code<0 Then
           Function= CallNextHookEx(gKBHook,code,wParam,lParam)
           Exit Function
    Else


       '    Call getMessage( lParam, %NULL, 0, 0 ) '= %FALSE 'Then
        If lParam.message=%WM_KEYDOWN Then

        TranslateMessage lParam
        DispatchMessage lParam

        End If


    End If

End Function

Function hook  Alias "hook" (bank1 As Dword) Export As Long
     MsgBox "hooked " & Str$(gKBHook)
    gKBHook=SetWindowsHookEx(%WH_GETMESSAGE,CodePtr(KeyboardHookProc),0,GetCurrentThreadID())

End Function

Function unhook  Alias "unhook" (bank1 As Dword) Export As Long
    UnhookWindowsHookEx gKBHook
    MsgBox "unhooked"
End Function


damn kev, you the man, it works great

using winblitz3d's includes menus ive put a little demo showing menus/buttons in the runtime window.



Include "WinBlitz3D_Include.bb"

Graphics3D 640,480,16,2
SetBuffer BackBuffer()

camera = CreateCamera()
light = CreateLight()

cube = CreateCube()
PositionEntity cube,0,0,5

;
blitz_runtime_window = WinBlitzGUI(SystemProperty("AppHWND"))

; create window menus
window_menu = WindowMenu(blitz_runtime_window)
menu_file = CreateMenu("File",0,window_menu)
	CreateMenu("Open",1,menu_file) : AddMenuIcon(window_menu,1,"menuBMPS/menuload.bmp",16,16)
	CreateMenu("Save",2,menu_file) : AddMenuIcon(window_menu,2,"menuBMPS/menusave.bmp",16,16)
	CreateMenu("",0,menu_file)
	
	submenu_file = CreateMenu("Recent Files ",0,menu_file) 
		CreateMenu("D:\WinBlitz3D\Example_1.bb",3,submenu_file) : AddMenuIcon(window_menu,3,"menuBMPS/menurecent.bmp",16,16)
		CreateMenu("D:\WinBlitz3D\Example_2.bb",4,submenu_file) : AddMenuIcon(window_menu,4,"menuBMPS/menurecent.bmp",16,16)
		
	CreateMenu("",0,menu_file)
	CreateMenu("Quit",5,menu_file) : AddMenuIcon(window_menu,5,"menuBMPS/menuquit.bmp",16,16)

menu_edit = CreateMenu("Edit",0,window_menu)
	CreateMenu("Cut",6,menu_edit)  : AddMenuIcon(window_menu,6,"menuBMPS/menucut.bmp",16,16)
	CreateMenu("Copy",7,menu_edit) : AddMenuIcon(window_menu,7,"menuBMPS/menucopy.bmp",16,16)
	CreateMenu("Paste",8,menu_edit) : AddMenuIcon(window_menu,8,"menuBMPS/menupaste.bmp",16,16)

menu_disable = CreateMenu("Disable Items",0,window_menu)
	CreateMenu("ITEM",9,menu_disable)
	CreateMenu("Disable Item",10,menu_disable) : AddMenuIcon(window_menu,10,"menuBMPS/menudisable.bmp",16,16)
	CreateMenu("Enable Item",11,menu_disable) : AddMenuIcon(window_menu,11,"menuBMPS/menuenable.bmp",16,16)
	DisableMenuItem(window_menu,9)

menu_check = CreateMenu("Check Items",0,window_menu)
	CreateMenu("ITEM",12,menu_check):CheckMenuItem(window_menu,12)
	CreateMenu("Check Item",13,menu_check) : AddMenuIcon(window_menu,13,"menuBMPS/menudisable.bmp",16,16)
	CreateMenu("Uncheck Item",14,menu_check) : AddMenuIcon(window_menu,14,"menuBMPS/menuenable.bmp",16,16)
			
UpdateWindowMenu(blitz_runtime_window,window_menu)

button = CreateButton("move cube",100,100,100,20,blitz_runtime_window,0)
button_quit = CreateButton("quit",100,140,100,20,blitz_runtime_window,0)


While Not KeyDown(1)

	TurnEntity cube,1,1,1
	
	UpdateWorld
	RenderWorld
	
	msg = WaitGUIEvents()
	
	If msg <> 0 Then DebugLog "Event "+Hex(msg)

	Select msg
		
		Case WM_KEYDOWN
			Text 100,50,"WM_KEYDOWN"
			
		Case WM_MOVE
			Text 100,50,"WM_MOVE"
			
		Case WM_COMMAND
		
			If lParamGUIEvents() = 0 Then ; menu selected
				menuid = LOWORD(wParamGUIEvents())
				
				Select menuid 
					
					Case 5
						EndGUI 
						End

				End Select
			EndIf
			
			Select HIWORD(wParamGUIEvents()) ; wNotifyCode
	
				Case BN_CLICKED
					gadget_selected = lParamGUIEvents()
					Select gadget_selected
						Case button
							TranslateEntity cube,0,0,1

						Case button_quit
							EndGUI 
							End
					End Select
			Default
			
					
			End Select
	Default
		Text 100,10,"NO EVENTS"
	End Select
	
	Text 200,10,"Menu Selected "+menuid
	
	FlushGUIEvents
	
	Flip
	
Wend

FreeGadget button
EndGraphics
EndGUI 
Print "bye, press any mouse button"
MouseWait
End


this functions ok here on my pc, anyone wont to give it a try.

kev

"WinBlitzGUI nor found" - and that's after downloading the latest via your link above. ???

WinBlitz3D_Include.bb needs to be in the same folder as the example. you need the WinBlitz3DTest.zip and WinBlitz3D.zip available in my sig

"available in my sig"?

When I click on your name all I see is an email address.

john, winblitz3d.zip the include files can be downloaded here http://myweb.tiscali.co.uk/blitzbasic/WinBlitz3D.zip

and you would need the .dll test available here.
http://myweb.tiscali.co.uk/blitzbasic/WinBlitz3DTest.zip

hope this helps.