Code: Select all
#Include once "fbgfx.bi"
#Include Once "crt.bi"
#Include Once "crt/math.bi"
#Include Once "math.bi"
#Include Once "crt/limits.bi"
#Include Once "gl\gl.bi"
#Include Once "gl\glu.bi"
#Include Once "gl\glext.bi"
#Include "inc/Openb3d.bi"
#Include "inc/ob3dplus.bi"
'#Define Render_OpenGL
'#Include Once "inc/2d.bi"
'this is the new sGUI with the window drawing stuff ( i patched for 2d.bi, so a bit puts are now use ALPHA instead of TRANS )
#Include Once "Inc/sGUI/sGUI/sGUI.bas"
#include once "Inc/sGUI/sGUI/Window.bas"
#include once "Inc/sGUI/sGUI/Window_CloseButton.bas"
#include once "Inc/sGUI/sGUI/SimpleToggle.bas"
Using FB
Using sGUI
Const as integer scrW = 1366, scrH = 768
ScreenControl SET_GL_2D_MODE ,OGL_2D_MANUAL_SYNC
'screencontrol SET_GL_2D_MODE ,OGL_2D_AUTO_SYNC
'screencontrol SET_GL_SCALE,1
ScreenRes scrW, scrH, 32,2,GFX_OPENGL or GFX_MULTISAMPLE or GFX_ALPHA_PRIMITIVES
Randomize timer
InitGUI()
MinimumClearance =4'fat frame
SelectBrightnessValue =30'slightly brighter when selected, try a minus sign.
Colors.AlphaValue =224'global alpha value used in sGUI
Colors.Cleaning =&H00000000 'the window clear color here set to complete 0 for transparense
' Colors.BackGround =&HF0F0F0
'
' Colors.WinFrame =&HAFAFAF
' Colors.WinTitle =&H0
' Colors.WinFrameSelected =&HF7630C
' Colors.WinTitleSelected =&HFFFFFF
' Colors.WinBackGround =Colors.BackGround
'
' Colors.GadText =&H0
' Colors.GadTextSelected =&HFFFF88
' Colors.GadBody =&HEAEAEA
' Colors.GadFrame =&HACACAC
' Colors.GadBodyGlow =&HE4F0FC
' Colors.GadFrameGlow =&H3399FF
' Colors.GadSleepGrid =&H444444
Graphics3D scrW, scrH, 32
WindowTitle("OpenB3D and sGUI demo")
'LoadProportionalFont("Ubuntu\Ubuntu-R\Ubuntu-R.bmp")
'LoadFixedFont("Ubuntu\UbuntuMono-R\UbuntuMono-R.bmp")
Dim as sGUIWindow ptr winA,winB,winC
Dim As Gadget Ptr cb
winA=AddWindow(0,10,10,400,400,"winA",WFLAG_WINDOWTYPE2 or WFLAG_DRAGABLE Or WFLAG_CLOSEABLE )
winB=AddWindow(winA,10,80,100,50,"winB",WFLAG_WINDOWTYPE2 or WFLAG_DRAGABLE)
winC=AddWindow(WinA,120,80,100,50,"winC",WFLAG_WINDOWTYPE2 or WFLAG_DRAGABLE)
ShowWindow(winA)
ShowWindow(winB)
ShowWindow(winC)
Dim as IMAGE ptr img_s,img_a,img_b,img_c
img_s=EnableUserGFX(0)'Rootwindow / Screen selbst
img_a=EnableUserGFX(winA)
img_b=EnableUserGFX(winB)
img_c=EnableUserGFX(winC)
winA->Caption="hello"
dim as Gadget ptr simpleA,toggleA,simpleB,toggleB',dragA',CloseA
simpleA=AddSimpleGadget(0,10,10,70,30,"simpleA")
simpleB=AddSimpleGadget(winA,10,10,70,30,"simpleB")
toggleA=AddToggleGadget(0,100,10,70,30,1,"toggleA")
toggleB=AddToggleGadget(winA,100,10,70,30,1,"toggleB")
GadgetOn(simpleA)
GadgetOn(simpleB)
GadgetOn(toggleA)
GadgetSleep(toggleB)'example SleepMode
'Draw stuff to the Windows
'it goes all to the RootWindow, it is first cleared by &H00000000 (full transparent black)
draw string img_s,(10,10),"RootWindow or Screen",&HFFFFFFff
circle img_a,(200,200),100,&HFFff0000,,,,f
Draw String img_b,(10,10),";)",&HFF00FF00
paint img_c,(1,1),&Hff000000
draw string img_c,(10,10),"Blaa",&Hff12FF00
Var cam=createcamera(0)
CameraViewport(cam,0,0,scrW, scrH)
CameraRange(cam,0.01,10000)
CameraClsColor(cam,16,16,32)
Var lights = CreateLight(1,cam)
LightColor(lights,128,128,255)
ambientLight(16,16,16)
positionentity lights,10,-10,-10
LightRange(lights,10000)
Var cubes0 = CreateCube(0)
positionentity(cubes0,0,0,5.5)
EntityShininess(cubes0,0.05)
Do
positionentity lights,-100,-100,-100
pointentity lights,cubes0
If multikey(SC_W) then
turnentity cubes0,-1,0,0
EndIf
If multikey(SC_S) then
turnentity cubes0,1,0,0
EndIf
If multikey(SC_A) then
turnentity cubes0,0,-1,0
EndIf
If multikey(SC_D) then
turnentity cubes0,0,1,0
EndIf
UpdateWorld
RenderWorld
MasterControlProgram 'render the new sGUI Windows
Draw String(8,24),"Hello ",&Hffffffff ' draw another stuf to the screen
Flip
'screensync
Sleep 1
loop until SCREENCLOSEBUTTON Or ( MultiKey( fb.sc_escape )) ' Or (event->EXITEVENT )'' loop until esc is pressed or x pressed
ClearWorld
End
in this case i only see the cube but nothing of the sGUI or FBGFX stuff.
if i comment RenderWorld out i get a black screen.
so i hope you can tell me what a make wrong.
if i use 2d.bi and syncscreen all is okay.