r/raylib • • Jan 15 '24

Vector2Normalize not found

Post image

im trying to normalize a direction vector, but it doesnt exist and thinks i mean colornormalize i installed raylib using the cmake option and i set my sublime-build file right. and i didnt misspell the normalize function i dont think...

4 Upvotes

16 comments sorted by

5

u/bnl1 Jan 15 '24

That function lives in raymath.h, did you import it?

1

u/Enter_The_Void6 Jan 15 '24

oh... im probably dumb. let me check rq

3

u/Enter_The_Void6 Jan 15 '24

Yup it worked, thank you sooo very much :D

2

u/Familiar_Ad_8919 Jan 16 '24

u would assume people in this community know how to screenshot

1

u/Enter_The_Void6 Jan 16 '24

cant my computer does not have a screenshot program installed nor do i have wifi.

1

u/[deleted] Jan 19 '24

Literally just type "screenshot" in windows research bar bruh

Or copy and paste your code which is much better than a screenshot

1

u/Enter_The_Void6 Jan 19 '24

i do not have windows, nor wifi like i said.

2

u/[deleted] Jan 19 '24

omg the task bar looked like windows lol

1

u/Enter_The_Void6 Jan 19 '24

kde plasma, really nice polished feel tbh.

6

u/lawrencewil1030 Jan 15 '24

Try adding #include <raymath.h> to the top of the file

5

u/Potential-Adagio-512 Jan 15 '24

dont use == true. == true returns the same bool you’re comparing against. just say if(cond)

4

u/Geaxle Jan 16 '24

Why not? For readability some people prefer explicitly writing == true or == false.

2

u/NoZookeepergame3308 Jan 17 '24

there's nothing wrong with it in C any non zero value is true, for what I believe and my understanding here, the expression if(IsKeyPressed(KEY_A) == true) is being evaluating twice, first the "if is pressed " then, "if the value is true",. to my point is that is not needed and is redundant, please someone correct if I'm wrong.

2

u/[deleted] May 26 '24

No, the compiler is smart enough to know not to evaluate it twice.

I know it's been 4 months I don't care.

1

u/NoZookeepergame3308 Jun 16 '24 edited Jun 16 '24

you're right the compiler is smart enough to know that and probably better at optimizing it too!, it's mostly on how someone is able to read and write code more likely, which is fine, if the source code it's clear for you & your team ! congrats, don't mind how old this post is , have a good day .

2

u/bob16795 Jan 18 '24

In the defence of == true, not only can it look cleaner to some people, but it'll likely be optimized out by the compiler if your not using -O0. Unrelated but simmilar I cought a friend of mine switching on a bool recently, I have nightmares to this day.