Ok will check. IT says C11
There is some more helpful information at link, but you should be open to and read multiple books to get a more solid foundation of the language, as that guide is fairly outdated, also allowing yourself to skip around books to find what is most helpful, is significantly more helpful (in my experience) for learning rather than reading through strictly in order
I have that one. The one you gave is funny.🤭
Can some1 do me a humongous favor and make me a 16x16 subway surfers icon?
Sure:


In the meantime try to get yourself to do these things instead of asking other people for something you can easily do.
Does project builder convert png files to an icon on C?

What should I do now?
Here is another pic.
One more thing.

Code:
/* Hello world program */

#include <tice.h>

int main(void)
{
    printf("Hello, World!\n");  // Actually do the work here
}
What about your code? I don't see anything wrong with it.
I don't know if I'm helping or hurting by giving you the answer, but I threw this together with a lot of comments to hopefully help your understanding.


Code:

#include <tice.h>   //  <--  include needed for the TI keyboard functions
#include <stdio.h>  //  <--  include needed for the printf function

int main(void)
{
    printf("Hello, World!");    //  Print your message for the world

    //  Wait for a key to be pressed so you actually see
    //  the message before the program exits.
    //
    //  This is a little tricky because the function
    //  you use to tell if a key is pressed returns
    //  0 if no key is pressed.  By using The ! you
    //  are saying keep looping as long as os_GetCSC()
    //  returns 0
    while (!os_GetCSC());

    return 0;   //  Return 0 by convention to indicate success
}
Explanation of functions in C.

Functions in C have to be defined before being used.
To define a function you need a return type and arguments that each have a type.
Imagine I have a store that has an accepts cookies and returns dollars sign outside.
Now imagine you have a box of cookies and you want something for it.
If my sign only said accepts cookies then you wouldn't know how to carry what I am going to give.
What if inside I was going to give you a boat for the cookies> What if it was going to be a feather? What if it was nothing at all?
Now for your sanity the law says I Have to say what I am going to give back. Now does it seem like that law is important? And also imagine the other way around where I don't say what I am accepting.
This is why functions have to specify a return type and the type of each of their arguments.
Example:
Code:

int square(int a) {
    return a * a;
}

And if you want a function to return or accept nothing you use void.
Example:

Code:

void hello(char *s name) { // for now just think of char * as the string type
    printf("Hello %s",name);
}
int random(void) {
    return 5; //not that random
}

You might be wondering, if every function has to be defined then how is printf defined.
Functions like printf come from other libraries.
For example printf comes from <stdio.h> and os_GetCSC comes from tice.h.
To use these functions you have to include their respective libraries.
Example:
Good

Code:

#include <stdio.h>

int main(void) {
    printf("hello world");
    return 0;
}

Bad

Code:

//look, there is no include

int main(void) {
    printf("hello world");
    return 0;
}

Also // comment is for a single line comment and /* comment */ for multiple or single.
dsteffen wrote:


Code:

#include <tice.h>   //  <--  include needed for the TI keyboard functions
#include <stdio.h>  //  <--  include needed for the printf function

int main(void)
{
    printf("Hello, World!");    //  Print your message for the world

    //  Wait for a key to be pressed so you actually see
    //  the message before the program exits.
    //
    //  This is a little tricky because the function
    //  you use to tell if a key is pressed returns
    //  0 if no key is pressed.  By using The ! you
    //  are saying keep looping as long as os_GetCSC()
    //  returns 0
    while (!os_GetCSC());

    return 0;   //  Return 0 by convention to indicate success
}

Thank you this made it pretty clear.
sumde2 wrote:
Sure:

.

I cant open imgur because my filter doesnt let.
calcgeek wrote:
Does project builder convert png files to an icon on C?


Do I need to write some code in the convimg.yaml part of the project?
Another question I have is; What would I write for the up key in C and also the down key in C?
Ok everyone I have done the icon and will continue learning C in depth. I will continue with this project as I go.
Ok for merth

Code:
#include <tice.h>
#include <graphx.h>
#include <keypadc.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define SCREEN_WIDTH 320
#define SCREEN_HEIGHT 240

