What is a wrapper?
I have heard a lot of people talking about wrappers, usually .lib files. Im guessing they are used to simplify programming by sticking functions, etc. into a lib file?
If so, how do I make these myself?
Thanks
You''re kinda right. Wrappers tend to "wrap up" more complex code with simpler code. So if when you call func X you also always have to call Y & Z, you could wrap it with
void funcXcallAll()
{
X();
Y();
Z();
}
This is obviously a trivial example
Brad
void funcXcallAll()
{
X();
Y();
Z();
}
This is obviously a trivial example
Brad
Yeah, like a DirectX wrapper would just wrap complex DirectX function calls into simpler functions to make it easier to use and such.
Ya, wrappers are created to run common tasks quickly and easily. Also I personally try to be modular with any wrappers i make so i can use them on multiple projects.
An example is the wrapper i wrought for various parts of Direct X. I wrought one for DirectInput,DirectSound,DirectDraw,and DirectMusic. I tried to keep it simple, want to open direct input for a keyboard, you make two calls in my wrapper
OpenDI(hInst)
OpenDIKey(hWnd)
An in each of those funtions (which are part of a class) it handles the respected things, so I don''t have to type out create devivce and handle the devices. Note these are in a class and only a few functions of the wrapper. eg getting data, updating and so forth. There is no one way to make a wrapper, but they save you time. So later on you can grab a wrapper you made a while ago and quickly have that part of the program up and running.
-Scott
An example is the wrapper i wrought for various parts of Direct X. I wrought one for DirectInput,DirectSound,DirectDraw,and DirectMusic. I tried to keep it simple, want to open direct input for a keyboard, you make two calls in my wrapper
OpenDI(hInst)
OpenDIKey(hWnd)
An in each of those funtions (which are part of a class) it handles the respected things, so I don''t have to type out create devivce and handle the devices. Note these are in a class and only a few functions of the wrapper. eg getting data, updating and so forth. There is no one way to make a wrapper, but they save you time. So later on you can grab a wrapper you made a while ago and quickly have that part of the program up and running.
-Scott
-Scott
you don''t have to make a new lib file though. most people just make reusable code (classes) for a redundant operation.

How many Microsoft employees does it take to screw in a light bulb?
None, they just declare drakness as a new standard.

How many Microsoft employees does it take to screw in a light bulb?
None, they just declare drakness as a new standard.
My HomepageSome shoot to kill, others shoot to mame. I say clear the chamber and let the lord decide. - Reno 911
If you like, download my D3DXSprite wrapper library to give you an idea how to get your own wrapper up and running. Its basically a D3D (2D) Graphics Lib that takes care of initialization, all the textures, and destruction. A sample app that utilizes the wrapper is included as well.
Hope it helps
Hope it helps

Downloads: ZeroOne Realm
Downloads: ZeroOne Realm
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement