Closed Vanny-Chuck closed 1 year ago
Hmmm, it might be because we added const
to them? https://github.com/RobLoach/raylib-cpp/commit/9e8b4487c3988161f5406740638415f20a151562
I'll check stack overflow & see if anybody else has same prob. Thanks for responding so quick!
I am using C++ 17 (Default is 14 I think), maybe that might be changing something.
Mind running the tests? There's a test case for this over at: https://github.com/RobLoach/raylib-cpp/blob/master/tests/raylib_cpp_test.cpp#L26
I don't have
and
perhaps this is the reason?
I just realized I've been using the C-based one. Sorry for the trouble.
Still having problems. Here is my code:
#include "C:\Users\super\OneDrive\Desktop\raylib-cpp-master\raylib-cpp-master\include\raylib-cpp.hpp"
#include "raylib.h"
int main() {
int screenWidth = 800;
int screenHeight = 450;
raylib::Window window(screenWidth, screenHeight, "raylib-cpp - basic window");
SetTargetFPS(60);
while (!window.ShouldClose())
{
BeginDrawing();
window.ClearBackground(RAYWHITE);
// raylib
Vector2 position = { 50, 50 };
Vector2 speed = { 10, 10 };
position.x += speed.x;
position.y += speed.y;
// raylib-cpp
raylib::Vector2 position(50, 50);
raylib::Vector2 speed(10, 10);
position += speed; // Addition assignment operator override.
EndDrawing();
}
return 0;
}```
What error do you run into? Looks like in this example, you're declaring position
twice. You'll want either the raylib C example there, or the raylib-cpp example there.
Oh my gosh, for some reason I tried it today & it worked!(yes i was declaring it twice, but that wasn't what the error was about.)
Are these operators pre-defined or am I doing something wrong? Here is my code if it helps: