Jypeli  9
The simple game programming library
Appearance.cs
Siirry tämän tiedoston dokumentaatioon.
1 #region MIT License
2 /*
3  * Copyright (c) 2009 University of Jyväskylä, Department of Mathematical
4  * Information Technology.
5  *
6  * Permission is hereby granted, free of charge, to any person obtaining a copy
7  * of this software and associated documentation files (the "Software"), to deal
8  * in the Software without restriction, including without limitation the rights
9  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10  * copies of the Software, and to permit persons to whom the Software is
11  * furnished to do so, subject to the following conditions:
12  *
13  * The above copyright notice and this permission notice shall be included in
14  * all copies or substantial portions of the Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22  * THE SOFTWARE.
23  */
24 #endregion
25 
26 /*
27  * Authors: Tero Jäntti, Tomi Karppinen, Janne Nikkanen.
28  */
29 
30 
31 namespace Jypeli
32 {
33  public partial class GameObject
34  {
35  private Color _color = Color.White;
36  private bool _textureFillsShape = false;
37  private Vector _textureWrapSize = new Vector( 1, 1 );
38 
42  [Save]
43  public bool IsVisible { get; set; }
44 
48  public override Animation Animation { get; set; }
49 
54  [Save]
56  {
57  get { return _textureWrapSize; }
58  set { _textureWrapSize = value; }
59  }
60 
64  public virtual Color Color
65  {
66  get { return _color; }
67  set { _color = value; }
68  }
69 
80  public bool TextureFillsShape
81  {
82  get { return _textureFillsShape; }
83  set { _textureFillsShape = value; }
84  }
85 
90  public bool IgnoresLighting { get; set; }
91 
92  private void InitAppearance()
93  {
94  this.IsVisible = true;
95  }
96 
97  private void InitAppearance( Animation animation )
98  {
99  this.Animation = animation;
100  InitAppearance();
101  }
102 
103 #if !DISABLE_STORAGE
104  public void SetImage( StorageFile file )
109  {
110  this.Image = Image.FromStream( file.Stream );
111  }
112 #endif
113 
117  public void MirrorImage()
118  {
120  }
121 
125  public void FlipImage()
126  {
128  }
129  }
130 }
Jypeli.StorageFile
Tiedosto.
Definition: StorageFile.cs:17
Jypeli.GameObject.TextureWrapSize
Vector TextureWrapSize
Määrittää kuinka moneen kertaan kuva piirretään. Esimerkiksi (3.0, 2.0) piirtää kuvan 3 kertaa vaakas...
Definition: Appearance.cs:56
Jypeli.GameObject.FlipImage
void FlipImage()
Kääntää olion kuvan pystysuunnassa.
Definition: Appearance.cs:125
Jypeli.GameObject._color
Color _color
Definition: Appearance.cs:35
Jypeli.Vector.X
double X
Definition: Vector.cs:312
Jypeli.StorageFile.Stream
Stream Stream
Definition: StorageFile.cs:19
Jypeli.GameObject.SetImage
void SetImage(StorageFile file)
Lataa kuvan tiedostosta ja asettaa sen oliolle.
Definition: Appearance.cs:108
Jypeli.GameObject._textureWrapSize
Vector _textureWrapSize
Definition: Appearance.cs:37
Jypeli
Definition: Automobile.cs:5
Jypeli.GameObject.InitAppearance
void InitAppearance(Animation animation)
Definition: Appearance.cs:97
Jypeli.GameObject.TextureFillsShape
bool TextureFillsShape
Jos true, kuva piirretään niin, ettei se mene olion muodon ääriviivojen yli. Toisin sanoen kuva piirr...
Definition: Appearance.cs:81
Jypeli.GameObject.IsVisible
bool IsVisible
Piirretäänkö oliota ruudulle.
Definition: Appearance.cs:43
Jypeli.GameObject.InitAppearance
void InitAppearance()
Definition: Appearance.cs:92
Jypeli.Animation
Sarja kuvia, jotka vaihtuvat halutulla nopeudella. Yksi animaatio koostuu yhdestä tai useammasta kuva...
Definition: Animation.cs:62
Jypeli.Color
Väri.
Definition: Color.cs:13
Jypeli.GameObject._textureFillsShape
bool _textureFillsShape
Definition: Appearance.cs:36
Jypeli.Image
Kuva.
Definition: Image.cs:29
Jypeli.Vector
2D-vektori.
Definition: Vector.cs:59
Jypeli.GameObject.MirrorImage
void MirrorImage()
Kääntää olion kuvan vaakasuunnassa.
Definition: Appearance.cs:117
Jypeli.Image.FromStream
static Image FromStream(Stream stream)
Lataa kuvan tiedostovirrasta.
Definition: Image.cs:664
Jypeli.GameObject
Pelialueella liikkuva olio. Käytä fysiikkapeleissä PhysicsObject-olioita.
Definition: Appearance.cs:34
Jypeli.Color.White
static readonly Color White
Valkoinen.
Definition: Color.cs:903
Jypeli.GameObject.IgnoresLighting
bool IgnoresLighting
Jättääkö olio kentän valaistuksen huomiotta. Asetettu oletuksena käyttöliittymäkomponenteilla (widget...
Definition: Appearance.cs:90
Jypeli.Vector.Y
double Y
Definition: Vector.cs:313