public override void Render(Graphics g, TexturedObject obj, Vector2D cameraPos) { GridTexture tex = (GridTexture)obj.GetActualTexture(); g.InterpolationMode = tex.InterpolationMode; g.PixelOffsetMode = System.Drawing.Drawing2D.PixelOffsetMode.HighQuality; if (tex.Image == null) { Exception ex = new RenderException("Image was not initialized in texture \"" + tex.Name); Log.Exception(ex); throw ex; } for (int x = 0; x < tex.xCount; x++) { for (int y = 0; y < tex.yCount; y++) { g.DrawImage( tex.Image, new Rectangle( new Point( (int)(obj.GetStartPosition().X - cameraPos.X + x * obj.Scale.Width * obj.Size.Width), (int)(obj.GetStartPosition().Y - cameraPos.Y + y * obj.Scale.Height * obj.Size.Height) ), new System.Drawing.Size( (int)(obj.Scale.Width * obj.Size.Width), (int)(obj.Scale.Height * obj.Size.Height) ) ) ); } } }
public override void Render(Graphics g, TexturedObject obj, Vector2D cameraPos) { RegularTexture tex = (RegularTexture)obj.GetActualTexture(); g.InterpolationMode = tex.InterpolationMode; g.PixelOffsetMode = System.Drawing.Drawing2D.PixelOffsetMode.HighQuality; if (tex.Image == null) { Exception ex = new RenderException("Image was not initialized in texture \"" + tex.Name); Log.Exception(ex); throw ex; } g.DrawImage( tex.Image, new Rectangle( new Point( (int)(obj.GetStartPosition().X - cameraPos.X), (int)(obj.GetStartPosition().Y - cameraPos.Y) ), new System.Drawing.Size( (int)Math.Round(obj.Scale.Width * obj.Size.Width, MidpointRounding.AwayFromZero), (int)Math.Round(obj.Scale.Height * obj.Size.Height, MidpointRounding.AwayFromZero) ) ) ); }