#Can we show changing texts in the windows?

63 messages ยท Page 1 of 1 (latest)

coarse owl
#

you can use CheckCollisionCircleRec to determine when the ball hits the paddle

coarse owl
coarse owl
coarse owl
#

thks

#

how can i use vectors? Cause that means i would have or change everything

#

this functions needs a vector and a rectangle variables

#

and also how do i use rectangles ?

coarse owl
#

yeah i know about structs

coarse owl
#

It is two floats, x and y

#

oh okay

#

sounds simple on paper

#

It shouldn't need explanation beyond that

#

Have you opened raylib.h?

#

the file itself ?

#

Yeah

#

nah i'm just using it in this project

#

i haven't opened it

#

Well you should

#

It's documentation

#

lemme check that then

#

thanks

coarse owl
#

Can we show changing texts in the windows?

#

Okay so i have a question. Now that my program is working, i made a score system. But all the draw text functions have const char*. Isn't there a way to show the score that is changing

#

TextFormat("score: %d", score)

#

or sprintf

#

oh okay

#

thks again i guess

coarse owl
#

oh its about pointers? i will read it in the raylib.h

coarse owl
coarse owl
#

char* <- this is a pointer type

#

you know that, right?

#

wait you cannot change the value of a const char with a pointer, can you ?

#

i know its a pointer but the const char cant be change.

#

you can change the value of the pointer but you can't write anything through the pointer

#

ohh thats broken

#

const is kind of useless tbh

#

yeah ๐Ÿคฃ

#

it doesn't help that you can cast the const away and write to it anyway

#

if you wanted both then that would be const char* const

#

this is "a pointer that can't be reassigned and can't be written through"

#

so by using a pointer you can change the value of the const char without passing the char itself

#

No

#

C has a (crappy) string convention of null-terminated string

#

you should read about it

#

i didn't know about it damn

#

the pointer is pointing to some memory, that contains an "array of chars", ending with a 0 byte

#

so you dont really change the const char then ? only the pointer

#

no that's just how you pass a string
it's const to indicate to programmers that it doesn't modify the "chars" the string is pointing to, it just draws the string

#

read this
(it's important, and basic)

#

yeah thanks because i didn't know anything about this

#

I try to avoid the standard C "pointer to null terminated char array" when I can
This isn't one of those cases

#

okay i will try on a small file to see if i understand

sterile coral
sterile coral
#
    const char* dog = "Dog"; // Pointer to constant char
    const char* cat = "Cat";
    char* const horse = "Horse"; // Constant pointer to char
    const char* const sheep = "Sheep"; // Constant pointer to constant char
    char* cow = "Cow";
    // These are valid.
    cat = dog;
    cow = horse;
    dog = (char*)sheep;
    // And you can draw them all.
    DrawText( cat, 20, 20, 20, RED );
    DrawText( cow, 20, 50, 20, RED );
    DrawText( dog, 20, 80, 20, RED );
coarse owl
#

Thks i already resolved the problem. I used a const char pointer and i changed it with the TextForm function

#

I don't remember exactly, you can go check out my github nblstrue