the macro "PixelAligned" has some mistake

Forum for general chit-chat or off-topic discussion.

Moderators: CEGUI MVP, CEGUI Team

User avatar
flyue
Just popping in
Just popping in
Posts: 2
Joined: Mon Oct 06, 2008 11:14
Location: GanZhou,JiangXi,China

the macro "PixelAligned" has some mistake

Postby flyue » Mon Oct 06, 2008 11:23

After my test, the macro
"#define PixelAligned(x)( (float)(int)(( x ) + (( x ) > 0.0f ? 0.5f : -0.5f)) )"
is wrong. The right should be:
"#define PixelAligned(x)((float)((x) + ((x) >= 0.0f ? 0.5f : -0.5f)))" :roll:

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Postby CrazyEddie » Mon Oct 06, 2008 13:57

I do not have time to check the results of switching the comparison operator, but having said this, removal of the integer cast part is definitely a mistake - without this the macro ceases to perform the intended operation. Since I believe that getting a "correct" result when using the >= over the > probably requires the integer cast to be removed, this whole 'fix' is completely worthless.

Perhaps you could post some relevant information - such as some values passed in, the results you're getting out, the results you think you should have received, and why you believe the ones you're getting are incorrect?

:roll:

CE

User avatar
flyue
Just popping in
Just popping in
Posts: 2
Joined: Mon Oct 06, 2008 11:14
Location: GanZhou,JiangXi,China

Postby flyue » Tue Oct 07, 2008 10:23

Thank you very much for the reply, although my English is not very good

now I am reading your CEGUI source code, I learned a lot of new techniques from it.

In China, there are many video games use CEGUI :D , so I'm learning it now.

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Postby CrazyEddie » Thu Oct 09, 2008 07:48

flyue wrote:In China, there are many video games use CEGUI :D

It is good to hear that CEGUI is getting used for games in China. I hope you also have success in your learning and use of the library :)

CE.


Return to “Offtopic Discussion”

Who is online

Users browsing this forum: No registered users and 2 guests