1
0
forked from 0ad/0ad

no message

This was SVN commit r1101.
This commit is contained in:
Gee 2004-09-02 03:05:16 +00:00
parent bddabc48f8
commit 6b384432e0
4 changed files with 45 additions and 41 deletions

View File

@ -1,4 +1,4 @@
// $Id: JSInterface_IGUIObject.cpp,v 1.10 2004/08/14 11:23:38 philip Exp $
// $Id: JSInterface_IGUIObject.cpp,v 1.11 2004/09/02 03:03:13 gee Exp $
#include "precompiled.h"
@ -165,6 +165,8 @@ JSBool JSI_IGUIObject::getProperty(JSContext* cx, JSObject* obj, jsval id, jsval
break;
}
// TODO Gee: (2004-09-01) EAlign and EVAlign too.
default:
JS_ReportError(cx, "Setting '%s' uses an unimplemented type", propName.c_str());
assert(! "This shouldn't happen");
@ -309,6 +311,8 @@ JSBool JSI_IGUIObject::setProperty(JSContext* cx, JSObject* obj, jsval id, jsval
break;
}
// TODO Gee: (2004-09-01) EAlign and EVAlign too.
default:
JS_ReportError(cx, "Setting '%s' uses an unimplemented type", propName.c_str());
break;

View File

@ -27,31 +27,31 @@ COverlay::~COverlay()
/*************************************************************************/
CRect::CRect() :
left(0), top(0), right(0), bottom(0)
left(0.f), top(0.f), right(0.f), bottom(0.f)
{
}
CRect::CRect(const CPos &pos) :
left(pos.x), top(pos.y), right(pos.x), bottom(pos.y)
left((float)pos.x), top((float)pos.y), right((float)pos.x), bottom((float)pos.y)
{
}
CRect::CRect(const CSize &size) :
left(0), top(0), right(size.cx), bottom(size.cy)
left(0.f), top(0.f), right((float)size.cx), bottom((float)size.cy)
{
}
CRect::CRect(const CPos &upperleft, const CPos &bottomright) :
left(upperleft.x), top(upperleft.y), right(bottomright.x), bottom(bottomright.y)
left((float)upperleft.x), top((float)upperleft.y), right((float)bottomright.x), bottom((float)bottomright.y)
{
}
CRect::CRect(const CPos &pos, const CSize &size) :
left(pos.x), top(pos.y), right(pos.x+size.cx), bottom(pos.y+size.cy)
left((float)pos.x), top((float)pos.y), right((float)(pos.x+size.cx)), bottom((float)(pos.y+size.cy))
{
}
CRect::CRect(const int32_t &_l, const int32_t &_t, const int32_t &_r, const int32_t &_b) :
CRect::CRect(const float &_l, const float &_t, const float &_r, const float &_b) :
left(_l), top(_t), right(_r), bottom(_b)
{
}
@ -101,13 +101,13 @@ CRect CRect::operator + (const CRect& a) const
// +
CRect CRect::operator + (const CPos& a) const
{
return CRect(left+a.x, top+a.y, right+a.x, bottom+a.y);
return CRect(left+(float)a.x, top+(float)a.y, right+(float)a.x, bottom+(float)a.y);
}
// +
CRect CRect::operator + (const CSize& a) const
{
return CRect(left+a.cx, top+a.cy, right+a.cx, bottom+a.cy);
return CRect(left+(float)a.cx, top+(float)a.cy, right+(float)a.cx, bottom+(float)a.cy);
}
// -
@ -119,13 +119,13 @@ CRect CRect::operator - (const CRect& a) const
// -
CRect CRect::operator - (const CPos& a) const
{
return CRect(left-a.x, top-a.y, right-a.x, bottom-a.y);
return CRect(left-(float)a.x, top-(float)a.y, right-(float)a.x, bottom-(float)a.y);
}
// -
CRect CRect::operator - (const CSize& a) const
{
return CRect(left-a.cx, top-a.cy, right-a.cx, bottom-a.cy);
return CRect(left-(float)a.cx, top-(float)a.cy, right-(float)a.cx, bottom-(float)a.cy);
}
// +=
@ -140,19 +140,19 @@ void CRect::operator +=(const CRect& a)
// +=
void CRect::operator +=(const CPos& a)
{
left += a.x;
top += a.y;
right += a.x;
bottom += a.y;
left += (float)a.x;
top += (float)a.y;
right += (float)a.x;
bottom += (float)a.y;
}
// +=
void CRect::operator +=(const CSize& a)
{
left += a.cx;
top += a.cy;
right += a.cx;
bottom += a.cy;
left += (float)a.cx;
top += (float)a.cy;
right += (float)a.cx;
bottom += (float)a.cy;
}
// -=
@ -167,34 +167,34 @@ void CRect::operator -=(const CRect& a)
// -=
void CRect::operator -=(const CPos& a)
{
left -= a.x;
top -= a.y;
right -= a.x;
bottom -= a.y;
left -= (float)a.x;
top -= (float)a.y;
right -= (float)a.x;
bottom -= (float)a.y;
}
// -=
void CRect::operator -=(const CSize& a)
{
left -= a.cx;
top -= a.cy;
right -= a.cx;
bottom -= a.cy;
left -= (float)a.cx;
top -= (float)a.cy;
right -= (float)a.cx;
bottom -= (float)a.cy;
}
int32_t CRect::GetWidth() const
float CRect::GetWidth() const
{
return right-left;
}
int32_t CRect::GetHeight() const
float CRect::GetHeight() const
{
return bottom-top;
}
CSize CRect::GetSize() const
{
return CSize(right-left, bottom-top);
return CSize((int)right-left, (int)bottom-top);
}
CPos CRect::TopLeft() const
@ -204,12 +204,12 @@ CPos CRect::TopLeft() const
CPos CRect::BottomRight() const
{
return CPos(right, right);
return CPos((int)right, (int)right);
}
CPos CRect::CenterPoint() const
{
return CPos((left+right)/2, (top+bottom)/2);
return CPos(int((left+right)/2.f), int((top+bottom)/2.f));
}
bool CRect::PointInside(const CPos &point) const

