Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / From begineer to begineers

Author
Message
Kesav
18
Years of Service
User Offline
Joined: 19th Nov 2006
Location:
Posted: 25th Nov 2006 01:00
Hi all...
i am begineer in DBPro and i want to make code shorten...
so i created this class for everyone...
there is some functions to shorten your code

-------------------
---- functions ----
-------------------
load_texture(texture_path$,texture_id)
create_box(id,width,height,depth,xpos,ypos,zpos,texture_id)
create_sphere(id,diameter,rows,columns,xpos,ypos,zpos,texture_id)
create_cylinder(id,diameter,height,xpos,ypos,zpos,texture_id)
create_cone(id,diameter,height,xpos,ypos,zpos,texture_id)
rotate_object(id,axis$,value)
-------------------

If you want to make it bigger.. simply download the file and add own functions....

Thanks for replies

I hope it will help you

Only learning will make a pro game developers from us

Attachments

Login to view attachments
indi
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Earth, Brisbane, Australia
Posted: 25th Nov 2006 01:32
one post is sufficient, in time your approval status will be clear of moderation.

SimSmall
20
Years of Service
User Offline
Joined: 7th Aug 2004
Location: United Kingdom
Posted: 25th Nov 2006 13:27
a function to perform one command is no quicker than just using the single internal command:

load_texture(x,y)

4 letters + 7 letters + 1 underscore + 1 comma + 2 brackets = 15 characters without considering the length of the parameters

load image x,y

4 letters + 5 letters + 2 spaces + 1 comma = 12 characters without considering the length of the parameters...

Quote: "there is some functions to shorten your code"


Ironically, at least this function actually makes your code longer...
Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 25th Nov 2006 22:16
Not that this really effects anything but I would of kept strings out of the function rotate_object. It's easier to say 1=x 2=y 3=z rather than check for highercase or lowercase letters. If you still want to use strings you can always force it to be highercase or lowercase by using "axis$=upper$(axis$)" or "axis$=lower$(axis$)".

Mr Tank
22
Years of Service
User Offline
Joined: 25th Nov 2002
Location: United Kingdom
Posted: 27th Nov 2006 02:38
Some of these are pretty useful. I don't really use the primitives a whole lot though, and am quite used to the standard commands anyhow.


You'll be able to click on this someday.
Zotoaster
19
Years of Service
User Offline
Joined: 20th Dec 2004
Location: Scotland
Posted: 27th Nov 2006 16:00
Quote: "It's easier to say 1=x 2=y 3=z"


You could make global variables or constants, i.e.
#constant X 1

rotate_object(x,90)

function rotate_object(axis,90)
if axis=1 etc...

Login to post a reply

Server time is: 2024-11-26 05:42:29
Your offset time is: 2024-11-26 05:42:29