So, long story short: I started using "devkitPro", which is a C++ library, however I never coded with C++ before, but I did with C#, which is pretty similar to, so I started learning a little about C++, tried to code a prototype button class, created a boolean method that would return true if the clicked area was colliding with it, then I recieved this error when I tried to compile the code I wrote.
So as normally, I did what every person would do after seeing a error: I google it. Apparentaly this error is caused because of syntax mistake. So far, so good, had dealt with it before, not too much of a problem. However, the problem is that the error points to a goddamn "}", that if I remove will cause another error because the "}" is required to end a method. I tried and tried many different ways to solve this but I simply can't find the problem. Here is the script with the problem (error points to line 20)
#include <nds.h>
#include <nds/arm9/video.h>
#include <nds/arm9/sprite.h>
#include <stdio.h>
#include <string>
using namespace std;
class Button{
public:
string name;
uint posX;
uint posY;
uint sizX;
uint sizY;
bool show;
bool pressed(uint touchX, uint touchY)
{
return (show == true && posX + sizX > touchX && posY + sizY > touchY && posX < touchX + 1 && posY < touchY + 1);
} //the error message points to this line
}
Or more expecificaly this part of the code
bool pressed(uint touchX, uint touchY)
{
return (show == true && posX + sizX > touchX && posY + sizY > touchY && posX < touchX + 1 && posY < touchY + 1);
} //the error points to this line
So uh... anyone have any idea of what is wrong here. Thanks. I don't know much about C++ and all I know is because is similar to C#.
(Unrelated but, what is so special about the string variable type that it needs its own namespace to work propely?)
I tried to code a boolean method that returns true or false depending if your mouse cursor is colling with it, but I couldn't exactly see if it works or not because of an error I don't understand what exactly is causing.