Ok I was working with graphx, sprites, etc. I have a couple of questions:
First I realized that setting custom fonts with the gfx_SetCharData didn't produce the results i would like

Code:

uint8_t char_data = {0x39, 0x45, 0x82, 0x82, 0x82, 0x83, 0x45, 0x39}; // Bitmap for "alpha"
uint8_t char_data2 = {0x00, 0x00, 0x08, 0x1C, 0x26, 0x43, 0x81, 0xFF}; //delta

They produced decent results on the font editor but when I printed them on the calculator, some of the pixels were deleted so alpha looked like 'o |' rather than 'α' and delta looked like 'σ' instead of 'Δ', but this is rather trivial because I can play around with the font editor and maybe get better results. If you guys made better Greek letter fonts you can send the array.

But the most pressing issue here is the gfx_setPalette. When I ran gfx_setPalette with the make gfx, the normal palette in the documentation changed! Some of the colors were still there but 0 was no longer black, etc. If I don't run gfx_setPalette then the sprite would get different colors (I think. I was trying random combinations and each combination gave a different color scheme). I remember that green was replaced with orange and black with pink. How do I get the new palette?

Also, I'm using a sprite as a logo picture. I don't need the picture to move so I thought it was a waste of space. Am I supposed to use a sprite for pictures that don't move? If not, then how do I put pictures in my program?

One last question, I've been using delay() as a sleep() in which the game waits for a few seconds. Is there a synchronous delay()? So I can get key input from the user while its delaying the program. I don't want the program to stop. (I am using this for blinking text, the text blinks but user can still press keys. I don't know if delaying is the right way but that's how I do it in other languages.)
The pixels being deleted might be an issue with the font width. You'll probably want to try to find a character with the same width in the default font as the one you want to overwrite, as I don't believe that it's possible to set the width of one specific character without changing all of them.

You can't both change the palette and not change the palette. However, you can tell convimg to put specific colors in certain palette locations. I would check out the fixed-entries option for convimg, which allows you to, for example, tell it to make palette index 0 black.

A sprite is just a palettized bitmap image. It can either move or remain in the same place, and there's no real performance / size difference there.

No, there's not a synchronous delay. I would recommend using a loop that reads from the keypad in addition to checking a timer.
So the font is actually 10x10 pixels when displayed but 8x8 on the editor right?
commandlockguy can you answer my question?
It's 8 pixels tall, but each character has a variable width of up to 8.
I checked the graphx.asm file, I found this:

Code:

        db   8,8,8,8,8,8,8,8,8,8,8,8,8,2,8,8
   db   8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8
   db   3,4,6,8,8,8,8,5,5,5,8,7,4,7,3,8
   db   8,7,8,8,8,8,8,8,8,8,3,4,6,7,6,7
   db   8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8
   db   8,8,8,8,8,8,8,8,8,8,8,5,8,5,8,8
   db   4,8,8,8,8,8,8,8,8,5,8,8,5,8,8,8
   db   8,8,8,8,7,8,8,8,8,8,8,7,3,7,8,8
   db   8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8
   db   8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8

This should be the default spacing. I picked the first and second index, which according to this should have a font width of 8? What does it represent? Is 8 the font width that I need?
Those are in pixels, so it's probably not a spacing issue, then. Could you send a screenshot of what it looks like, and your code?
Sorry for the late reply. I had school and stuff. This is my code:

Code:

#include <tice.h>
#include <stdlib.h>
#include <graphx.h>
#include <fileioc.h>
#include <keypadc.h>
#include <string.h>
#include "gfx/gfx.h"
//begin functions
//draw functions
void printCentered(const char *str, int height) {
    gfx_PrintStringXY(str, (LCD_WIDTH - gfx_GetStringWidth(str)) / 2, height);
}
int main(void) {
    gfx_Begin();
    //Call PKMNSET2
    uint8_t char_data = {0x39, 0x45, 0x82, 0x82, 0x82, 0x83, 0x45, 0x39}; // Bitmap for "alpha"
    uint8_t char_data2 = {0x00, 0x00, 0x08, 0x1C, 0x26, 0x43, 0x81, 0xFF}; //delta
    gfx_SetCharData(1, char_data);
    gfx_SetCharData(2, char_data2);

    gfx_FillScreen(0);
    gfx_SetTextTransparentColor(2);
    gfx_SetTextFGColor(255);
    gfx_SetTextBGColor(6);

    /*
    0x39, 0x45, 0x82, 0x82, 0x82, 0x83, 0x45, 0x39, // Char 000 (.)
    0x00, 0x00, 0x08, 0x1C, 0x26, 0x43, 0x81, 0xFF, // Char 001 (.)
    */
    gfx_SetPalette(global_palette, sizeof_global_palette, 0);

    printCentered("\x01   \x02", 80);
    while(!os_GetCSC());
}