void drawBackground(void) {
    gfx_SetColor(0);
    gfx_FillScreen(0);

    // Bright neon sky gradient
    for (int y = 0; y < 100; y++) {
        int color = 128 + (y / 12);
        gfx_SetColor(color);
        gfx_HorizLine(0, y, SCREEN_WIDTH);
    }

    // Dark ground
    gfx_SetColor(16);
    gfx_FillRectangle(0, 100, SCREEN_WIDTH, 140);
}

void drawTrain(void) {
    // ===== MAIN BODY (TALL & NARROW) =====
    gfx_SetColor(200);
    gfx_FillRectangle(110, 100, 100, 85);
    gfx_SetColor(255);
    gfx_Rectangle(110, 100, 100, 85);

    // Dark stripe at top
    gfx_SetColor(51);
    gfx_FillRectangle(115, 100, 90, 10);

    // ===== ROOF DETAIL =====
    gfx_SetColor(180);
    gfx_FillRectangle(110, 98, 100, 2);

    // ===== THREE LARGE WINDOWS (STACKED VERTICALLY) =====
    // Top window
    gfx_SetColor(16);
    gfx_FillRectangle(120, 112, 80, 12);
    gfx_SetColor(180);
    gfx_FillRectangle(125, 115, 70, 8);

    // Middle window
    gfx_SetColor(16);
    gfx_FillRectangle(120, 128, 80, 12);
    gfx_SetColor(180);
    gfx_FillRectangle(125, 131, 70, 8);

    // Bottom window
    gfx_SetColor(16);
    gfx_FillRectangle(120, 144, 80, 12);
    gfx_SetColor(180);
    gfx_FillRectangle(125, 147, 70, 8);

    // ===== HEADLIGHTS =====
    gfx_SetColor(226);
    gfx_FillCircle(115, 108, 5);
    gfx_FillCircle(205, 108, 5);
    gfx_SetColor(255);
    gfx_FillCircle(115, 108, 2);
    gfx_FillCircle(205, 108, 2);
}

void drawTitle(void) {
    gfx_SetTextScale(3, 3);
    gfx_SetColor(206);
    gfx_PrintStringXY("SUBWAY", 90, 15);
    gfx_SetColor(141);
    gfx_PrintStringXY("SURFERS", 85, 35);

    gfx_SetTextScale(1, 1);
    gfx_SetColor(226);
    gfx_PrintStringXY(">> CE <<", 135, 55);
}

void drawMenuButton(int x, int y, int width, int height, const char *text, int selected) {
    if (selected) {
        // Selected: bright neon colors
        gfx_SetColor(206);
        gfx_FillRectangle(x - 3, y - 3, width + 6, height + 6);
        gfx_SetColor(141);
        gfx_FillRectangle(x, y, width, height);
        gfx_SetColor(255);
    } else {
        // Unselected: darker colors
        gfx_SetColor(16);
        gfx_FillRectangle(x, y, width, height);
        gfx_SetColor(200);
    }

    gfx_Rectangle(x, y, width, height);

    gfx_SetTextScale(1, 1);
    gfx_PrintStringXY(text, x + 10, y + 8);
}

void drawMenuBackground(void) {
    // Semi-transparent dark overlay - lighter so train shows through
    gfx_SetColor(40);
    for (int i = 0; i < 3; i++) {
        gfx_FillRectangle(0, 130 + (i * 35), SCREEN_WIDTH, 28);
    }
}

