Author Topic: Multiple Assignments  (Read 2100 times)

0 Members and 1 Guest are viewing this topic.

Charles Pegge

  • Guest
Multiple Assignments
« on: January 24, 2014, 08:29:31 AM »

To work correctly with floats and mixed types, this feature requires a new Oxygen.dll (24 Jan 2014)

http://www.oxygenbasic.org/forum/index.php?topic=749.0

Code: [Select]
single a,b,c,d
a=b=c=d=4.5
print "Multiple Assignments:"  a "  " b "  " c "  " d


Peter

  • Guest
Re: Multiple Assignments
« Reply #1 on: January 24, 2014, 08:57:01 AM »
works for me your new dll , I hope.  :D
Thank you Charles

Code: [Select]
include "sw.inc"
Window 320,240,1

Write 10,10,"HELLO WINDOW",sw_red,sw_blue
Text  10,30,"HELLO APPLE ",sw_red
Write 10,50,"HELLO LINUX ",sw_crimson,sw_gold
Text  10,70,"HELLO AMIGA ",sw_brown

WaitKey
CloseWindow
« Last Edit: January 24, 2014, 11:15:02 AM by peter »

Peter

  • Guest
Re: Multiple Assignments
« Reply #2 on: January 24, 2014, 11:21:26 AM »
Hello,

How does this run with you ?
Use the new dll 24.01.2014. I got no problem.

Code: [Select]
include "sw.inc"
include "gl.inc"

hwnd=Window 640,480,1
Init2D hwnd

int ox = GetWidth() /2
int oy = GetHeight()/2
int cx, cy, pen=1       

Sub Pos(int x,y)
    iF pen then DrawLine(ox+cx,oy-cy,ox+x,oy-y, 1, 240,240,240,255)
    cx = x
    cy = y
End Sub   

Sub iPoint(single a,b,c)
    pos((a-c)*0.886, b-(a+c)*0.5)
End Sub

Sub Cone(single r,l)
    r= l/2
    pen=0
    single h, v
    For h=0 to l step 10
    For v=0 to 360 step 20
iPoint((h/2)*cos(rad(v)), h, (h/2)*sin(rad(v)))
pen=1
    Next
       pen=0
    Next
    For v=0 to 360 step 20
    For h=0 to l step 10
iPoint((h/2)*cos(rad(v)), h, (h/2)*sin(rad(v)))
pen=1
    Next
       pen=0
    Next
End Sub

Sub Ellipsoid(single r1, r2, r3)
    single u, v, l, m, n
    pen=0
    For u=0 to 360 step 20
    For v=0 to 180 step 20
l = (r1 * cos(rad(u))) * sin(rad(v))
m = r3 * sin(rad(u))
n = (r2 * cos(rad(u))) * cos(rad(v))
iPoint(100 + l, -30 + m, 100 + n)
pen=1
    Next
       pen=0
    Next
    For v=0 to 180 step 20
    For u=0 to 360 step 20
l = (r1 * cos(rad(u))) * sin(rad(v))
m = r3 * sin(rad(u))
n = r2 * cos(rad(u)) * cos(rad(v))
iPoint(100 + l, -30 + m, 100 + n)
pen=1
    Next
       pen=0
    Next
End Sub

Sub Cylinder(single r, l)
    int h, v
    pen=0
    For h=0 to l step 10
    For v=0 to 360 step 20
iPoint(120+r*cos(rad(v)), -100+h, -120+r*sin(rad(v)))
pen=1
    Next
pen=0
    Next
    For v=0 to 360 step 20
    For h=0 to l step 10
iPoint(120+r*cos(rad(v)), -100+h, -120+r*sin(rad(v)))
pen=1
    Next
  pen=0
    Next
End Sub

Sub Sphere(single r)
    single u, v, l, m, n
    pen=0
    For u=0 to 360 step 20
    For v=0 to 180 step 20
l = (r * cos(rad(u))) * sin(rad(v))
m = r * sin(rad(u))
n = (r * cos(rad(u))) * cos(rad(v))
iPoint(-120 + l, -100 + m, 120 + n)
pen=1
    Next
pen=0
    Next
    For v=0 to 180 step 20
    For u=0 to 360 step 20
l = (r * cos(rad(u))) * sin(rad(v))
m = r * sin(rad(u))
n = (r * cos(rad(u))) * cos(rad(v))
iPoint(-120 + l, -100 + m, 120 + n)
pen=1
    Next
pen=0
    Next
End Sub

while Key(27)=0
Sphere(40)
Cone(40, 70)
Cylinder(30, 90)
Ellipsoid(60, 40, 25)

DoEvents
SwapBuffer
wend

Quit2D
CloseWindow

Charles Pegge

  • Guest
Re: Multiple Assignments
« Reply #3 on: January 24, 2014, 05:22:45 PM »
Yes, nice wire mesh 3d.