View File

@ -47,10 +47,10 @@ class CSize;
* @author Gustav Larsson
*
* Rectangle class used for screen rectangles. It's very similiar to the MS
* CRect, but be aware it is not identical.
* Works with CPos.
* @see CSize
* @see CPos
* CRect, but with FLOATS because it's meant to be used with OpenGL which
* takes float values.
*
* Changed to floats 2004-08-31 /GL
*/
class CRect
{
@ -60,7 +60,7 @@ public:
CRect(const CSize &size);
CRect(const CPos &upperleft, const CPos &bottomright);
CRect(const CPos &pos, const CSize &size);
CRect(const int32_t &_l, const int32_t &_t, const int32_t &_r, const int32_t &_b);
CRect(const float &_l, const float &_t, const float &_r, const float &_b);
// Operators
void operator = (const CRect& a);
@ -86,12 +86,12 @@ public:
/**
* @return Width of Rectangle
*/
int32_t GetWidth() const;
float GetWidth() const;
/**
* @return Height of Rectangle
*/
int32_t GetHeight() const;
float GetHeight() const;
/**
* Get Size
@ -128,7 +128,7 @@ public:
/**
* Dimensions
*/
int32_t left, top, right, bottom;
float left, top, right, bottom;
};
/**

View File

@ -166,7 +166,7 @@ bool CParserValue::GetDouble(double &ret)
// Check if a digit is found
if (m_String[i] >= '0' && m_String[i] <= '9')
{
double exp = DecimalPos-i; // disambiguate pow() argument type
double exp = (int)(DecimalPos-i); // disambiguate pow() argument type
TempRet += (m_String[i]-'0')*pow(10.0,exp);
}
// It will accept and ending f, like 1.0f