Recent posts

#21
OxygenBasic Examples / Re: Define question
Last post by Charles Pegge - July 19, 2024, 09:15:29 PM
With def statements, parameters are not declared like functions and procedures. Instead parameters are referenced within the body of the macro as %1 %2 %3 etc. For instance

def listitem print "%1" + chr(9) + "%2" + chr(13,10)
'
listitem 1 shoes
listitem 2 socks
listitem 3 hat

When invoking listitem the 2 words following listitem are treated as parameters. This is similar to DOS macros.
#22
OxygenBasic Examples / Re: Define question
Last post by Frank Brübach - July 19, 2024, 08:35:24 PM
Thanks again Charles,

I only want to know If a construct with three Parameters to define is possible?

Def Abc Print
Abc="hello Diana"

Def xyz Abc Print ' three Parameters
Xyz="hello Julia"

So If thats possible that xyz has Same Definition Like Print in one Line?

Regards, frank
#23
OxygenBasic Examples / Re: Define question
Last post by Charles Pegge - July 19, 2024, 06:41:21 PM
mbox is a low-level call based on MessageBox. So the expression mbox="hello" is treated as a pseudo-assignment with "hello" as its parameter.

so these definitions will work because they resolve to mbox(string) calls, though it might confuse someone trying to understand the code.

mbox "hello0"
mbox="hello1"
def funbox mbox
funbox="hello2"
def control funbox
control="hello3"

#24
OxygenBasic Examples / Re: Define question
Last post by Frank Brübach - July 19, 2024, 03:51:18 PM
Yes.. Here my Idea :(

' ok first three definitions
'
def funbox mbox
funbox = "Hello Oxygen"

def control funbox
control = "Hello Oxygen2"

def control2 control
control2 = "Hello Oxygen3"

'------------------------------------------------------------ //
' this was my idea if that's working too with three parameters

def control funbox mbox 'default params not available
control = "Hello Oxygen4"

#25
OxygenBasic Examples / Re: Define question
Last post by Charles Pegge - July 19, 2024, 02:21:05 PM
Perhaps you could provide a use-case showing the result you want it to produce.
#26
OxygenBasic Examples / Re: Define question
Last post by Frank Brübach - July 19, 2024, 01:39:18 PM
Thank you Charles

Perhaps I didnt make IT clear sorry.. or I cannot understand your explanation..

I wanted more that in this Case 'control'

Def Control funbox mbox
Has Same mbox Features Like above  in my First post

Def funbox mbox
Thx
#27
OxygenBasic Examples / Re: OpenGL question gprint
Last post by Charles Pegge - July 19, 2024, 12:54:49 PM
A brief demo of circular text using consoleG with the predefined Arial Font. Each character is a vertex list for a solid shape, which can be scaled, rotated etc.


'CIRCULAR TEXT DEMO
uses consoleg
procedure main()
move 20,-15
string s="WELCOME CODERS"
int i,j
cls .2,.1,.5
scale 1.5
color .9,.8,.0
for i=1 to len(s)
  pushstate
    rotateZ -24*j
    move 4
    scale 2
    rotateZ -90-12 'clockwise
    gprint mid(s,i,1)
  popstate
  j++
next
end procedure
endscript

#28
OxygenBasic Examples / Re: Define question
Last post by Charles Pegge - July 19, 2024, 11:53:02 AM
You can use a def to represent any number of words. It will also accept up to 9 parameters for substitution %1..%9.

One of my favorites illustrating several features:

def show print "%1  --> " %1

show(10+1/4)   '10+1/4  --> 0.25

A single liner def is the same as a '%' or '$' equate.

#29
OxygenBasic Examples / Define question
Last post by Frank Brübach - July 19, 2024, 10:35:06 AM
hello charles..

its possible with ocygen to define more than one command with another syntax?

for example

def funbox mbox ' thats ok

but how about that with second definition
here 'control'

def funbox control mbox

thanks, frank
#30
OxygenBasic Examples / Re: OpenGL question gprint
Last post by Bernard Kunzy - July 17, 2024, 09:08:57 PM
I think that GDImage does that very well, including 0-360 full range rotation.
https://forum.powerbasic.com/forum/user-to-user-discussions/third-party-addons/832675-circular-text


With OpenGL the solution is obvious, create a bitmap and use it for texture on a quadratic surface.

Indeed you can use the same concept that is used there for text rotation.