Yes, but 8bpp is going to be the easiest to use, and fastest in terms of LCD communication in most cases. Are you going to actually use the routines, or just talk about them?
I'm going to use them! :p I'm just curious if 4bpps can be done, and if they're compatible with those routines.
I'm just asking because for my purposes (you can PM me if you want to know what), 8bpps sprites will be very memory-hefty.
I'm just asking because for my purposes (you can PM me if you want to know what), 8bpps sprites will be very memory-hefty.
I have a question for the first time in a while :p
I'm declaring an array of structs to hold data about certain objects in a game. I'm doing it like this:
Code:
My question is, since C requires you to allocate memory for everything, does DataBase have to have the length of the array in the [], or can it be left that way and be defaulted to however many structures exist within the declaration?
I'm declaring an array of structs to hold data about certain objects in a game. I'm doing it like this:
Code:
struct Reference {
int var1;
int var2; };
struct Reference DataBase[] = {
{1, 1},
{1, 1},
...
};
My question is, since C requires you to allocate memory for everything, does DataBase have to have the length of the array in the [], or can it be left that way and be defaulted to however many structures exist within the declaration?
If you put a number between the [] then the initializers will fill the array until there are no more initializers, but the array will always be the size you gave. If you don't give a size, you have to initialize it, and it gets the size from the number of initializers.
If you initialize an array of structs and declare its contents, and not all of the structs have the same number of variables in it, can you omit them? For instance, for my CE version of Star Trek, I'm setting up this...
Code:
Not all of the moduleDataField's will be occupied. If I omit them, will they be padded to NULL, or do I have to set any unused field to NULL in the initialization?
Code:
struct moduleData {
const char moduleType;
const char moduleSubType;
const char moduleName[24];
const char moduleDataField_1;
const char moduleDataField_2;
const char moduleDataField_3;
};
Not all of the moduleDataField's will be occupied. If I omit them, will they be padded to NULL, or do I have to set any unused field to NULL in the initialization?
If i choose to initalize C graphics in 4-bit color mode, what is the default color palette used, or would I need to supply my own? Which palette is used by SourceCoder? I'm trying to use the proper palette for sprite making.
Edit: Just pulled up the old post about TokenIDE with the BasicColors palette.
A new question. On reviewing Demo5 in the library examples, involving Decompression, I noticed that the gfx/ directory had an "all_gfx.h" file and an "apple.c" which was the sprite data. Yet, only the .h file was included into the main source file. Wouldn't you have to include everything? I'm not entirely sure how the C compiler works with this stuff. Can someone please explain to me the relationship between the .h files, the .c files that are referenced via extern, and the main source?
Edit: Just pulled up the old post about TokenIDE with the BasicColors palette.
A new question. On reviewing Demo5 in the library examples, involving Decompression, I noticed that the gfx/ directory had an "all_gfx.h" file and an "apple.c" which was the sprite data. Yet, only the .h file was included into the main source file. Wouldn't you have to include everything? I'm not entirely sure how the C compiler works with this stuff. Can someone please explain to me the relationship between the .h files, the .c files that are referenced via extern, and the main source?
.h files contain references to code and functions within .c files. You only want to ever #include .h files because otherwise code will be duplicated. ConvPNG uses groups to name the different .h files that you can include in your project
MateoConLechuga wrote:
.h files contain references to code and functions within .c files. You only want to ever #include .h files because otherwise code will be duplicated. ConvPNG uses groups to name the different .h files that you can include in your project
Does this include functions put in other .c files? Do they get referenced by .h files, or do code files get included normally? Also, I got some compile errors about missing function prototypes that disappeared when i fixed the directory of the include. Is that error equivalent to assembly's undefined label?
ACagliano wrote:
Does this include functions put in other .c files? Do they get referenced by .h files, or do code files get included normally? Also, I got some compile errors about missing function prototypes that disappeared when i fixed the directory of the include. Is that error equivalent to assembly's undefined label?
It's just a reference; so kind of like an undefined label. It has to know what the code looks like; which is what a reference is. It's like when you use '#include "ti84pce.inc"' in assembly.
MateoConLechuga wrote:
It's just a reference; so kind of like an undefined label. It has to know what the code looks like; which is what a reference is. It's like when you use '#include "ti84pce.inc"' in assembly.
So, when creating files containing functions like a raycasting engine for example, you don't include the .c files in the main file, but rather the .h file with the function prototypes, and it somehow finds the actual function?
MateoConLechuga wrote:
Yes exactly. That makes the code nice and modular.
Awesome, thanks! and last question for now. The graphx.h file has some functions that seem to be about fonts (void gfx_SetFontData(uint8_t *fontdata). Can you use these for custom fonts? Does the toolchain support custom fonts?
Of course. There are numerous font editors available; my favorite is pixelfontedit 8x8 which can export an array of your font data for use with that function. If you also want variable width spaced characters rather than just monospace; you will also need to build that array and pass it to gfx_SetFontSpacing. This will most likely have to be done manually; but most characters are just 8 bits wide so it is pretty easy.
MateoConLechuga wrote:
Of course. There are numerous font editors available; my favorite is pixelfontedit 8x8 which can export an array of your font data for use with that function. If you also want variable width spaced characters rather than just monospace; you will also need to build that array and pass it to gfx_SetFontSpacing. This will most likely have to be done manually; but most characters are just 8 bits wide so it is pretty easy.
I did some investigating into pixelfontedit. It doesn't have the particular font I'm looking for (or one close to it), and for my purposes, 8x8 might actually not work. I'm still thinking about this. At any rate, I reached out to someone who has done fonts for a bit of advice. My question to you now is, the graphx.h file says the font routines are for 8x8. I'm assuming if my font sprites were, for instance, 8x12, I'd need to make my own routines, or use the normal sprite drawing routines.
The second question I have is... I could have sworn I saw it at some point, but a function to fill the screen to a color?? Does this exist? (im going through the libs in more detail now and if i find it, ill edit this question out).
Indeed, the libs don't work with font more than 8x8, you need your own routine for that.
The function to fill the screen is gfx_FillScreen(uint8_t color)
The function to fill the screen is gfx_FillScreen(uint8_t color)
PT_ wrote:
Indeed, the libs don't work with font more than 8x12, you need your own routine for that.
The function to fill the screen is gfx_FillScreen(uint8_t color)
The function to fill the screen is gfx_FillScreen(uint8_t color)
bummer to the first, but i can work around it, and thanks to the second. Still havent found it myself, but i will.
The third question I have is: the tice.h file has a routine that's ChkFindSym. It returns pointers to the data/entry. How then do I take the data there (which would be in an array of data format, im assuming) and put it into, say structs? Would it be as simple as knowing which data is in what offset from appvar start and doing something like:
Code:
player.x = saveData[4];
also, how does C handle saving such things as floats into TI variables, and recalling them?
ACagliano wrote:
also, how does C handle saving such things as floats into TI variables, and recalling them?
Don't use the routines in tice.h to work with files. They are horrible. Use fileioc.h; for which there are examples of Also, all the routines are documented and searchable online; available here so you don't have to manually look through a header file
http://ce-programming.github.io/toolchain/files.html
MateoConLechuga wrote:
ACagliano wrote:
also, how does C handle saving such things as floats into TI variables, and recalling them?
Don't use the routines in tice.h to work with files. They are horrible. Use fileioc.h; for which there are examples of Also, all the routines are documented and searchable online; available here so you don't have to manually look through a header file
http://ce-programming.github.io/toolchain/files.html
Oh wow! Thanks++ that's the first time I've seen documentation of the routines!! That will help tons! Also, please see my pm (as to why I need a tall font). I was directed to talk to you about modifying your font-related routines to deal with 8x12 fonts, and using the altered functions, rather than the toolchain ones.
I can use 8x12 fonts as a complete substitution for 8x8.. i don't need both. And the ability to scale the font like your scaled sprite routines would be helpful. I can, with some careful coding, actually use your scaled sprite routines with my font rather than using your font routines, but I was suggested to talk to you about amending them directly to support it, since it might be faster.
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.
» Go to Registration page
» Go to Registration page
» Goto page Previous 1, 2, 3, 4, 5, 6 Next
» View previous topic :: View next topic
» View previous topic :: View next topic
Page 4 of 6
» 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
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
Advertisement