Funtion

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Brkopac
Posts: 88
Joined: Fri Sep 19, 2008 2:36 am

Re: ..

Post by Brkopac »

M4UNOT wrote:slavik262

I don't need some basic C++ lessons

and i know how to create a lib ... Sudi see my videos:

http://www.youtube.com/user/m4unot
Your youtube channel in no way shape or form proves you have grasps of C++ or any other programming knowledge. A few solutions have been provided to you in this thread and yet you continue to assume that everybody else doesn't know what's going on. You should re-read and reflect. Just sayin'.
Image - The glory days.
ACE247
Posts: 704
Joined: Tue Mar 16, 2010 12:31 am

Post by ACE247 »

Well you seem to be a Soccer Fan. 8)(Judging by the song)
I'm for Germany! :P
greenya
Posts: 1012
Joined: Sun Jan 21, 2007 1:46 pm
Location: Ukraine
Contact:

Post by greenya »

I just need help .. to make a function in c++ called: " Scale " that can scale

my object's instead of " setScale "
Ok, if you realize that "Scale" will also need an object to operate than next is your function (very same code was already posted above):

Code: Select all

void Scale(ISceneNode* node, float ratio)
{
    if (node != 0)
        node->setScale(core::vector3df(ratio, ratio, ratio));
}
If you don't want to pass "node" parameter, than "Scale" function should know "your object" some other way, for example:

Code: Select all

ISceneNode* yourObject;
void Scale(float ratio)
{
    if (yourObject != 0)
        yourObject->setScale(core::vector3df(ratio, ratio, ratio));
}
than you can set "yourObject" once and after this all calls to "Scale" will be done to that object. You get 1 argument function as requested i guess.

P.S.: if it is not what you need, please tell more info about what you particularly need.
slavik262
Posts: 753
Joined: Sun Nov 22, 2009 9:25 pm
Location: Wisconsin, USA

Re: ..

Post by slavik262 »

At the risk of feeding the troll,
M4UNOT wrote:I just need help .. to make a function in c++ called: " Scale " that can scale

my object's instead of " setScale "
To do so requires a very simple understanding of fundamental C++ programming concepts. If you don't know how to do this yourself, then yes, you should read up on some lessons.
M4UNOT wrote:see my videos:

http://www.youtube.com/user/m4unot
Are these supposed to impress us with your programming knowledge? It's one thing to hack together a program based on things you've found; it's quite another to understand the fundamental concepts of what you're doing and build upon them. Your question on these forums shows you don't know the basic concepts of C++. The members of the forum would be happy to help you with understanding these concepts, but asking for help works a lot better than accusing all of us of knowing nothing.

Your "API" videos only strengthen my opinion that you don't know what you're doing. If writing confusing and pointless wrappers around console input and output functions is supposed to impress us, try again. The most important part of programming isn't writing code, but understanding the problems you're faced with and breaking them down into problems that can be solved with programming logic. Also very important to programming is writing code that is expressive - code that is easy to understand and that serves an obvious purpose. The standard library was designed with this in mind: cout (console out) and printf (print function) are straightforward functions that do exactly what you would expect given expected parameters. The same goes for system(), which runs a given system command. To obfuscate these into misleading/confusing functions like Main() and New() to the point where it's hard to even tell what they do is pointless and stupid. Which is easier to understand,

Code: Select all

printf("Hello World!")
or

Code: Select all

char* p=new char[1024];++*p;++*p;++*p;++*p;++*p;++*p;++*p;++*p;++*p;++*p;while(*p){++p;++*p;++*p;++*p;++*p;++*p;++*p;++*p;++p;++*p;++*p;++*p;++*p;++*p;++*p;++*p;++*p;++*p;++*p;++p;++*p;++*p;++*p;++p;++*p;--p;--p;--p;--p;--*p;}++p;++*p;++*p;putchar(*p);++p;++*p;putchar(*p);++*p;++*p;++*p;++*p;++*p;++*p;++*p;putchar(*p);putchar(*p);++*p;++*p;++*p;putchar(*p);++p;++*p;++*p;putchar(*p);--p;--p;++*p;++*p;++*p;++*p;++*p;++*p;++*p;++*p;++*p;++*p;++*p;++*p;++*p;++*p;++*p;putchar(*p);++p;putchar(*p);++*p;++*p;++*p;putchar(*p);--*p;--*p;--*p;--*p;--*p;--*p;putchar(*p);--*p;--*p;--*p;--*p;--*p; --*p;--*p;--*p;putchar(*p);++p;++*p;putchar(*p);++p;putchar(*p);
Both do the same thing, but the first one is clearly easier to understand and use.

