我正在尝试使用Allegro在C ++中创建一个游戏,我创建了一个简单的Rectangle类,但它似乎在我的主程序中超出范围,我有:
#include "stdafx.h"
#ifndef __VECTOR2_H
#define __VECTOR2_H
using namespace std;
struct Vector2
{
public:
float X,Y;
Vector2() { }
Vector2(const Vector2&) { }
Vector2(const float& x, const float& y) : X(x), Y(y) { }
~Vector2( ) { }
Vector2 operator+(const Vector2& v);
Vector2 operator-(const Vector2& v);
};
#endif
#include "Vector2.h"
#ifndef __RECTANGLE_H_
#define __RECTANGLE_H_
using namespace std;
class Rectangle
{
public:
Rectangle() { }
Rectangle(const Rectangle& r);
Rectangle(const float& x,const float& y,const float& h,const float& w);
~Rectangle() { }
void SetPosX(const float& x);
void SetPosY(const float& y);
void SetHeight(const float& h);
void SetWidth(const float& w);
bool Intersects(const Rectangle* r);
Vector2* GetIntersection(const Rectangle* r);
float x,y,w,h;
};
#endif
#include "stdafx.h"
#include "Rectangle.h"
using namespace std;
// Other functions...
void myDraw(ALLEGRO_BITMAP* texture, Rectangle source, Rectangle dest, ALLEGRO_COLOR tint, Vector2 scale, float angle, int flags) //<-- This is where the error message points
{
al_draw_tinted_scaled_rotated_bitmap_region(texture,
source.x, source.y, source.w, source.h,
tint,
dest.x, dest.x, dest.w, dest.h,
scale.X, scale.Y,
angle, flags);
return;
}
帮助?
我得到的具体错误是 main.cpp(147):错误C2061:语法错误:标识符'矩形'