Good morning... Hi Charles how I can create a simple Line by mouseclick with a Label? I have build a Procedure for IT but how to place IT and how to Transform These Data?
Nice sunday Bye Frank
PS I have changed the Code a little.
'#compact
'%filename "t.exe"
'uses RTL64
% Title "Triangle Data: Move points with mouse and arrow keys etc"
'% WindowStyle WS_OVERLAPPEDWINDOW
'% Animated
'% ScaleUp
% PlaceCentral
% AnchorCentral
'% shaders
uses consoleG
'uses glo2/geoplanar
'Keys: Esc, arrow-keys, n,m, F4
BeginScript
procedure sqbutton(float x,y)
=============================
glbegin GL_QUADS
glvertex2f 0,0
glvertex2f x,0
glvertex2f x,y
glvertex2f 0,y
glend
end procedure
'--------------- mouse click for line creation ------ //
procedure handleMouseClick(float x,y) 'z
=========================================
float xa,ya,xb,yb,xc,yc
glBegin GL_LINES
glVertex2f xa+10, ya-10 '10,-10 '
glVertex2f xb-10, yb+10 '-10, 10
'glVertex2f xc, yc
glEnd
end procedure
'--------------- mouse click for line creation ------ //
procedure main()
================
'WaitForEvent '0 off 1 on (default on)
static quad t1,t2
static float rc,gc,bc 'colors
if opening 'FIRST CALL ONLY
timemark t1
'picked=100
'mbox "helo"
'Triangle interior color
rc=0.8
gc=0.0
bc=0.8
end if
'
if closing 'FINAL CALL BEFORE SHUTDOWN
'mbox "Bye!"
exit sub
end if
cls
shading
UserMovement mu,1100,3 'symbol identity, count
if opening
mu[1].x= 0
mu[1].y= 5
mu[2].x=-5
mu[2].y=-5
mu[3].x= 5
mu[3].y=-5
endif
scale 1
picklabel 0
int i
for i=1 to 3
pushstate
color 1,.9,0,1
mu[i].act
scale 0.5
go sphere
popstate
next
picklabel 0
float xa,xb,xc,ya,yb,yc
xa=mu[1].x : ya=mu[1].y
xb=mu[2].x : yb=mu[2].y
xc=mu[3].x : yc=mu[3].y
'
select picked
'COLOR BUTTON SELECTION
case 10 : rc=0.9 : gc=0.2 : bc=0.0
case 20 : rc=0.2 : gc=0.9 : bc=0.0
case 30 : rc=0.0 : gc=0.6 : bc=0.9
case 40 : rc=0.6 : gc=0.0 : bc=0.9
case 50 : rc=0.2 : gc=0.1 : bc=0.9
'MOUSE DRAG ADJUSTMENT
case 1100 : xa+=mu[1].d.x : ya+=mu[1].d.y
case 1200 : xb+=mu[2].d.x : yb+=mu[2].d.y
case 1300 : xc+=mu[3].d.x : yc+=mu[3].d.y
end select
flat
thickness 2
'
if pick
picklabel 2000
else
color 1,1,0,1
pushstate
move xa-.5,ya-1
gprint "A"
popstate
pushstate
move xb+1,yb+1
gprint "B"
popstate
pushstate
move xc-1,yc+1
gprint "C"
popstate
endif
'
'------------- create a line a to b by mouseclick -------- //
pushstate
'if key[65] then picked=3000
'gprint "key a was pushed"
'if pick
picklabel 3000
move mu[1].x-1.5,mu[1].y-2 'xa-.5,ya-1
gprint "point X "
popstate
pushstate
move mu[2].x+2,mu[2].y+2 'xb+2,yb+2
gprint "point Y "
gprint "mouse on line A "
'move xa-.15,ya-2
handleMouseClick(mu[1].x, mu[1].y)
'move xb+2,yb+2
handleMouseClick(mu[2].x, mu[2].y)
gprint " mouse on line B"
'end if
popstate
'------------- create a line a to b by mouseclick -------- //
if not pick
color rc,gc,bc
float zp=-1.001
glBegin GL_TRIANGLES
glVertex3f xa,ya,zp
glVertex3f xb,yb,zp
glVertex3f xc,yc,zp
glEnd
'
color 0,.9,.9
glBegin GL_LINES
glVertex2f xa,ya
glVertex2f xb,yb
glVertex2f xb,yb
glVertex2f xc,yc
glVertex2f xc,yc
glVertex2f xa,ya
glEnd
endif
'-------------------------------- //
'-------------------------------- //
move 5
'if not pick
if key[49] then picked=100 'keypress '1'
if key[50] then picked=200 'keypress '2'
pushstate
move -20,12
static sys tally
timemark t2
scale 1.0
'
int dp=3
'
macro pr1(a) 'PRINTING LIST
-----------------------------
pushstate : color .5,1,1 : print a : popstate
printl ""
end macro
'
macro pr2(a,b) 'PRINTING LIST
-----------------------------
pushstate : color .5,1,1 : print a : popstate
pushstate : color 1,1,.5 : move 4 : print str(b,dp) : popstate
printl ""
end macro
'
macro pr3(a,b,c) 'PRINTING LIST
------------------------------
pushstate : color .5,1,1 : print a : popstate
pushstate : color 1,1,.5 : move 4 : print str(b,dp) : popstate
pushstate : color 1,1,.5 : move 8 : print str(c,dp) : popstate
printl ""
end macro
'
'BUTTON CONTROLS
----------------
'
pushstate
if pick
picklabel 10
else
color .80,.2,0
endif
sqbutton 2,2
move 3.0
'
if pick
picklabel 20
else
color .2,.80,0
endif
sqbutton 2,2
move 3.0
'
if pick
picklabel 30
else
color 0,.60,.90
endif
sqbutton 2,2
move 3.0
'
if pick
picklabel 40
else
color .60,0,.90
endif
sqbutton 2,2
move 3.0
'
if pick
picklabel 50
else
color .20,0,.90
endif
sqbutton 2,2
move 3.0
popstate
move 0,-3.0,0
'
'DISPLAY INFO
-------------
picklabel 0
pushstate
scale 2
color 1,1,1
print "Triangle Data"
popstate
move 0,-1.5
'pr2 "Action Code: ", act
'pr2 "indexbase ", indexbase
'pr2 "Keyboard Code: ", keyd
pr2 "Picked ID: ", picked
'
move 0,-1.5
'
pr3 "Point A: ", str(xa,3), ya
pr3 "Point B: ", str(xb,3), yb
pr3 "Point C: ", str(xc,3), yc
'
float ab,ac,bc,ar,ht,hb
'
ab=hypot(xa-xb, ya-yb)
ac=hypot(xa-xc, ya-yc)
bc=hypot(xb-xc, yb-yc)
'
hb=0.5* ( ab*ab - ac*ac + bc*bc ) / bc
ht=sqr(ab*ab-hb*hb)
ar=0.5*bc*ht
'ANGLES
float na,nb,nc
nb=deg(asin(ht/ab))
nc=deg(asin(ht/ac))
na=180-nb-nc
pr1 ""
pr2 "Angle A:",na
pr2 "Angle B:",nb
pr2 "Angle C:",nc
pr1 ""
pr2 "Line AB:",ab
pr2 "Line AC:",ac
pr2 "Line BC:",bc
pr2 "Left base:",hb
pr2 "Height:",ht
pr2 "Area:", ar
pr1 ""
'
picklabel 0
popstate
'end if
end procedure 'main
EndScript
'picklabel 2000
' pushstate
' if pick
' move 3.0
' picklabel 3000
'handleMouseClick(mu[1].x, mu[1].y) ' Handle mouse click for the first point
' popstate
' endif
Hey Charles some Help would be great Something I did wrong but what?
My Intention was to create a simple Line between x and y and Transform IT to your Data overview. I tried a new Procedure for Mousehandling (freebasic stuff) ... Must be more simpler to Code
Thanks Frank
'#compact
'%filename "t.exe"
'uses RTL64
% Title "Triangle Data: Move points with mouse and arrow keys etc"
'% WindowStyle WS_OVERLAPPEDWINDOW
'% Animated
'% ScaleUp
% PlaceCentral
% AnchorCentral
'% shaders
uses consoleG
'uses glo2/geoplanar
'Keys: Esc, arrow-keys, n,m, F4
BeginScript
procedure sqbutton(float x,y)
=============================
glbegin GL_QUADS
glvertex2f 0,0
glvertex2f x,0
glvertex2f x,y
glvertex2f 0,y
glend
end procedure
'--------------- mouse click for line creation2 ------ //
procedure handleMouseClick(float x, y)
=========================================
static float xa, ya, xb, yb
static integer clickCount
if clickCount = 0 then
xa = x
ya = y
clickCount = 1
elseif clickCount = 1 then
xb = x
yb = y
clickCount = 0
glBegin GL_LINES
glVertex2f xa, ya
glVertex2f xb, yb
glEnd
end if
end procedure
'--------------- mouse click for line creation2 ------ //
procedure main()
================
'WaitForEvent '0 off 1 on (default on)
static quad t1,t2
static float rc,gc,bc 'colors
if opening 'FIRST CALL ONLY
timemark t1
'picked=100
'mbox "helo"
'Triangle interior color
rc=0.8
gc=0.0
bc=0.8
end if
'
if closing 'FINAL CALL BEFORE SHUTDOWN
'mbox "Bye!"
exit sub
end if
cls
shading
UserMovement mu,1100,3 'symbol identity, count
if opening
mu[1].x= 0
mu[1].y= 5
mu[2].x=-5
mu[2].y=-5
mu[3].x= 5
mu[3].y=-5
endif
scale 1
picklabel 0
int i
for i=1 to 3
pushstate
color 1,.9,0,1
mu[i].act
scale 0.5
go sphere
popstate
next
picklabel 0
float xa,xb,xc,ya,yb,yc
xa=mu[1].x : ya=mu[1].y
xb=mu[2].x : yb=mu[2].y
xc=mu[3].x : yc=mu[3].y
'
select picked
'COLOR BUTTON SELECTION
case 10 : rc=0.9 : gc=0.2 : bc=0.0
case 20 : rc=0.2 : gc=0.9 : bc=0.0
case 30 : rc=0.0 : gc=0.6 : bc=0.9
case 40 : rc=0.6 : gc=0.0 : bc=0.9
case 50 : rc=0.2 : gc=0.1 : bc=0.9
'MOUSE DRAG ADJUSTMENT
case 1100 : xa+=mu[1].d.x : ya+=mu[1].d.y
case 1200 : xb+=mu[2].d.x : yb+=mu[2].d.y
case 1300 : xc+=mu[3].d.x : yc+=mu[3].d.y
end select
flat
thickness 2
'
if pick
picklabel 2000
else
color 1,1,0,1
pushstate
move xa-.5,ya-1
gprint "A"
popstate
pushstate
move xb+1,yb+1
gprint "B"
popstate
pushstate
move xc-1,yc+1
gprint "C"
popstate
endif
'
'------------- create a line x to y by mouseclick -------- //
pushstate
'if key[65] then picked=3000
'gprint "key a was pushed"
'if not pick
picklabel 3000
move 5.0
move mu[1].x-1.5,mu[1].y-2 'xa-.5,ya-1
gprint "point X "
handleMouseClick(mu[1].x, mu[1].y)
'handleMouseClick(xa, ya)
popstate
pushstate
move 5.0
'move mu[2].x+2.5,mu[2].y+3.5 'xb+2,yb+2
gprint "point Y "
handleMouseClick(mu[2].x, mu[2].y)
'handleMouseClick(xb, yb)
'gprint "mouse on line A "
'move xa-.15,ya-2
'move xb+2,yb+2
'gprint " mouse on line B"
'end if
popstate
'------------- create a line a to b by mouseclick -------- //
if not pick
color rc,gc,bc
float zp=-1.001
glBegin GL_TRIANGLES
glVertex3f xa,ya,zp
glVertex3f xb,yb,zp
glVertex3f xc,yc,zp
glEnd
'
color 0,.9,.9
glBegin GL_LINES
glVertex2f xa,ya
glVertex2f xb,yb
glVertex2f xb,yb
glVertex2f xc,yc
glVertex2f xc,yc
glVertex2f xa,ya
glEnd
endif
'-------------------------------- //
'-------------------------------- //
move 5
'if not pick
if key[49] then picked=100 'keypress '1'
if key[50] then picked=200 'keypress '2'
pushstate
move -20,12
static sys tally
timemark t2
scale 1.0
'
int dp=3
'
macro pr1(a) 'PRINTING LIST
-----------------------------
pushstate : color .5,1,1 : print a : popstate
printl ""
end macro
'
macro pr2(a,b) 'PRINTING LIST
-----------------------------
pushstate : color .5,1,1 : print a : popstate
pushstate : color 1,1,.5 : move 4 : print str(b,dp) : popstate
printl ""
end macro
'
macro pr3(a,b,c) 'PRINTING LIST
------------------------------
pushstate : color .5,1,1 : print a : popstate
pushstate : color 1,1,.5 : move 4 : print str(b,dp) : popstate
pushstate : color 1,1,.5 : move 8 : print str(c,dp) : popstate
printl ""
end macro
'
'BUTTON CONTROLS
----------------
'
pushstate
if pick
picklabel 10
else
color .80,.2,0
endif
sqbutton 2,2
move 3.0
'
if pick
picklabel 20
else
color .2,.80,0
endif
sqbutton 2,2
move 3.0
'
if pick
picklabel 30
else
color 0,.60,.90
endif
sqbutton 2,2
move 3.0
'
if pick
picklabel 40
else
color .60,0,.90
endif
sqbutton 2,2
move 3.0
'
if pick
picklabel 50
else
color .20,0,.90
endif
sqbutton 2,2
move 3.0
popstate
move 0,-3.0,0
'
'DISPLAY INFO
-------------
picklabel 0
pushstate
scale 2
color 1,1,1
print "Triangle Data"
popstate
move 0,-1.5
'pr2 "Action Code: ", act
'pr2 "indexbase ", indexbase
'pr2 "Keyboard Code: ", keyd
pr2 "Picked ID: ", picked
'
move 0,-1.5
'
pr3 "Point A: ", str(xa,3), ya
pr3 "Point B: ", str(xb,3), yb
pr3 "Point C: ", str(xc,3), yc
'
float ab,ac,bc,ar,ht,hb
'
ab=hypot(xa-xb, ya-yb)
ac=hypot(xa-xc, ya-yc)
bc=hypot(xb-xc, yb-yc)
'
hb=0.5* ( ab*ab - ac*ac + bc*bc ) / bc
ht=sqr(ab*ab-hb*hb)
ar=0.5*bc*ht
'ANGLES
float na,nb,nc
nb=deg(asin(ht/ab))
nc=deg(asin(ht/ac))
na=180-nb-nc
pr1 ""
pr2 "Angle A:",na
pr2 "Angle B:",nb
pr2 "Angle C:",nc
pr1 ""
pr2 "Line AB:",ab
pr2 "Line AC:",ac
pr2 "Line BC:",bc
pr2 "Left base:",hb
pr2 "Height:",ht
pr2 "Area:", ar
pr1 ""
'
picklabel 0
popstate
'end if
end procedure 'main
EndScript
Hi Frank,
This code demonstrates how lines can be connected to the moveable sphere points:
#compact
%filename "t.exe"
'uses RTL64
'% Title "Create Points and Lines Demo"
% Title "ConsoleG Demo: Move text with mouse and arrow keys etc"
'% WindowStyle WS_OVERLAPPEDWINDOW
'% Animated
'% ScaleUp
% PlaceCentral
% AnchorCentral
% shaders
uses consoleG
'Keys: Esc, arrow-keys, n,m, F4
BeginScript
procedure main
==============
'WaitForEvent '0 off 1 on (default on)
static quad t1,t2
if opening then 'FIRST CALL ONLY
'picked=100
'mbox "helo"
end if
'
if closing then 'FINAL CALL BEFORE SHUTDOWN
'mbox "Bye!"
exit sub
end if
cls 0,.4,0
shading
'CREATE POINTS
if opening
%n 100
static MoveableObject mu[n]
'#recordof a
scope
int i=n
int k=100
for i=1 to n
mu[i].mode=0x101
k+=100
mu[i].id=k
next
end scope
endif
scale 1
int i, j
thickness 3
for i=1 to 20
pushstate
mu[i].act 'FIXES LOCATION
if mu[i].x + mu[i].y = 0
color .9,.9,.9,1
else
color .9,.5,0,1
endif
go sphere
popstate
next
'
flat
for i=1 to 20
j=i+1
if mu[i].x + mu[i].y <> 0
if mu[j].x + mu[j].y <> 0
'DRAW LINE BETWEEN POINTS
'INCLUDE D.X D.Y MOUSE DRAG
glbegin GL_LINES
glVertex3f mu[i].x+mu[i].d.x, mu[i].y+mu[i].d.y, 0
glVertex3f mu[j].x+mu[j].d.x, mu[j].y+mu[j].d.y, 0
glend
endif
endif
next
shading
picklabel 0
move 5,0
'if not pick then
if key[49] then picked=100 'keypress '1'
if key[50] then picked=200 'kypress '2'
pushstate
move -20,12
static sys tally
timemark t2
scale 1.0
'
macro pr(a,b) 'PRINTING LIST
----------------------------
pushstate : color .5,1,1 : print a : popstate
pushstate : color 1,1,.5 : move 8 : print b : popstate
printl ""
end macro
picklabel 10
'pr "Action Code: ", str(act)
'pr "indexbase ", str(indexbase)
pr "Picked ID: ", str(picked)
pr "Keyboard Code: ", str(keyd)
picklabel 0
popstate
'end if
end procedure 'main
EndScript
Good morning and many thanks Charles... I never Had found this solution to be truly... Some Commando of consoleG I must definately Check and learn much more...
Nice day good week regards Frank
PS for a later time would be great how to save such a File Like "House" after created building :)
Hello all hi charles... Just have Made an example how to create a rectangle by Mouse drag
Start IT left down left Up right Up right down I have numbered the cubes
#compact
%filename "t.exe"
'uses RTL64
'% Title "Create Points, Lines and Quads Demo"
% Title "ConsoleG Demo: Move text with mouse and arrow keys etc"
'% WindowStyle WS_OVERLAPPEDWINDOW
'% Animated
'% ScaleUp
% PlaceCentral
% AnchorCentral
% shaders
uses consoleG
'Keys: Esc, arrow-keys, n,m, F4
BeginScript
procedure main
==============
'WaitForEvent '0 off 1 on (default on)
static quad t1,t2
static float rc,gc,bc 'colors
if opening then 'FIRST CALL ONLY
'picked=100
'mbox "hello"
end if
'
if closing then 'FINAL CALL BEFORE SHUTDOWN
'mbox "Bye!"
exit sub
end if
cls 0,.4,0
shading
'CREATE POINTS
if opening
%n 100
static MoveableObject mu[n]
'#recordof a
scope
int i=n
int k=100
for i=1 to n
mu[i].mode=0x101
k+=100
mu[i].id=k
next
end scope
endif
scale 1
int i, j
thickness 3
for i=1 to 20
pushstate
'gltranslatef -5.0,-7.0,0.0
mu[i].act 'FIXES LOCATION
if mu[i].x + mu[i].y = 0
'color .9,.9,.9,1
else
color .9,.5,0,1
endif
'gltranslatef -4.0,-7.0,0
go cube 'sphere
gprint "Id: "+i+1
popstate
next
'
int tx,sx,sy,ty
flat
for i=1 to 20
j=i+1
sx=j+1
tx=sx+1
if mu[i].x + mu[i].y <> 0
if mu[j].x + mu[j].y <> 0
if mu[sx].x + mu[sy].y <> 0
if mu[tx].x + mu[ty].y <> 0
'DRAW LINE BETWEEN POINTS
'INCLUDE D.X D.Y MOUSE DRAG
'glbegin GL_LINES
glBegin GL_QUADS
'glVertex3f mu[i].x+mu[i].d.x, mu[i].y+mu[i].d.y, 0
'glVertex3f mu[j].x+mu[j].d.x, mu[j].y+mu[j].d.y, 0
glVertex2f mu[i].x+mu[i].d.x, mu[i].y+mu[i].d.y
glVertex2f mu[j].x+mu[j].d.x, mu[j].y+mu[j].d.y
glVertex2f mu[sx].x+mu[sx].d.x, mu[sx].y+mu[sx].d.y
glVertex2f mu[tx].x+mu[tx].d.x, mu[tx].y+mu[tx].d.y
glend
endif
endif
endif
endif
next
shading
picklabel 0
move 5,0
'if not pick then
if key[49] then picked=100 'keypress '1'
if key[50] then picked=200 'kypress '2'
pushstate
move -20,12
static sys tally
timemark t2
scale 1.0
'
macro pr(a,b) 'PRINTING LIST
----------------------------
pushstate : color .5,1,1 : print a : popstate
pushstate : color 1,1,.5 : move 8 : print b : popstate
printl ""
end macro
picklabel 10
'pr "Action Code: ", str(act)
'pr "indexbase ", str(indexbase)
pr "Picked ID: ", str(picked)
pr "Keyboard Code: ", str(keyd)
picklabel 0
popstate
'end if
end procedure 'main
EndScript
Hello again... Hi charles..
Need some Help to build a Wall with a Roof in a correct Order together :) I am Not Sure with the loops and the Setup...
The Wall is OK but No Roof appears...
Here my example
PS have deleted the Code for a later updated Version
PS I found a First solution for the Roof more to come later.. all Work in Progress :)
If the "House Project" is ready I will send an updated Code
thanks regards
Good evening... Here WE are :)
Little Update of my House Project how to create a Wall plus Roof and rectangles objects beside First House... All you can find in zip folder. Plus exe file.. My AIM is to create a building Like a church or House with a Garage
You need only one drag Cube Point to left top Side to make the Roof and drag IT down to ground place then drag three more Points to make the rectangle Here Red color :)
If you have any questions please ask :) thanks
All Work in Progress
Code will come Here:
'--- testing wall + roof / cube created lines
'--- 13-17.11.2023 by frank brübach, oxygen opengl consoleG
'--- roof and house and rectangles are following here
#compact
$filename "house-demo1c.exe"
'uses RTL64
'% Title "Create Points and Lines Demo"
% Title "House Demo: Move cube with left mouse and arrow keys etc"
'% WindowStyle WS_OVERLAPPEDWINDOW
'% Animated
'% ScaleUp
% PlaceCentral
% AnchorCentral
% ExplicitMain
% shaders
uses consoleG
'Keys: Esc, arrow-keys, n,m, F4
BeginScript
procedure main
==============
'WaitForEvent '0 off 1 on (default on)
static quad t1,t2
static float rc,gc,bc 'colors
'-------------------------------------------------- //
if opening then 'FIRST CALL ONLY
'picked=100
'mbox "hello"
end if
'
'
'13-11-2023 added new ---------------------- 1) //
'
%nk 2100
static MoveableObject mu[nk]
if opening then 'FIRST CALL ONLY
' Initialize your objects here
mu[21].mode = 0x101 ' Additional point for the house
mu[21].id = 2100
mu[21].x = 0
mu[21].y = 0
end if
'------------------------------------------ 1) end
'
if closing then 'FINAL CALL BEFORE SHUTDOWN
'mbox "Bye!"
exit sub
end if
cls 0,.4,0
shading
'
'CREATE POINTS
if opening
%n 100
static MoveableObject mu[n]
'#recordof a
scope
int i=n
int k=100
for i=1 to n
mu[i].mode=0x101
k+=100
mu[i].id=k
next
end scope
endif
scale 1
int i, j
thickness 3
'-------------------------- good ------ //
gltranslatef -6.0,-8.0,0.0
for i=1 to 20
pushstate
mu[i].act 'FIXES LOCATION
if mu[i].x + mu[i].y = 0
color .9,.9,.9,1
else
color .9,.5,0,1
endif
go cube 'sphere
gprint "Id: "+i+1
popstate
next
'
'--------------------------------------- new good -- 2) //
' wall + roof : 21 22
'
for i=21 to 22
pushstate
mu[i].act ' FIXES LOCATION
if mu[i].x + mu[i].y = 0 '<> 0
color .5, .5, .5, 1 ' House color
else
color .9, .5, 0, 1 ' Cube color
endif
go cube
gprint "Id: "+i+1
popstate
next
'-------------------------------> lines are ok ---------------- //
static float sx,sy,tx,ty
'sx = j + 1
'sy = j + 2
'tx = sx + 1
'ty = tx + 1
int tx,sx,sy,ty
flat
for i=1 to 18 '1-20
j=i+1
sx=j+1
tx=sx+1
if mu[i].x + mu[i].y <> 0
if mu[j].x + mu[j].y <> 0
if mu[sx].x + mu[sy].y <> 0
if mu[tx].x + mu[ty].y <> 0
color .9, .25, 0, 1
'DRAW LINE BETWEEN POINTS
'INCLUDE D.X D.Y MOUSE DRAG
'glbegin GL_LINES
'glVertex3f mu[i].x+mu[i].d.x, mu[i].y+mu[i].d.y, 0
'glVertex3f mu[j].x+mu[j].d.x, mu[j].y+mu[j].d.y, 0
glBegin GL_QUADS
glVertex2f mu[i].x+mu[i].d.x, mu[i].y+mu[i].d.y
glVertex2f mu[j].x+mu[j].d.x, mu[j].y+mu[j].d.y
glVertex2f mu[sx].x+mu[sx].d.x, mu[sx].y+mu[sx].d.y
glVertex2f mu[tx].x+mu[tx].d.x, mu[tx].y+mu[tx].d.y
glend
endif
endif
endif
endif
next
shading
picklabel 0
flat
'--------------------------------- all ok -------------------------------- //
if mu[21].x + mu[21].y <> 0
if mu[22].x + mu[22].y <> 0
' Draw walls for the house ------------------- one wall ok -------------------- //
glBegin GL_QUADS
glVertex2f mu[21].x + mu[21].d.x, mu[21].y + mu[21].d.y
glVertex2f mu[22].x + mu[22].d.x, mu[22].y + mu[22].d.y
glVertex2f mu[22].x + mu[22].d.x, mu[22].y + mu[22].d.y + 4 ' Adjust the height of the walls
glVertex2f mu[21].x + mu[21].d.x, mu[21].y + mu[21].d.y + 4 ' Adjust the height of the walls
glEnd
'
' Draw roof for the house
glBegin GL_TRIANGLES
color .15, .25, .5, 1
' Vertex 1: Top corner of the wall
glVertex2f mu[21].x + mu[21].d.x, mu[21].y + mu[21].d.y + 4
' Vertex 2: Top corner of the opposite wall
glVertex2f mu[22].x + mu[22].d.x, mu[22].y + mu[22].d.y + 4
' Vertex 3: Midpoint between the two top corners
glVertex2f mu[21].x + mu[21].d.x + mu[22].x + mu[22].d.x, mu[22].y + mu[22].d.y + 8 ' Adjust the height of the roof
glEnd '+ mu[22].d.x) / 2
end if
end if
'next
shading
picklabel 1
'------------------------------------------------------------- all vertexs ok ends //
move 5,0
'if not pick then
if key[49] then picked=100 'keypress '1'
if key[50] then picked=200 'kypress '2'
pushstate
move -20,12
static sys tally
timemark t2
scale 1.0
'
macro pr(a,b) 'PRINTING LIST
----------------------------
pushstate : color .5,1,1 : print a : popstate
pushstate : color 1,1,.5 : move 8 : print b : popstate
printl ""
end macro
picklabel 10
'pr "Action Code: ", str(act)
'pr "indexbase ", str(indexbase)
pr "Picked ID: ", str(picked)
pr "Keyboard Code: ", str(keyd)
picklabel 0
popstate
'end if
end procedure 'main
EndScript
' roof, rectangle, colors new included 13-17/11/2023 by frank brübach, oxygenbasic
'------------------------------------------ //
'MainWindow 200+width,100+height,WS_OVERLAPPEDWINDOW
[
Thanks Frank,
We now need a proper toolbox to allow points, lines and surfaces to be placed and also edited.
Yes thx good Idea Charles :)
Havent Had enough time Last days to Go on Fürther with my House Project only an attempt to move the House / Roof and so on Like a complete block
PS do you think about Slider controls overlapped or similar Feature? Like the Input grid example? See Pic 2 + 3 below
Look perhaps at "dear ImGui c++"