This is the screenshot. The first one is alpha and the second one is delta. As you can see, they look like nothing I expected. The delta looks like a 😊 and alpha looks weird. When I use the font editor you gave me, it looked normal.



Your issue is probably that you're declaring the font data as an integer, not an array.

Try doing this instead:

Code:
    uint8_t char_data[] = {0x39, 0x45, 0x82, 0x82, 0x82, 0x83, 0x45, 0x39}; // Bitmap for "alpha"
    uint8_t char_data2[] = {0x00, 0x00, 0x08, 0x1C, 0x26, 0x43, 0x81, 0xFF}; //delta
OHHHHHH. I thought it was weird. When I copied it I was wondering how an array fit into a uint8_t . I guess I shouldn't blindly copy code.
Hum... why does the program change the colors in the palette? is it to accommodate new colors?
Yolomep wrote:
Hum... why does the program change the colors in the palette? is it to accommodate new colors?

What on earth do you think a palette is.
Idk I thought they would just find the colors in the palette instead of changing them.
Yolomep wrote:
Idk I thought they would just find the colors in the palette instead of changing them.

??????????????
Whenever you use gfx_SetPalette, it overwrites the previous palette, as the palette has a maximum size of 256, and the default palette uses all 256 entries. You'll need to add any colors you want to use to the custom palette using fixed-entries in convimg.
Ok. I have two questions this time. One is more opinion based though.
First question: How do you remove text on the graph screen? So you know how you can draw text with gfx_PrintStringXY() something right? How would you remove what you wrote? I think spaces are transparent. What I'm currently doing is what I've done before in other languages, draw a white/background color box where the text was. Is this how you are supposed to do it? Sometimes I don't know the width of the box, I just increase it until it matches. The text width in the array I posted before was in pixels right? So I can base it off of that right? Also, a space should be 2 pixels IIRC?

Second question. I designed two fonts for alpha. One looks skinny and looks sorta like the alpha I saw in a pixel font thing 'α:'. Another one looks more like 'σ.' its more fatter. I just want your opinion on which one I should choose.
Picture for reference. Text: 'α: σ.'


If you guys want to use the fonts in your own program, the code is here:

Code:

uint8_t char_data[] = {0x39, 0x45, 0x82, 0x82, 0x82, 0x83, 0x45, 0x39}; //α:
uint8_t char_data3[] = {0x3A, 0x7E, 0xC4, 0xC4, 0xC4, 0xCD, 0x7F, 0x32}; //σ.
Spaces are filled with the text background color, which defaults to transparent. You can just fill a rectangle with the actual background color you want to delete any area of text.
jacobly wrote:
Spaces are filled with the text background color, which defaults to transparent. You can just fill a rectangle with the actual background color you want to delete any area of text.


So basically what I'm doing now. Your thoughts on the alphas?
Sometimes you want to redraw the entire frame, other times you just want to draw a rectangle over the text. It really just depends on your use case. You can use gfx_GetStringWidth() to determine the width of the rectangle.

As for which looks better, you may want to see what they look like when used in context with whatever text will be around it.
Hey! Back with another question. This time its about timer. You told me to use the timer thing. Anyways, I tried using timer_Get(1) with what I assume is the 32 hz timer. That's 32 cycles a second right?
This is the code I used to enable the timer:

Code:

timer_Enable(1, TIMER_32K, TIMER_NOINT, TIMER_UP);

Does this mean the timer should increase by 32 every second? Sorry for being a noob. I tried this idea and it would increase by about a thousand every second. Is the timer in milliseconds? I just want to know how many ticks per second. I feel like there is an obvious answer, but anything I search isn't coming up and the docs just show me how to use it. I'm using CEmu at the moment, would that change something? The emulation speed is 100% so I don't think it would matter.
  
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
Page 1 of 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

 

Advertisement