BlitzPlus + Blitz3D


Attention! 👉Starting November 2024, BlitzCoder.org will now be BlitzBasic.org.

 

Tweet blitz3d blitzplus code-archives miscellaneous
BlitzCoder

Blitz3D on BlitzPlus Window

Author : Cronos

;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
;  3D Test: BlitzPlus + Blitz3D
;       by: Luis Enrique Braga Ramirez
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

-------------- decls CODE --------------
--------- Blitz3d+BlitzPluz.decls ------

.lib "User32.dll"

FindWindow%(class$, fenster$):"FindWindowA"
GetActiveWindow%()
SetParent%(hWndChild,hWndNewParent)
ShowWindow% (hwnd%, nCmdShow%): "ShowWindow"

-------------- decls CODE END --------------

-------------- BlitzPlus CODE --------------
---------- BlitzPlus_Blitz3D.EXE -----------

Global Window   = CreateWindow("BlitzPlus + Blitz3D" , 0 , 0 , 640 , 520 , Desktop()  , 1+4+8 )
Global MainHwnd = GetActiveWindow();User32.dll
SetStatusText(Window,"BlitzPlus + Blitz3D")

Global Menu  = WindowMenu( Window )
Global File  = CreateMenu( "File"  , 0 , Menu )
Global Close = CreateMenu( "Close" , 1 , File )
UpdateWindowMenu Window

ExecFile("Window3D.exe")

Repeat
        vwprt = FindWindow("Blitz Runtime Class" , "Window3D");User32.dll
        If WaitEvent() = $803 Then End
Until vwprt <> 0

SetParent(vwprt,MainHwnd);User32.dll
SetWindowPos( vwprt , 0 , -2 , -30 , 640 , 480 , 0);User32.dll
ShowWindow% (vwprt ,1) ;User32.dll

Repeat

If WaitEvent()>0 Then

  Select EventID()

         Case $803
               End
         Case $1001
              Select EventData()
              Case 1
                   End  
              End Select ;Select EventData()

  End Select ;Select EventID()

EndIf

Forever

End ;

-------------- BlitzPlus CODE END --------------

-------------- Blitz3D CODE --------------
-------------- Window3D.EXE --------------

If Windowed3D ()

 Graphics3D 640 , 480 , 16 , 2
 AppTitle("Window3D")
 hwnd = GetActiveWindow() ;User32.dll
 ShowWindow% (hwnd ,0)    ;User32.dll

 SetBuffer BackBuffer()

Else

  End

EndIf

Global camera = CreateCamera()
Global light  = CreateLight()
Global cube   = CreateCube()

CameraViewport camera,0 ,0 , 640 , 480

PositionEntity light,-3,0,3
PositionEntity camera,-3,5,-1
ScaleEntity cube,2,2,2
PointEntity camera,cube

Repeat
           TurnEntity cube,0.5,0.5,0.5

           UpdateWorld
           RenderWorld
           Flip

Until FindWindow( "BlitzMax_Window_Class" , "BlitzPlus + Blitz3D" ) = 0 ;User32.dll

End

-------------- Blitz3D CODE END --------------

PLEASE HELP ME TO IMPROVE IT!!!
ManoBrz commented:

Eu tenho um arquivo User32Dll.decls que aparentemente está "funcionando", existem semelhanças entre declarações no arquivo que citei e o texto acima, portanto eu vou pegar esse código acima feito para o blitz e apenas alterar para tornar compatível com as declarações no arquivo que tenho, deve dar certo não é?
eu tenho desta forma:

api_GetActiveWindow% () : "GetActiveWindow"
api_FindWindowEx% (hWnd1%, hWnd2%, lpsz1$, lpsz2$) : "FindWindowExA"
api_SetParent% (hWndChild%, hWndNewParent%) : "SetParent"
api_ShowWindow% (hwnd%, nCmdShow%) : "ShowWindow"

BlitzCoder commented:

Yes it is the same.

ManoBrz commented:

eu consegui fazer, mas não é o que eu esperava, o que eu queria é usar apenas o blitz3d com a janela do blitz3d redimensionável nada do blitz3dplus, mas de qualquer forma enquanto eu fazia o processo acima eu aprendi marcar minhas funções para aparecer azul no blitz para ficar destacado, então eu gostei de ter tentado pq ultimamente estou aprendendo no blitzcoder.

BlitzCoder commented:

As far as I know and based on past demos that I can recall, the idea was to put the 3D rendering in a Canvas Widget and this is available only on BlitzPlus, MaxGUI and with WinBlitz3D that I would assume uses User32.decls and the WinAPI extensions which I have recently posted. I am not sure how it completely works and have not seen it in action, but that is what I have read before. The only concern is the fullscreen part as it will be emulated or just fully maximized (without frames and borders) and not exactly fullscreen mode.

However, it works with other 3D extensions (using canvas gadget) on Blizmax so this seems to be the same process.

Reply To Topic (minimum 10 characters)

Please log in to reply