Sorry if I offended you, but you asked for it when you accused everyone on this forum of not knowing how to write a function even after several people had helped you. :P
M4UNOT
Posts: 39
Joined: Sat Jun 26, 2010 3:06 pm
Location: Germany

Re

Post by M4UNOT »

Thanks, Guy's

Vielen Dank an alle hier in diesem forum 8)
slavik262
Posts: 753
Joined: Sun Nov 22, 2009 9:25 pm
Location: Wisconsin, USA

Post by slavik262 »

I'd love to see his code. :P
M4UNOT
Posts: 39
Joined: Sat Jun 26, 2010 3:06 pm
Location: Germany

R

Post by M4UNOT »

hier .. mein Freund:

Code:

Code: Select all


void Scale(IAnimatedMeshSceneNode* SceneNode, f32 X, f32 Y, f32 Z) 
{ 
    SceneNode->setScale (vector3df( X, Y, Z));  // X, Y, Z
} 


To use it:

Code: Select all


Scale(node, 0.6f,0.6f,0.6f);

:roll:
slavik262
Posts: 753
Joined: Sun Nov 22, 2009 9:25 pm
Location: Wisconsin, USA

Post by slavik262 »

I almost heard a whistling sound as the entire point of Object Oriented Programming flew over your head.
M4UNOT
Posts: 39
Joined: Sat Jun 26, 2010 3:06 pm
Location: Germany

a

Post by M4UNOT »

Hahaha :D
sudi
Posts: 1686
Joined: Fri Aug 26, 2005 8:38 pm

Post by sudi »

why are you wrapping irrlicht in a c-style api?
We're programmers. Programmers are, in their hearts, architects, and the first thing they want to do when they get to a site is to bulldoze the place flat and build something grand. We're not excited by renovation:tinkering,improving,planting flower beds.
M4UNOT
Posts: 39
Joined: Sat Jun 26, 2010 3:06 pm
Location: Germany

Re: c++ Function Code

Post by M4UNOT »

:wink: i like it that way
Virion
Competition winner
Posts: 2148
Joined: Mon Dec 18, 2006 5:04 am

Post by Virion »

you can try to wrap the whole irrlicht lib into your C-style functions. go ahead your future is bright.

add: *sarcastic*
Last edited by Virion on Wed Jun 30, 2010 10:50 am, edited 2 times in total.
greenya
Posts: 1012
Joined: Sun Jan 21, 2007 1:46 pm
Location: Ukraine
Contact:

Post by greenya »

Code: Select all

...
#define Scale(node,x,y,z) node->setScale(vector3df(x,y,z))
#define Position(node,x,y,z) node->setPosition(vector3df(x,y,z))
#define Rotation(node,x,y,z) node->setRotation(vector3df(x,y,z))
...
#define Drop(referenceCounted) referenceCounted->drop()
#define Grab(referenceCounted) referenceCounted->grab()
...
:roll:
sudi
Posts: 1686
Joined: Fri Aug 26, 2005 8:38 pm

Post by sudi »

oh my i think i just saw a little bit of hell right there... :D
We're programmers. Programmers are, in their hearts, architects, and the first thing they want to do when they get to a site is to bulldoze the place flat and build something grand. We're not excited by renovation:tinkering,improving,planting flower beds.
DtD
Posts: 264
Joined: Mon Aug 11, 2008 7:05 am
Location: Kansas
Contact:

Re: c++ Function Code

Post by DtD »

M4UNOT wrote::wink: i like it that way
I had the same feeling about Object-Oriented programming a long time ago, but trust me, just take the time to learn and get used to oo stuff, it is way better and you won't be wasting time with silly wrappers like this.
Post Reply