 |
Jypeli
9
The simple game programming library
|
Siirry tämän tiedoston dokumentaatioon.
34 public partial class GameObject
57 if ( value.X < 0.0 || value.Y < 0.0 )
58 throw new ArgumentException(
"The size must be positive." );
90 get {
return Shape.GetType().Name; }
96 this._size =
new Vector( width, height );
105 Vector p = this.AbsolutePosition;
107 double pointX, pointY;
129 double x = 2 * ( pointX - pX ) / this.Width;
130 double y = 2 * ( pointY - pY ) / this.Height;
136 double x = pointX - pX;
137 double y = pointY - pY;
150 Vector p = this.AbsolutePosition;
155 if ( point.
X >= ( p.
X - Width / 2 )
156 && point.
X <= ( p.
X + Width / 2 )
157 && point.
Y >= ( p.
Y - Height / 2 )
158 && point.
Y <= ( p.
Y + Height / 2 ) )
return true;
169 if ( pointX >= ( pX - Width / 2 )
170 && pointX <= ( pX + Width / 2 )
171 && pointY >= ( pY - Height / 2 )
172 && pointY <= ( pY + Height / 2 ) )
return true;
186 Vector normal = (pos2 - pos1).Normalize();
191 if (ep < p1p || ep > p2p)
195 double en = this.AbsolutePosition.ScalarProjection(normal.
RightNormal);
196 return Math.Abs(en - pn) <= 0.5 * Math.Sqrt(this.Width * this.Width + this.Height * this.Height);
void UpdateChildSizes(Vector oldSize, Vector newSize)
Vector LeftNormal
Vasen normaali.
void RefreshLayout()
Päivittää lapsiolioiden paikat ja koot, jos widgetille on asetettu asettelija. Tätä metodia EI yleens...
string ShapeString
Olion muoto merkkijonona (kenttäeditorin käyttöön)
Vector RightNormal
Oikea normaali.
double ScalarProjection(Vector unitVector)
static Shape FromString(string shapeStr)
Luo muodon merkkijonosta, esim. "Circle"
bool IsInside(Vector point)
Onko piste p tämän olion sisäpuolella.
bool IsInsideChildren(Vector point)
virtual bool IsInside(double x, double y)
Onko piste muodon sisällä. Pisteen koordinaatiston origo on muodon keskellä. Muoto on kokoa 1x1 jos I...
void InitDimensions(double width, double height, Shape shape)
bool _layoutNeedsRefreshing
static readonly Angle Zero
Nollakulma.
bool IsInsideRect(Vector point)
Onko piste p tämän olion ympäröivän suorakulmion sisäpuolella.
static Vector FromLengthAndAngle(double length, double angle)
Luo vektorin pituuden ja kulman perusteella.
override Vector Size
Olion koko pelimaailmassa. Kertoo olion äärirajat, ei muotoa.
bool autoResizeChildObjects
abstract bool IsUnitSize
If true, the shape must be scaled by the size of the object that has the shape. Typically,...
bool IsBetween(Vector pos1, Vector pos2)
Onko peliolio kahden pisteen välissä
Suuntakulma (rajoitettu -180 ja 180 asteen välille) asteina ja radiaaneina. Tietoja kulmasta: http://...