NOGDUS
October 22, 2018, 06:54:01 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
 
   Home   Blogs Help Search Tags Login Register  
Pages: [1]   Go Down
  Print  
Author Topic: Color  (Read 2893 times)
0 Members and 1 Guest are viewing this topic.
bedndarc
Member
*

Respect: 0
Offline Offline

Posts: 58



« on: May 14, 2011, 02:46:25 PM »

How correctly to write down the code of color for the sprite?
spr->SetColor(Huh??);
85124 - works
#84512F - doesn't work
Prompt in what my error?
Logged
Mattias Gustavsson
Moderator
Member
*

Respect: 58
Offline Offline

Posts: 94



« Reply #1 on: May 14, 2011, 05:36:44 PM »

Pixie is using 16 bit colours, in R5G6B5 format.
So the first 5 bits are for red, the next 6 for green, and the last 5 for blue.
To make it easy to define colour, look in the file ColorHelper.h, which has some handy helper functions
Examples:
Code:
pr->SetColor( RGB16(255, 0, 255) ); // Sets colour using three separate R,G,B values in the range 0 to 255
pr->SetColor( RGB32TO16(0xFF00FF) ); // Sets colour using a singel hexadecimal value
pr->SetColor( FLOATTORGB16(1.0f, 0.0f, 1.0f) ); // Sets colour using three separate floating point values in the range 0.0 to 1.0
Logged
bedndarc
Member
*

Respect: 0
Offline Offline

Posts: 58



« Reply #2 on: May 15, 2011, 12:59:56 AM »

Well, has understood, thanks Smiley
Logged
Tags:
Pages: [1]   Go Up
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!