2D Pos -> Int

Discussion about everything. New games, 3d math, development tips...
Post Reply
Jookia
Posts: 170
Joined: Wed Nov 19, 2008 1:11 am

2D Pos -> Int

Post by Jookia »

I made a 2D Position -> Int -> 2D Position encoder/decoder.

Has this been done before?
Sylence
Posts: 725
Joined: Sat Mar 03, 2007 9:01 pm
Location: Germany
Contact:

Post by Sylence »

Ehm LOWORD and HIWORD ?

Oh and why do you need this ?
Software documentation is like sex. If it's good you want more. If it's bad it's better than nothing.
vitek
Bug Slayer
Posts: 3919
Joined: Mon Jan 16, 2006 10:52 am
Location: Corvallis, OR

Post by vitek »

How well does it handle core::position2df or core::position2di(1 << 16, 1 << 16)?

Travis
Jookia
Posts: 170
Joined: Wed Nov 19, 2008 1:11 am

Post by Jookia »

I don't need it, I just thought it'd be fun to make.
torleif
Posts: 188
Joined: Mon Jun 30, 2008 4:53 am

Post by torleif »

Code: Select all

struct P{
 s16 x;
 s16 y;
}
// create a new 16 bit struct 
P p = (10, 10);

// put this position into an int
s32 myposition = (int)p;

// put the int back into the stuct
P backPos = (P)myposition;

//put the stuct into a irrlicht position
core::position2di m = new core::position2di(backPos.x, backPos.y);

I'd appreciate some critique, my C/C++ is getting a bit rusty
Post Reply