int main(void) {
    gfx_Begin();
    gfx_SetDrawBuffer();

    int selected = 0;
    int numOptions = 3;
    uint8_t prevKeys = 0;

    while (1) {
        drawBackground();
        drawTrain();
        drawTitle();
        drawMenuBackground();

        const char *options[] = {"PLAY GAME", "SETTINGS", "EXIT"};

        for (int i = 0; i < numOptions; i++) {
            int y = 140 + (i * 35);
            drawMenuButton(70, y, 180, 28, options[i], (i == selected));
        }

        gfx_SetTextScale(1, 1);
        gfx_SetColor(206);
        gfx_PrintStringXY("UP/DOWN | CLEAR exit", 100, 235);

        gfx_SwapDraw();

        kb_Scan();
        uint8_t currKeys = kb_Data[6];

        if ((currKeys & kb_Up) && !(prevKeys & kb_Up)) {
            selected--;
            if (selected < 0) selected = numOptions - 1;
        }

        if ((currKeys & kb_Down) && !(prevKeys & kb_Down)) {
            selected++;
            if (selected >= numOptions) selected = 0;
        }

        if ((currKeys & kb_Clear) && !(prevKeys & kb_Clear)) {
            break;
        }

        prevKeys = currKeys;
    }

    gfx_End();
    return 0;
}
So yesterday I added an Icon to my project, and I also made that the arrow keys are the keys that scroll the menu. Now I am working making the clear button exit the program. Hope you guys like it. To open the above link you need a TI-Planet account.
A very big thanks to Adriweb for tolerating me bothering him nonstop about why i have problems with project builder, and he helped me nonstop, so kudos to Adriweb.
AI can really help you learn C, but you need to learn C to help AI help you. It needs to be handheld and guided. It can suggest things, but you always need to audit the results.

An easy way to learn C is with Borland Turbo C 1 for DOS. Just install FreeDOS on a USB drive (or use DOSBOX) and go to town. It has the easiest gfx library around.

Once you learn that, you can move to other compilers such as GCC or Open Watcom with relative ease. Just remember to work really hard and push things as far as you can before consulting AI, forums, or Discord. Also don't be afraid to ask questions when you're truly stuck.

Open Watcom is cool because the same code can target DOS, Windows, and Linux. LMK if gfx routines are needed for Linux...

Try to take breaks to avoid burnout. You don't want to waste AI resources or peoples time on forums asking things that you didn't take the time to research because of burnout.
lucidapogee wrote:
AI can really help you learn C, but you need to learn C to help AI help you. It needs to be handheld and guided. It can suggest things, but you always need to audit the results.

An easy way to learn C is with Borland Turbo C 1 for DOS. Just install FreeDOS on a USB drive (or use DOSBOX) and go to town. It has the easiest gfx library around.

Once you learn that, you can move to other compilers such as GCC or Open Watcom with relative ease. Just remember to work really hard and push things as far as you can before consulting AI, forums, or Discord. Also don't be afraid to ask questions when you're truly stuck.

Open Watcom is cool because the same code can target DOS, Windows, and Linux. LMK if gfx routines are needed for Linux...

Try to take breaks to avoid burnout. You don't want to waste AI resources or peoples time on forums asking things that you didn't take the time to research because of burnout.

This is probably the worst take I've ever heard
lucidapogee wrote:
Try to take breaks to avoid burnout. You don't want to waste AI resources or peoples time on forums asking things that you didn't take the time to research because of burnout.

Thanks I was just doing that, but now I am back with a vengeance lol.
lucidapogee wrote:
Open Watcom is cool because the same code can target DOS, Windows, and Linux. LMK if gfx routines are needed for Linux...

I only have a mac so what should I do?

I am looking for an artist to partner up with me for making the sprites and tilesets. I f you can help me please do.
MateoConLechuga wrote:
This is probably the worst take I've ever heard

This is probably unnecessarily harsh
Thank you to Iambian for so many stuff. I have gotten help from him in most of my projects, either with him knowing or without him knowing. Yesterday he helped me find a website where I can make tilesets for a tilemap. Here is a link to Pixilart, a website that Iambian found me. Yesterday I started working on the tilemap sprites, so I am making a lot of progress with this project. Thank you to everyone who is helping me!
Here is a pic of the sprites.

Please tell me if I should add more sprites to the basic Beta version of my game.
EDIT: Here is another pic with the sprites all lined up and fixed.

EDIT: And here is the tilemap so far.
should i make a map before i add it to my project or should i just add the tileset.
Here is a pic of the updated tileset.

And here is a map, for an example.

I want to know if I should make a map and then add it to the project or just add the tileset by itself without making a tilemap?
It doesn't really matter. If you add it before you have a tile map, you can write some code to test it, but you can also wait until you have a map and test it that way. It's really up to you.
  
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 3 of 5
» 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