Jypeli  9
The simple game programming library
Renderer.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 using System;
31 using Microsoft.Xna.Framework;
32 using Microsoft.Xna.Framework.Graphics;
33 
34 using XnaV2 = Microsoft.Xna.Framework.Vector2;
35 using XnaV3 = Microsoft.Xna.Framework.Vector3;
36 
37 
38 namespace Jypeli
39 {
47  public static class Renderer
48  {
52  static readonly VertexPositionTexture[] textureVertices = new VertexPositionTexture[]
53  {
54  new VertexPositionTexture( new XnaV3(-0.5f, 0.5f, 0), new XnaV2(0.0f, 0.0f) ),
55  new VertexPositionTexture( new XnaV3(-0.5f, -0.5f, 0), new XnaV2(0.0f, 1.0f) ),
56  new VertexPositionTexture( new XnaV3(0.5f, 0.5f, 0), new XnaV2(1.0f, 0.0f) ),
57  new VertexPositionTexture( new XnaV3(0.5f, -0.5f, 0), new XnaV2(1.0f, 1.0f) )
58  };
59 
63  static readonly Int16[] textureTriangleIndices = new short[]
64  {
65  0, 1, 2,
66  1, 3, 2
67  };
68 
69  public static bool LightingEnabled { get; set; }
70 
71  static readonly BlendState NoDrawingToScreenBufferBlendState = new BlendState
72  {
73  ColorWriteChannels = ColorWriteChannels.None,
74  };
75 
76  static readonly DepthStencilState drawShapeToStencilBufferState = new DepthStencilState
77  {
78  StencilEnable = true,
79  ReferenceStencil = 0,
80  StencilFunction = CompareFunction.Equal,
81  StencilPass = StencilOperation.IncrementSaturation,
82  };
83 
84  static readonly DepthStencilState drawAccordingToStencilBufferState = new DepthStencilState
85  {
86  StencilEnable = true,
87  ReferenceStencil = 1,
88  StencilFunction = CompareFunction.LessEqual,
89  StencilPass = StencilOperation.Keep,
90  };
91 
92  private static bool isDrawingInsideShape = false;
93  private static DepthStencilState currentStencilState = DepthStencilState.None;
94 
95  private static VertexPositionTexture[] MakeTextureVertices( Vector wrapSize )
96  {
97  VertexPositionTexture[] tempVertices = new VertexPositionTexture[textureVertices.Length];
98  for ( int i = 0; i < textureVertices.Length; i++ )
99  {
100  tempVertices[i].Position = textureVertices[i].Position;
101  }
102 
103  float px = MathHelper.Clamp( (float)wrapSize.X, -1, 1 );
104  float py = MathHelper.Clamp( (float)wrapSize.Y, -1, 1 );
105 
106  // Since the origin in texture coordinates is at upper left corner,
107  // but at center in an object's coordinates, we need to make some
108  // adjustments here. Also, this makes partial textures possible.
109  float left = -(float)Math.Sign( wrapSize.X ) / 2 + 0.5f;
110  float right = left + px;
111  float top = -(float)Math.Sign( wrapSize.Y ) / 2 + 0.5f;
112  float bottom = top + py;
113 
114  tempVertices[0].TextureCoordinate = new XnaV2( left, top );
115  tempVertices[1].TextureCoordinate = new XnaV2( left, bottom );
116  tempVertices[2].TextureCoordinate = new XnaV2( right, top );
117  tempVertices[3].TextureCoordinate = new XnaV2( right, bottom );
118 
119  return tempVertices;
120  }
121 
122  public static void DrawImage( Image texture, ref Matrix matrix, Vector wrapSize )
123  {
124  if ( wrapSize.X == 0 || wrapSize.Y == 0 ) return;
125 
126  var device = Game.GraphicsDevice;
127  var tempVertices = MakeTextureVertices( wrapSize );
128 
129  device.RasterizerState = RasterizerState.CullClockwise;
130 #if WINDOWS_PHONE
131  // The WP7 emulator interprets cullmodes incorectly sometimes.
132  device.RasterizerState = RasterizerState.CullNone;
133 #endif
134 
135  device.BlendState = BlendState.AlphaBlend;
136 
137  float wrapX = (float)Math.Abs( wrapSize.X );
138  float wrapY = (float)Math.Abs( wrapSize.Y );
139 
140  if ( wrapX <= 1 && wrapY <= 1 )
141  {
142  // Draw only once
143  DrawImageTexture( texture, matrix, device, tempVertices );
144  return;
145  }
146 
147  float wx = (float)( Math.Sign( wrapSize.X ) );
148  float wy = (float)( Math.Sign( wrapSize.Y ) );
149  float tileW = 1 / wrapX;
150  float tileH = 1 / wrapY;
151  float topLeftX = -0.5f + 0.5f * tileW;
152  float topLeftY = 0.5f - 0.5f * tileH;
153  float partX = wrapX - (int)wrapX;
154  float partY = wrapY - (int)wrapY;
155 
156  for ( int y = 0; y < (int)wrapY; y++ )
157  {
158  for ( int x = 0; x < (int)wrapX; x++ )
159  {
160  Matrix m =
161  Matrix.CreateScale( 1 / wrapX, 1 / wrapY, 1 ) *
162  Matrix.CreateTranslation( topLeftX + x * tileW, topLeftY - y * tileH, 0 ) *
163  matrix;
164  DrawImageTexture( texture, m, device, tempVertices );
165  }
166 
167  if ( partX > 0 )
168  {
169  // Draw a partial horizontal tile
170  Matrix m =
171  Matrix.CreateScale( partX, 1, 1 ) *
172  Matrix.CreateScale( 1 / wrapX, 1 / wrapY, 1 ) *
173  Matrix.CreateTranslation( -tileW / 2 + tileW * partX / 2, 0, 0 ) *
174  Matrix.CreateTranslation( topLeftX + (int)wrapX * tileW, topLeftY - y * tileH, 0 ) *
175  matrix;
176 
177  DrawImage( texture, ref m, new Vector( wx * partX, wy ) );
178  }
179  }
180 
181  if ( partY > 0 )
182  {
183  for ( int x = 0; x < (int)wrapX; x++ )
184  {
185  // Draw a partial vertical tile
186  Matrix m =
187  Matrix.CreateScale( 1, partY, 1 ) *
188  Matrix.CreateScale( 1 / wrapX, 1 / wrapY, 1 ) *
189  Matrix.CreateTranslation( 0, tileH / 2 - tileH * partY / 2, 0 ) *
190  Matrix.CreateTranslation( topLeftX + x * tileW, topLeftY - (int)wrapY * tileH, 0 ) *
191  matrix;
192 
193  DrawImage( texture, ref m, new Vector( wx, wy * partY ) );
194  }
195 
196  if ( partX > 0 )
197  {
198  // Draw a partial diagonal tile
199  Matrix m =
200  Matrix.CreateScale( partX, partY, 1 ) *
201  Matrix.CreateScale( 1 / wrapX, 1 / wrapY, 1 ) *
202  Matrix.CreateTranslation( -tileW / 2 + tileW * partX / 2, tileH / 2 - tileH * partY / 2, 0 ) *
203  Matrix.CreateTranslation( topLeftX + (int)wrapX * tileW, topLeftY - (int)wrapY * tileH, 0 ) *
204  matrix;
205 
206  DrawImage( texture, ref m, new Vector( wx * partX, wy * partY ) );
207  }
208  }
209  }
210 
211  private static void DrawImageTexture( Image texture, Matrix matrix, GraphicsDevice device, VertexPositionTexture[] tempVertices )
212  {
213  Effect effect = Graphics.GetTextureEffect( ref matrix, texture.XNATexture, LightingEnabled );
215 
216  foreach ( EffectPass pass in effect.CurrentTechnique.Passes )
217  {
218  pass.Apply();
219  Game.GraphicsDevice.DrawUserIndexedPrimitives<VertexPositionTexture>(
220  PrimitiveType.TriangleList,
221  tempVertices, 0, tempVertices.Length,
223  );
224  }
225 
227  }
228 
238  public static void BeginDrawingInsideShape( Shape shape, ref Matrix transformation )
239  {
240  if ( shape.Cache.Triangles == null )
241  throw new ArgumentException( "The shape must have triangles" );
242  if ( isDrawingInsideShape )
243  throw new Exception( "EndDrawingInsideShape must be called before calling this function again" );
244 
245  isDrawingInsideShape = true;
246  var device = Game.GraphicsDevice;
247 
248  device.Clear( ClearOptions.Stencil, Color.Black.AsXnaColor(), 0, 0 );
249  device.DepthStencilState = currentStencilState = drawShapeToStencilBufferState;
250 
251  DrawFilledShape( shape.Cache, ref transformation, Color.White, NoDrawingToScreenBufferBlendState );
252 
253  device.DepthStencilState = currentStencilState = drawAccordingToStencilBufferState;
254  }
255 
256  public static void EndDrawingInsideShape()
257  {
258  if ( !isDrawingInsideShape )
259  throw new Exception( "BeginDrawingInsideShape must be called first" );
260 
261  Game.GraphicsDevice.DepthStencilState = currentStencilState = DepthStencilState.None;
262  isDrawingInsideShape = false;
263  }
264 
272  public static void DrawText( string text, Vector position, Font font, Color color )
273  {
274  Vector2 textSize = font.XnaFont.MeasureString(text);
275  Vector2 xnaPos = ScreenView.ToXnaCoords( position, Game.Screen.Size, (Vector)textSize );
276 
277  SpriteBatch spriteBatch = Graphics.SpriteBatch;
278  spriteBatch.Begin();
279  spriteBatch.DrawString( font.XnaFont, text, xnaPos, color.AsXnaColor() );
280  spriteBatch.End();
281  }
282 
290  public static void DrawText( string text, ref Matrix transformation, Font font, Color color )
291  {
292  Vector textSize = (Vector)font.XnaFont.MeasureString( text );
293  Matrix m = ScreenView.ToXnaCoords(ref transformation, Game.Screen.Size, textSize );
294 
295  SpriteBatch spriteBatch = Graphics.SpriteBatch;
296  spriteBatch.Begin( SpriteSortMode.FrontToBack, BlendState.AlphaBlend, SamplerState.LinearClamp, currentStencilState, RasterizerState.CullCounterClockwise, null, m );
297  spriteBatch.DrawString( font.XnaFont, text, Vector2.Zero, color.AsXnaColor() );
298  spriteBatch.End();
299  }
300 
304  public static void DrawShape( Shape shape, ref Matrix transformation, ref Matrix textureTransformation, Image texture, Vector textureWrapSize, Color color )
305  {
306  BeginDrawingInsideShape( shape, ref transformation );
307  DrawImage( texture, ref textureTransformation, textureWrapSize );
309  }
310 
311  public static void DrawShape( Shape shape, ref Matrix matrix, Color color )
312  {
313  if ( shape is RaySegment )
314  {
315  DrawRaySegment( (RaySegment)shape, ref matrix, color );
316  }
317  else if ( shape.Cache.Triangles != null )
318  {
319  DrawFilledShape( shape.Cache, ref matrix, color );
320  }
321  else
322  {
323  DrawPolygon( shape.Cache.OutlineVertices, ref matrix, color );
324  }
325  }
326 
327  public static void DrawRaySegment( RaySegment segment, ref Matrix matrix, Color color )
328  {
329  var device = Game.GraphicsDevice;
330 
331  Vector endPoint = segment.Origin + segment.Direction * segment.Length;
332 
333  VertexPositionColor[] colorVertices = new VertexPositionColor[2];
334  colorVertices[0].Position = new Vector3( (float)segment.Origin.X, (float)segment.Origin.Y, 0 );
335  colorVertices[0].Color = color.AsXnaColor();
336  colorVertices[1].Position = new Vector3( (float)endPoint.X, (float)endPoint.Y, 0 );
337  colorVertices[1].Color = color.AsXnaColor();
338 
339  BasicEffect effect = Graphics.BasicColorEffect;
340  effect.World = matrix;
342  foreach ( EffectPass pass in effect.CurrentTechnique.Passes )
343  {
344  pass.Apply();
345  device.DrawUserPrimitives<VertexPositionColor>( PrimitiveType.LineStrip, colorVertices, 0, 1 );
346  }
348  }
349 
353  internal static void DrawRectangle( ref Matrix matrix, Color color )
354  {
355  Vector[] vertices = new Vector[]
356  {
357  new Vector(-0.5, 0.5),
358  new Vector(-0.5, -0.5),
359  new Vector(0.5, -0.5),
360  new Vector(0.5, 0.5),
361  };
362  Renderer.DrawPolygon( vertices, ref matrix, color );
363  }
364 
365  internal static void DrawFilledShape( ShapeCache cache, ref Matrix matrix, Color color )
366  {
367  DrawFilledShape( cache, ref matrix, color, BlendState.NonPremultiplied );
368  }
369 
370  internal static void DrawFilledShape( ShapeCache cache, ref Matrix matrix, Color color, BlendState blendState )
371  {
372  var device = Game.GraphicsDevice;
373 
374  VertexPositionColor[] vertices = new VertexPositionColor[cache.Vertices.Length];
375  for ( int i = 0; i < vertices.Length; i++ )
376  {
377  Vector v = cache.Vertices[i];
378  vertices[i] = new VertexPositionColor( new XnaV3( (float)v.X, (float)v.Y, 0 ), color.AsXnaColor() );
379  }
380 
381  Int16[] indices = new Int16[cache.Triangles.Length * 3];
382  for ( int i = 0; i < cache.Triangles.Length; i++ )
383  {
384  indices[3 * i] = cache.Triangles[i].i1;
385  indices[3 * i + 1] = cache.Triangles[i].i2;
386  indices[3 * i + 2] = cache.Triangles[i].i3;
387  }
388 
389  device.RasterizerState = RasterizerState.CullCounterClockwise;
390  device.BlendState = blendState;
391 #if WINDOWS_PHONE
392  // The WP7 emulator interprets cullmodes incorectly sometimes.
393  device.RasterizerState = RasterizerState.CullNone;
394 #endif
395 
396  Effect effect = Graphics.GetColorEffect( ref matrix, LightingEnabled );
398  foreach ( EffectPass pass in effect.CurrentTechnique.Passes )
399  {
400  pass.Apply();
401  device.DrawUserIndexedPrimitives<VertexPositionColor>(
402  PrimitiveType.TriangleList,
403  vertices, 0, vertices.Length,
404  indices, 0, indices.Length / 3
405  );
406  }
408  }
409 
410  public static void DrawPolygon( Vector[] vertices, ref Matrix matrix, Color color )
411  {
412  if ( vertices.Length < 3 )
413  throw new ArgumentException( "Polygon must have at least three vertices" );
414 
415  var device = Game.GraphicsDevice;
416 
417  VertexPositionColor[] colorVertices = new VertexPositionColor[vertices.Length];
418  for ( int i = 0; i < colorVertices.Length; i++ )
419  {
420  Vector p = vertices[i];
421  colorVertices[i] = new VertexPositionColor(
422  new XnaV3( (float)p.X, (float)p.Y, 0 ),
423  color.AsXnaColor()
424  );
425  }
426 
427  int n = colorVertices.Length;
428  Int16[] indices = new Int16[2 * n];
429  for ( int i = 0; i < ( n - 1 ); i++ )
430  {
431  indices[2 * i] = (Int16)i;
432  indices[2 * i + 1] = (Int16)( i + 1 );
433  }
434  indices[2 * ( n - 1 )] = (Int16)( n - 1 );
435  indices[2 * ( n - 1 ) + 1] = (Int16)0;
436 
437  Effect effect = Graphics.GetColorEffect( ref matrix, LightingEnabled );
439  foreach ( EffectPass pass in effect.CurrentTechnique.Passes )
440  {
441  pass.Apply();
442  device.DrawUserIndexedPrimitives<VertexPositionColor>(
443  PrimitiveType.LineStrip,
444  colorVertices, 0, colorVertices.Length,
445  indices, 0, indices.Length - 1
446  );
447 
448  }
450  }
451 
452 
453  internal static void DrawVertices( Vector[] vertices, Matrix matrix, Color color )
454  {
455  VertexPositionColor[] pointVertices = new VertexPositionColor[vertices.Length];
456  for ( int i = 0; i < pointVertices.Length; i++ )
457  {
458  Vector p = vertices[i];
459  pointVertices[i] = new VertexPositionColor(
460  new XnaV3( (float)p.X, (float)p.Y, 0 ),
462  );
463  }
464 
465  var device = Game.GraphicsDevice;
466  //device.RenderState.PointSize = 2;
467 
468  BasicEffect effect = Graphics.BasicColorEffect;
469  effect.World = matrix;
471  foreach ( var pass in effect.CurrentTechnique.Passes )
472  {
473  pass.Apply();
474  device.DrawUserPrimitives<VertexPositionColor>(
475  PrimitiveType.LineList,
476  pointVertices, 0, pointVertices.Length
477  );
478  }
480  }
481  }
482 }
483 
Jypeli.XnaV2
Microsoft.Xna.Framework.Vector2 XnaV2
Definition: Mouse.cs:37
Jypeli.Graphics.BasicColorEffect
static BasicEffect BasicColorEffect
Definition: Graphics.cs:38
Jypeli.ShapeCache.OutlineVertices
readonly Vector[] OutlineVertices
Ulkoreunan verteksit, lueteltuna vastapäivään.
Definition: Shapes.cs:591
Jypeli.Renderer
Luokka, joka sisältää metodeita kuvioiden ja tekstuurien piirtämiseen 2D-tasossa.
Definition: Renderer.cs:48
Jypeli.Graphics.GetColorEffect
static Effect GetColorEffect(ref Matrix worldMatrix, bool lightingEnabled)
Definition: Graphics.cs:164
Jypeli.Color.Black
static readonly Color Black
Musta.
Definition: Color.cs:503
Jypeli.Matrix
Microsoft.Xna.Framework.Matrix Matrix
Definition: Mouse.cs:36
Jypeli.Renderer.DrawShape
static void DrawShape(Shape shape, ref Matrix transformation, ref Matrix textureTransformation, Image texture, Vector textureWrapSize, Color color)
Piirtää kuvion niin, että tekstuuri täyttää sen.
Definition: Renderer.cs:304
Microsoft.Xna
Definition: JypeliContentManager.cs:6
Jypeli.IndexTriangle.i3
Int16 i3
Definition: Shapes.cs:557
Jypeli.Vector.X
double X
Definition: Vector.cs:312
Jypeli.Color.Red
static readonly Color Red
Punainen.
Definition: Color.cs:813
XnaV3
Microsoft.Xna.Framework.Vector3 XnaV3
Definition: Renderer.cs:35
Jypeli.Renderer.DrawImageTexture
static void DrawImageTexture(Image texture, Matrix matrix, GraphicsDevice device, VertexPositionTexture[] tempVertices)
Definition: Renderer.cs:211
Jypeli
Definition: Automobile.cs:5
Jypeli.Renderer.DrawFilledShape
static void DrawFilledShape(ShapeCache cache, ref Matrix matrix, Color color)
Definition: Renderer.cs:365
Jypeli.ShapeCache
Sisältää valmiiksi lasketut kolmiot, joiden avulla piirtäminen on suoraviivaista.
Definition: Shapes.cs:583
Jypeli.Renderer.NoDrawingToScreenBufferBlendState
static readonly BlendState NoDrawingToScreenBufferBlendState
Definition: Renderer.cs:71
Microsoft
Definition: JypeliContentManager.cs:6
Microsoft.Xna.Framework
Definition: JypeliContentManager.cs:6
Jypeli.Renderer.currentStencilState
static DepthStencilState currentStencilState
Definition: Renderer.cs:93
Jypeli.Renderer.textureTriangleIndices
static readonly Int16[] textureTriangleIndices
Indices that form two triangles from the vertex array.
Definition: Renderer.cs:63
Jypeli.ScreenView.Size
Vector Size
Näytön koko vektorina.
Definition: View.cs:248
Jypeli.Font.XnaFont
SpriteFont XnaFont
Definition: Font.cs:90
Jypeli.Shape
Kuvio.
Definition: Shapes.cs:47
Jypeli.RaySegment
Jana.
Definition: Shapes.cs:475
Jypeli.RaySegment.Length
double Length
Definition: Shapes.cs:488
Jypeli.Renderer.LightingEnabled
static bool LightingEnabled
Definition: Renderer.cs:69
Jypeli.RaySegment.Origin
Vector Origin
Definition: Shapes.cs:486
Jypeli.Renderer.DrawRectangle
static void DrawRectangle(ref Matrix matrix, Color color)
Piirtää suorakulmion.
Definition: Renderer.cs:353
Jypeli.Image.XNATexture
Texture2D XNATexture
Definition: Image.cs:71
Jypeli.ScreenView.ToXnaCoords
static Vector2 ToXnaCoords(Vector position, Vector screenSize, Vector objectSize)
Muuntaa Jypelin ruutukoordinaateista XNA:n ruutukoordinaateiksi.
Definition: View.cs:365
Jypeli.IndexTriangle.i2
Int16 i2
Definition: Shapes.cs:557
Jypeli.Shape.Cache
abstract ShapeCache Cache
Definition: Shapes.cs:55
Jypeli.Graphics.GetTextureEffect
static Effect GetTextureEffect(ref Matrix worldMatrix, Texture2D texture, bool lightingEnabled)
Definition: Graphics.cs:143
Jypeli.Game.Screen
static ScreenView Screen
Näytön dimensiot, eli koko ja reunat.
Definition: Graphics.cs:90
Jypeli.Renderer.drawShapeToStencilBufferState
static readonly DepthStencilState drawShapeToStencilBufferState
Definition: Renderer.cs:76
Jypeli.ScreenView
Sisältää näytön leveyden ja korkeuden sekä reunojen koordinaatit. Y-koordinaatti kasvaa ylöspäin....
Definition: View.cs:45
Jypeli.Renderer.DrawVertices
static void DrawVertices(Vector[] vertices, Matrix matrix, Color color)
Definition: Renderer.cs:453
Jypeli.Renderer.DrawImage
static void DrawImage(Image texture, ref Matrix matrix, Vector wrapSize)
Definition: Renderer.cs:122
Jypeli.Graphics.SpriteBatch
static SpriteBatch SpriteBatch
Definition: Graphics.cs:40
Jypeli.Renderer.isDrawingInsideShape
static bool isDrawingInsideShape
Definition: Renderer.cs:92
Jypeli.Color
Väri.
Definition: Color.cs:13
Jypeli.Renderer.DrawFilledShape
static void DrawFilledShape(ShapeCache cache, ref Matrix matrix, Color color, BlendState blendState)
Definition: Renderer.cs:370
Jypeli.RaySegment.Direction
Vector Direction
Definition: Shapes.cs:487
Jypeli.Renderer.EndDrawingInsideShape
static void EndDrawingInsideShape()
Definition: Renderer.cs:256
Jypeli.Graphics
Contains graphics resources.
Definition: Graphics.cs:36
Jypeli.Renderer.textureVertices
static readonly VertexPositionTexture[] textureVertices
Vertices that form a rectangle on which to draw textures.
Definition: Renderer.cs:52
Jypeli.Renderer.DrawRaySegment
static void DrawRaySegment(RaySegment segment, ref Matrix matrix, Color color)
Definition: Renderer.cs:327
Jypeli.Image
Kuva.
Definition: Image.cs:29
Jypeli.Vector
2D-vektori.
Definition: Vector.cs:59
System
Definition: CFFauxAttributes.cs:29
Jypeli.Renderer.MakeTextureVertices
static VertexPositionTexture[] MakeTextureVertices(Vector wrapSize)
Definition: Renderer.cs:95
Jypeli.Graphics.ResetSamplerState
static void ResetSamplerState()
Definition: Graphics.cs:133
Jypeli.ShapeCache.Vertices
readonly Vector[] Vertices
Kaikki verteksit, ml. kolmioiden kulmapisteet.
Definition: Shapes.cs:596
Jypeli.Font
Fontti.
Definition: Font.cs:23
Jypeli.Game.GraphicsDevice
static new GraphicsDevice GraphicsDevice
XNA:n grafiikkakortti.
Definition: Graphics.cs:49
Jypeli.Renderer.BeginDrawingInsideShape
static void BeginDrawingInsideShape(Shape shape, ref Matrix transformation)
Makes all the subsequent draw calls until EndDrawingInsideShape limit the drawing inside shape (trans...
Definition: Renderer.cs:238
Jypeli.Color.White
static readonly Color White
Valkoinen.
Definition: Color.cs:903
Jypeli.ShapeCache.Triangles
readonly IndexTriangle[] Triangles
Kolmiot, joiden avulla kuvio voidaan täyttää värillä.
Definition: Shapes.cs:601
Jypeli.Game
Definition: Content.cs:46
Jypeli.Renderer.drawAccordingToStencilBufferState
static readonly DepthStencilState drawAccordingToStencilBufferState
Definition: Renderer.cs:84
Jypeli.Renderer.DrawText
static void DrawText(string text, ref Matrix transformation, Font font, Color color)
Piirtää tekstiä ruudulle
Definition: Renderer.cs:290
Jypeli.Color.AsXnaColor
XnaColor AsXnaColor()
Definition: Color.cs:46
Jypeli.IndexTriangle.i1
Int16 i1
Kulmapisteet.
Definition: Shapes.cs:557
Jypeli.Graphics.SetSamplerState
static void SetSamplerState()
Definition: Graphics.cs:127
XnaV2
Microsoft.Xna.Framework.Vector2 XnaV2
Definition: Font.cs:4
Jypeli.Renderer.DrawShape
static void DrawShape(Shape shape, ref Matrix matrix, Color color)
Definition: Renderer.cs:311
Jypeli.Renderer.DrawPolygon
static void DrawPolygon(Vector[] vertices, ref Matrix matrix, Color color)
Definition: Renderer.cs:410
Jypeli.Vector.Y
double Y
Definition: Vector.cs:313
Jypeli.Renderer.DrawText
static void DrawText(string text, Vector position, Font font, Color color)
Piirtää tekstiä ruudulle
Definition: Renderer.cs:272