» Goto page Previous  1, 2
EDIT: See comment below
Thanks alot, however I meant that given 3 values like 255,255,255 for black. How would I convert those values into hexidecimal (I presume) so that printcxy could take an rgb value as input.
Also another question is that, if I has several defined functions in a file let's say helperFunc.c how would I go about importing them into the main file as I want to seperate my code out thanks. I have tried creating a helperFunc.h file yet all it seems to produce is errors...
MichaelY wrote:
Thanks alot, however I meant that given 3 values like 255,255,255 for black. How would I convert those values into hexidecimal (I presume) so that printcxy could take an rgb value as input.

The Casio Prizm uses RGB 565, meaning 5 bits of red, 6 bits of green, and 5 bits of blue.

You are probably used to dealing with RGB 888, meaning 8 bits of red, green, and blue.

So, if you want to convert from RGB 888 to RGB 565, you would do the following:

Code:
rgb = ((r & 0b11111000) << 8) | ((g & 0b11111100) << 3) | (b >> 3);

where r is 8 bits of red (0 to 255), g is 8 bits of green (0 to 255) and b is 8 bits of blue (0 to 255).

Converting backwards (from RGB 565 to RGB 888) is a bit more complicated, but you should be able to find tools/algorithms on the internet.

MichaelY wrote:
Also another question is that, if I has several defined functions in a file let's say helperFunc.c how would I go about importing them into the main file as I want to seperate my code out thanks. I have tried creating a helperFunc.h file yet all it seems to produce is errors...

Here is a simple example:

helper.c

Code:
/* This means that we can define stuff in the header and include it here */
#include "helper.h"
/* This header is because we will use GetKey */
#include <fxcg/keyboard.h>

/* Contents of the function goes here */
void func(int a) {
GetKey(&a);
}

helper.h

Code:
/* These are used so that if the header is imported multiple times, it doesn't redefine its contents */
#ifndef HELPER_H
#define HELPER_H

/* The same function signature we used earlier */
void func(int a);

#endif /* Ends #ifndef HELPER_H */

main.c

Code:
/* Now we can use our helper function */
#include "helper.h"

int main(void) {
int key = 0;
/* Because we have included the helper.h header, we can use the functions defined in it. */
func(key);
return 0;
}

Let me know if any further explanation is needed.
Note: whilst I didn't run this code, it at least compiled, and should work theoretically.
Thanks it all works, however I have been recently trying to get a shape to work, I have used ShapeBase per one of the earlier posts as seen in the link

It all works however is there a parameter to make the shape, like circle to be filled.
Yep. see the TShape definition here.
I know this is abit late, but I would just like to thank everyone for the taking the time to respond to my questions.
MichaelY wrote:
I know this is abit late, but I would just like to thank everyone for the taking the time to respond to my questions.

No problem, I'm happy to help.

Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

»
» Goto page Previous  1, 2
» All times are UTC - 5 Hours

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum