![]() | ||
PSP Programming C/C++ help
| ||
![]() |
| | LinkBack | Thread Tools | Display Modes |
| | #1 |
| Novice | PSP Programming C/C++ help I'm doing a bit of programming for the PSP in C/C++, using the pspdev thing for compiling. I'm trying to make a function to print in color. Basically, I call my function, giving it a string I want to print, and a RGBA (red, green, blue, alpha) hex color code. Then my function should print the message in that color. I have some code to do this: Code: void printStuff( long colour, char *message )
{
int r;
int g;
int b;
int a;
int c;
c = colour;
r = c / 0x01000000 ;
c -= (r * 0x01000000 );
g = c / 0x00010000 ;
c -= (g * 0x00010000 ) ;
b = c / 0x00000100 ;
c -= (b * 0x0100 );
a = c;
pspDebugScreenSetTextColor((a * 0x1000000) + (b * 0x10000) + (g * 0x100) + (r));
pspDebugScreenPrintf(message);
}
In theory, if I use: Code: printStuff(0xFF7F0FF, "Hello"); It compiles fine, and when I do the sums on a calculator, it works fine. But when I run it on the PSP, it doesn't work at all... I think the problem lies when I'm doing "r = c / 0x01000000 ;", like it can't divide properly or something. Does anyone know why this doesn't work? Or, can anyone think of a better way of getting r, g, b and a from the color? Thanks. |
| | |
![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads |
| Thread | Thread Starter | Forum | Replies | Last Post |
| Downgrading every psp firmware 3.03 and below | I Doughboy | PSP Modding | 4 | 06-30-2009 09:20 AM |
| M33 Firware for Noobs | I Doughboy | PSP Modding | 2 | 06-16-2008 10:26 PM |
| A small tutorial on How to Hack the PSP | MattManiaMaxX | PSP Tutorials | 18 | 04-02-2008 12:16 AM |
| psp mod list | avenged | PSP Modding | 0 | 02-25-2007 11:50 PM |