March 08, 2021, 03:07:51 PM
Welcome,
Guest
. Please
login
or
register
.
Did you miss your
activation email
?
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
Home
Forum
Help
Search
Gallery
Login
Register
SyntaxBomb - Indie Coders
»
Languages & Coding
»
Blitz Code Archives
»
BlitzPlus Gui
»
[bb] B3D and B+ by Xenon [ 1+ years ago ]
« previous
next »
Print
Pages: [
1
]
Go Down
Author
Topic: [bb] B3D and B+ by Xenon [ 1+ years ago ] (Read 650 times)
BlitzBot
Jr. Member
Posts: 1
[bb] B3D and B+ by Xenon [ 1+ years ago ]
«
on:
June 29, 2017, 12:28:42 AM »
Title :
B3D and B+
Author :
Xenon
Posted :
1+ years ago
Description :
With this Source, you can code a Program, which uses B3D and B+!
Just try it out!
Code :
Code: BlitzBasic
#------ Userlib *.decls
.lib
"User32.dll"
FindWindow%
(
class$, fenster$
)
:
"FindWindowA"
SetWindowRgn%
(
hwnd,hrgn,redraw
)
GetActiveWindow%
(
)
SetParent%
(
hWndChild,hWndNewParent
)
SetWindowPos%
(
hWnd, hWndINsertAfter,x,y,cx,cy,flags
)
.lib
"Gdi32.dll"
CreateRectRgn%
(
left
,top,
right
,bottom
)
#------ Blitz Plus Source
;
; Constants
;
Const
windowwidth =
116
Const
windowheight =
200
Const
windowtitle$ =
"Modeller"
Const
dummy_m =
1
Const
beenden_m =
19
;
; Globals
;
Global
window = CreateWindow
(
windowtitle$,
(
ClientWidth
(
Desktop
(
)
)
-windowwidth
)
/
2
,
(
ClientHeight
(
Desktop
(
)
)
-windowheight
)
/
2
,windowwidth,windowheight,Desktop
(
)
,
1
)
Global
menu = WindowMenu
(
window
)
Global
datei_m = CreateMenu
(
"&Datei"
,dummy_m,menu
)
Global
beenden__m = CreateMenu
(
"&Beenden Alt+F4"
,beenden_m,datei_m
)
Global
button = CreateButton
(
"Farbe"
,
5
,
130
,
100
,
30
,window
)
;
; Fuctions
;
Function
resize
(
hwnd,xwd,yhg
)
i=
1
j=
1
Repeat
i=i+
1
SetGadgetShape hwnd,
0
,
0
,i,j
Until
ClientWidth
(
hwnd
)
= xwd
Repeat
j=j+
1
SetGadgetShape hwnd,
0
,
0
,i,j
Until
ClientHeight
(
hwnd
)
= yhg
Notify GadgetWidth
(
hwnd
)
+
" x "
+GadgetHeight
(
hwnd
)
End Function
Function
writemessage
(
name,id,evdata,source,x,y
)
Repeat
Until
FileType
(
"comunicate.tmp"
)
=
0
file =
WriteFile
(
"comunicate.tmp"
)
WriteInt
file,name
WriteInt
file,id
WriteInt
file,evdata
WriteInt
file,source
WriteInt
file,x
WriteInt
file,y
CloseFile
file
End Function
;
; Startup
;
UpdateWindowMenu window
MainHwnd = GetActiveWindow
(
)
ExecFile
(
"Viewport.exe"
)
tmp=
MilliSecs
(
)
Repeat
Until
MilliSecs
(
)
-tmp >
500
Repeat
vwprt = FindWindow
(
"Blitz Runtime Class"
,
"Viewport"
)
If
WaitEvent
(
)
= $803
Then
End
Until
vwprt <>
0
SetParent
(
vwprt,mainhwnd
)
SetWindowPos
(
vwprt,
0
,
2
,-
25
,ClientWidth
(
window
)
,ClientHeight
(
window
)
-
20
,
0
)
ActivateWindow window
SetGadgetLayout button,
1
,
0
,
1
,
0
;
; Mainloop
;
Repeat
event = WaitEvent
(
)
Select
event
Case
$401
Select
EventSource
(
)
Case
button
RequestColor
(
255
,
255
,
255
)
writemessage
(
event,EventID
(
)
,RequestedRed
(
)
,
1
,RequestedGreen
(
)
,RequestedBlue
(
)
)
; Case
; writemessage(event,EventID(),EventData(),EventSource(),EventX(),EventY())
End Select
Case
$803
Select
EventSource
(
)
Case
window
writemessage
(
event,EventID
(
)
,EventData
(
)
,EventSource
(
)
,EventX
(
)
,EventY
(
)
)
End
End Select
Case
$1001
Select
EventData
(
)
Case
beenden_m
writemessage
(
$803,
0
,
0
,
0
,
0
,
0
)
End
End Select
End Select
Forever
#------ Blitz 3D Source
;
; Constants
;
Const
screenwidth =
160
Const
screenheight =
120
Const
colormode =
32
Graphics3D
screenwidth,screenheight,colormode,
2
AppTitle
(
"Viewport"
)
SetBuffer
BackBuffer
(
)
;
; Globals
;
; GUI
Global
eventname
Global
eventid
Global
eventdata
Global
eventsource
Global
eventx
Global
eventy
; 3D
Global
camera =
CreateCamera
(
)
Global
light =
CreateLight
(
)
Global
cube=
CreateCube
(
)
;
; Startup
;
CameraViewport
camera,
0
,
0
,
100
,
100
PositionEntity
light,-
3
,
0
,
3
PositionEntity
camera,-
3
,
5
,-
1
ScaleEntity
cube,
2
,
2
,
2
PointEntity
camera,cube
hwnd = GetActiveWindow
(
)
result = CreateRectRgn
(
3
,
30
,
103
,
130
)
SetWindowRgn
(
hwnd,result,
1
)
;
; Mainloop
;
Repeat
file =
ReadFile
(
"comunicate.tmp"
)
If
file <>
0
Then
eventname =
ReadInt
(
file
)
eventid =
ReadInt
(
file
)
eventdata =
ReadInt
(
file
)
eventsource =
ReadInt
(
file
)
eventx =
ReadInt
(
file
)
eventy =
ReadInt
(
file
)
CloseFile
(
file
)
DeleteFile
"comunicate.tmp"
Select
eventname
Case
$401
Select
eventsource
Case
1
EntityColor
cube,eventdata,eventx,eventy
End Select
End Select
End If
TurnEntity
cube,
0.2
,
1
,
2
UpdateWorld
RenderWorld
Flip
Until
FindWindow
(
"BlitzMax_Window_Class"
,
"Modeller"
)
=
0
End
Comments :
Phoenix(Posted 1+ years ago)
How do you use it? I put it in b+ and it says "Function Graphics3d not found"...
mv333(Posted 1+ years ago)
Phoenix, you need to remove the blitz3d part of the code, which is the bottom part, after "#------ Blitz 3D Source".
Logged
Print
Pages: [
1
]
Go Up
« previous
next »
SyntaxBomb - Indie Coders
»
Languages & Coding
»
Blitz Code Archives
»
BlitzPlus Gui
»
[bb] B3D and B+ by Xenon [ 1+ years ago ]
SimplePortal 2.3.6 © 2008-2014, SimplePortal