[rant] I bought Blitz Max, Max GUI and Blitz3D SDK at same time hoping to benefit from the superior programming capabilities of Max and also integrate WYSIWYG GUI with 3D graphics.
I have dissected the GUI SDK example enough to get 3D in a window, but am sorely disappointed that there is a strong bug which has STILL not been resolved in that I can't poll that window for keyboard or mouse?
Blitz kings of gaming programming my bumfluff.
I have heard that you can paste the graphics onto another panel:tgadget and poll that instead, but it was not explained how to do this, I'm going to try hard ripping the graphics to/from a bank but quite frankly I'm just getting annoyed with it.
If anyone has any ideas (not involving other languages as I don't have any and can't afford any) it would be greatly appreciated.
Here is what I've figured out so far, but it's probably all wrong anyway. [/rant]
¦¬(
Type tShape;
Field Mesh%
EndType
Type t3DGUI
Field PollWindow:tGadget, GraphicsWindow:tGadget,..
VisualDisplay:tGadget , GraphicsCanvas:tGadget,..
Camera%,..
Light%,..
Entity:TList=New TList,..
ScreenConsumption#=0.90,..
sync:tTimer
Method New()
GraphicsWindow=CreateWindow(..
"dummy window",0,0,50,50,,WINDOW_CENTER);
GraphicsCanvas=CreateCanvas(0,0,..
ClientWidth(Desktop()),ClientHeight(Desktop()),..
GraphicsWindow);
bbSetBlitz3DHWND(QueryGadget..
(GraphicsCanvas,QUERY_HWND));
bbBeginBlitz3D;
bbGraphics3D..
(GadgetWidth(Desktop()),GadgetHeight(Desktop()));
bbFlip(2); Sync=CreateTimer(25);
PollWindow=CreateWindow("McMerfus' Omniscape",0,0,..
GadgetWidth(Desktop()),GadgetHeight(Desktop()),Null,..
WINDOW_CLIENTCOORDS|WINDOW_CENTER);
SetGadgetColor(PollWindow,31,95,47);
VisualDisplay=CreateWindow("",0,0,50,50,Null);
Adjust_ScreenConsumption(ScreenConsumption);
Local shape:tShape=New tShape;
shape.mesh=bbCreateCone(4);
bbMoveEntity shape.mesh,0,0,4;
Entity.AddFirst(shape);
Camera=bbCreateCamera();
Light=bbCreateLight(LIGHT_DIRECTIONAL,Camera);
bbMoveEntity(Light,0,100,-100);
bbTurnEntity(Light,45,0,0);
ActivateGadget(VisualDisplay);
EndMethod;
Method Adjust_ScreenConsumption(NewValue#)
If NewValue<0.05 NewValue=0.05;
If NewValue>0.95 NewValue=0.95;
ScreenConsumption=NewValue;
Local width%=ClientWidth(PollWindow);
Local Height%=ClientHeight(PollWindow);
Local CamWidth%=width*ScreenConsumption;
Local CamHeight%=Height*ScreenConsumption;
Local x%=(width-camwidth)/2;
Local y%=(height-camheight)/2;
FreeGadget visualdisplay;
VisualDisplay=CreatePanel(x,y,camwidth,camheight,pollwindow,PANEL_ACTIVE);
EmitEvent(CreateEvent(AllocUserEventId(),Null,EVENT_GADGETPAINT));
EndMethod
Method Render()
SetGraphics (CanvasGraphics(GraphicsCanvas));
bbCameraViewport(Camera,0,0,ClientWidth(VisualDisplay),ClientHeight(VisualDisplay));
bbFlip; bbRenderWorld;
EndMethod
Method CopyGraphicsToVisualDisplay()
SetGadgetPixmap ( VisualDisplay,..
GrabPixmap(0,0,..
ClientWidth(VisualDisplay),..
ClientHeight(VisualDisplay)),..
PANELPIXMAP_CENTER);
EndMethod
EndType;
' HAHAHA!!!!!........
Global Gfx:t3DGUI=New t3DGUI;
Local Event:TEvent;
Local Shape:tShape;
Repeat
If PollEvent()=EVENT_WINDOWCLOSE End;
Gfx.Render;
bbText (0,0,"McMerfus' Omniscape");
Gfx.CopyGraphicsToVisualDisplay;
For Shape=EachIn Gfx.Entity
bbTurnEntity(Shape.mesh,0,3,0);
Next;
Forever;
End;
Thanx.
|