public void Draw(Sfg.RenderTarget target, Sfg.RenderStates states) { foreach (var view in _views) { target.Draw(view, states); } }
//////////////////////////////////////////////////////////// /// <summary> /// Copy constructor /// </summary> /// <param name="copy">States to copy</param> //////////////////////////////////////////////////////////// public RenderStates(RenderStates copy) { BlendMode = copy.BlendMode; Transform = copy.Transform; Texture = copy.Texture; Shader = copy.Shader; }
public void Initialize() { SelectedShader = new Shader(null, "Shader/SelectedShader.frag"); SelectedState = new RenderStates(SelectedShader); AddControls(); }
public RenderTarget(SFML.Graphics.RenderTarget renderTarget) { this.renderTarget = renderTarget; m_VertexCache = new Vertex[CacheSize]; m_RenderState = RenderStates.Default; }
public void Draw(RenderTarget target, RenderStates states) { body.FillColor = data.FillColor; target.Draw(body); target.Draw(text); }
public override void Draw(RenderTarget target, RenderStates states) { states.Transform *= Transform; graphic.Draw(target, states); base.Draw(target, states); }
/// <summary> /// Initializes a new instance of the <see cref="SFML"/> class. /// </summary> /// <param name="target">SFML render target.</param> public SFML(RenderTarget target) { m_Target = target; m_VertexCache = new Vertex[CacheSize]; m_RenderState = new RenderStates(BlendMode.Alpha); // somehow worked without this in previous SFML version (May 9th 2010) }
public override void Draw(RenderTarget target, RenderStates states) { var sprite = sprites[type]; sprite.Position = new Vector2f(x, y); sprite.Rotation = rotation; target.Draw(sprite); }
public void Draw(RenderTarget target, RenderStates states) { target.Draw(background, states); foreach (Layer l in layers) { target.Draw(l, states); } }
public void Draw(VertexArray vertices, RenderStates states) { if (!drawing) return; // Render states have changed, so flush and clear. if (!CompareStates(renderStates, states)) { Flush(); vertexArray.Clear(); renderStates = states; } // Exceeding maximum sprites, so flush and clear. if (DrawCount >= MaxSprites) { Flush(); DrawCount = 0; vertexArray.Clear(); } // Apply the transform to the four points var transform = states.Transform; // Append the vertices for (uint i = 0; i < vertices.VertexCount; i++) { var vertex = vertices[i]; var pos = transform.TransformPoint(vertex.Position.X, vertex.Position.Y); vertex.Position.X = pos.X; vertex.Position.Y = pos.Y; vertexArray.Append(vertex); } DrawCount++; // I think that's it? }
public void Draw(RenderTarget target, RenderStates states) { states.Transform.Combine(Transform); target.Draw(m_QuadArray, states); target.Draw(m_LineArray, states); }
public Menu() : base() { hoverCursor = Content.GetTexture("cursorHover.png"); defaultCursor = Content.GetTexture("cursorPointer.png"); currentCursor = defaultCursor; char1 = new Animation(Content.GetTexture("idle.png"), 4, 0, 0, true); char2 = new Animation(Content.GetTexture("char2_idle.png"), 4, 0, 0, true); shader = new RenderStates(new Shader(null, "Content/bgPrlx.frag")); rectConnect = new RectangleShape() { Size = new Vector2f(150, 30), Position = new Vector2f(-25, 70) }; rectIP = new RectangleShape() { Size = new Vector2f(150, 20), Position = new Vector2f(-25, 40) }; rectUsername = new RectangleShape() { Size = new Vector2f(150, 20), Position = new Vector2f(-25, 10) }; MainGame.window.TextEntered += TextEnteredEvent; }
public Deathmatch() : base() { Projectiles = new List<Projectile>(); BackgroundImages = new List<Sprite>(); BackgroundImagesFar = new List<Sprite>(); BackgroundTracks = new List<Sprite>(); BackgroundGameObjects = new List<GameObject>(); Players = new List<Actor>(); Mailman = new ClientMailman(this); shader = new RenderStates(new Shader(null, "Content/bgPrlx.frag")); Image mapImg = new Image("Content/mapCol.png"); mapBytes = mapImg.Pixels; mapSprite = new Sprite(new Texture(mapImg)); mapWidth = (int)mapImg.Size.X; mapHeight = (int)mapImg.Size.Y; player = new ClientPlayer(this); player.Pos = new Vector2f(46, 62); Players.Add(player); trainSoundExterior = new SoundInstance(Content.GetSound("trainSpeed2.wav"), 1f, 0, 15, true); trainSoundInterior = new SoundInstance(Content.GetSound("trainSpeed0.wav"), 1, 0, 15, true); trainSound = trainSoundExterior; MainGame.Camera.Center = player.Pos - new Vector2f(0, 90); }
public void Draw(Sfg.RenderTarget target, Sfg.RenderStates states) { _score.DisplayedString = $"Score: {_gameplayState.Score}"; target.Draw(_background); target.Draw(new WorldView(_gameplayState.World)); target.Draw(new TerminoView(_gameplayState.World.CurrentPiece)); target.Draw(_score); }
public void Draw(RenderTarget target, RenderStates states) { if (_dirty) Rebuild(); states.Transform *= Transform; target.Draw(_vertices, states); }
public void Draw(RenderTarget target, RenderStates states) { target.Draw(rectangleShape); target.Draw(unitPictureBoxRenderer); target.Draw(healthBarRenderer); target.Draw(MoveButtonRenderer); target.Draw(AttackButtonRenderer); }
public ShieldGenerator(Vector2f position) { tex = Content.GetTexture("generatorStand.png"); col = Content.GetTexture("genBlue.png"); shader = new RenderStates(new Shader(null, "Content/shield.frag")); whenPlaced = DateTime.Now; Pos = position; }
public void Draw(RenderTarget target, RenderStates states) { if (data.PictureSprite != null) curentPicture = data.PictureSprite; target.Draw(frame); target.Draw(curentPicture); }
private void DrawBackground(RenderTarget target, Texture background, Vector2f cameraPosition) { var renderState = new RenderStates(BlendMode.Add); var offset = new Vector2f(0.12f * cameraPosition.X % background.Size.X, 0.12f * cameraPosition.Y % background.Size.Y); renderState.Transform.Translate(-offset); var bgSprite = new Sprite(background, new IntRect(0, 0, (int)target.Size.X * 2, (int)target.Size.Y * 2)); target.Draw(bgSprite, renderState); }
bool CompareStates(RenderStates a, RenderStates b) { if (a.Texture != b.Texture) return false; if (a.Shader != b.Shader) return false; if (a.BlendMode != b.BlendMode) return false; // Dont care about transform right now. return true; }
public FastTextureAtlas(TextureAtlas atlas) { TextureAtlas = atlas; _atlas = new Sprite(TextureAtlas.Texture); RenderTexture = new RenderTexture(atlas.Size, atlas.Size); RenderTexture.Draw(_atlas); RenderTexture.Display(); _replace = new RenderStates(BlendMode.None, Transform.Identity, null, null); }
public void Draw(RenderTarget Target, RenderStates states) { states.Transform *= Transform; for (DrawListIndex = 0; DrawListIndex < Children.Count; DrawListIndex++) { if (!(Children[DrawListIndex] is DisplayObject) || Children[DrawListIndex].Visible) Children[DrawListIndex].Draw(Target, states); } }
public void Draw(RenderTarget target, RenderStates states) { var bounds = Program.Camera.Bounds; var pos = Program.Camera.Position; _sprite.Position = pos - new Vector2f(bounds.Width / 2, bounds.Height / 2); _sprite.TextureRect = new IntRect((int)(pos.X % _texture.Size.X), (int)(pos.Y % _texture.Size.Y), (int)bounds.Width, (int)bounds.Height); target.Draw(_sprite); }
public override void Draw(RenderTarget target, RenderStates states) { target.Clear(Color.Black); target.Draw(_backgroundSprite); foreach (var w in Widgets) { target.Draw(w); } }
public override void Draw(RenderTarget target, RenderStates states) { if (vertices != null) { states.Transform *= Transform; states.Texture = texture; target.Draw(vertices, primitiveType, states); } }
public void Draw(RenderTarget target, RenderStates states) { target.Draw(mapRenderer); for (int i = 0; i < UnitRenderers.Length; i++) { target.Draw(UnitRenderers[i]); } target.Draw(interfaceBarRenderer); }
public void Draw(RenderTarget target, RenderStates states) { foreach (MenuItem item in menuItems) { target.Draw(item); } target.Draw(selectionPointer); }
public void Draw(RenderTarget target, RenderStates states) { // Each tileset texture has a unique vertex array foreach (var v in verts) { Tileset tileset = Map.GetOwningTileset(v.Key); states.Texture = tileset.Texture; states.Transform = Map.Transform; target.Draw(v.Value, states); } }
public void Draw(RenderTarget target, RenderStates states) { _paletteTexture.Update(_palette); _dataTexture.Update(_data); states.Transform *= Transform; states.Shader = _renderer; target.Draw(_display, states); }
public static RenderStates UsePhosphorGlow(Texture TexA, Texture TexB, float Sub) { if (PhosphorGlowStates.Shader == null) PhosphorGlowStates = new RenderStates(PhosphorGlow); PhosphorGlowStates.Shader.SetParameter("tex_a", TexA); PhosphorGlowStates.Shader.SetParameter("tex_b", TexB); PhosphorGlowStates.Shader.SetParameter("sub", Sub); return PhosphorGlowStates; }
public virtual void Draw(RenderTarget target, RenderStates states) { states.Transform *= this.Transform; DrawCurrent(target, states); foreach (SceneNode itr in mChildren) { itr.Draw(target, states); } }
public void Draw(RenderTarget target, RenderStates states) { var worldStates = states; worldStates.Transform *= worldTransform; currentMap.Draw(target, worldStates); foreach (var actor in actors) actor.Draw(target, states); }
public SfmlRenderer(RenderWindow window, CommonResource resource, bool highResolution) { sfmlWindow = window; palette = resource.Palette; colors = InitColors(palette); sfmlWindowWidth = (int)window.Size.X; sfmlWindowHeight = (int)window.Size.Y; if (highResolution) { screen = new DrawScreen(resource.Wad, 640, 400); sfmlTextureWidth = 512; sfmlTextureHeight = 1024; } else { screen = new DrawScreen(resource.Wad, 320, 200); sfmlTextureWidth = 256; sfmlTextureHeight = 512; } sfmlTextureData = new byte[4 * screen.Width * screen.Height]; try { sfmlTexture = new SFML.Graphics.Texture((uint)sfmlTextureWidth, (uint)sfmlTextureHeight); sfmlSprite = new SFML.Graphics.Sprite(sfmlTexture); } catch (Exception e) { Dispose(); ExceptionDispatchInfo.Capture(e).Throw(); } sfmlSprite.Position = new Vector2f(0, 0); sfmlSprite.Rotation = 90; var scaleX = (float)sfmlWindowWidth / screen.Width; var scaleY = (float)sfmlWindowHeight / screen.Height; sfmlSprite.Scale = new Vector2f(scaleY, -scaleX); sfmlStates = new RenderStates(BlendMode.None); menu = new MenuRenderer(resource.Wad, screen); threeD = new ThreeDRenderer(resource, screen); statusBar = new StatusBarRenderer(resource.Wad, screen); intermission = new IntermissionRenderer(resource.Wad, screen); openingSequence = new OpeningSequenceRenderer(resource.Wad, screen, this); autoMap = new AutoMapRenderer(screen); }
public Renderer() { blitState = new SFML.Graphics.RenderStates(); blitState.Transform = Transform.Identity; blitState.Shader = null; blitState.BlendMode = BlendMode.Add; if (UsePlaceholderSprite) { placeholderSprite = new SFML.Graphics.Sprite(); } rectSprite = new SFML.Graphics.Sprite(); }
public void Draw(RenderTarget target, SRenderStates Renderstates) { if (Drawing) { throw new InvalidOperationException("Call End first."); } foreach (var item in QueuedTextures) { Renderstates.Texture = item.Texture.SFMLTexture; Renderstates.BlendMode = (SBlendMode)BlendingSettings; item.Verticies.Draw(target, Renderstates); } }
//////////////////////////////////////////////////////////// /// <summary> /// Draw a drawable object to the render-target /// </summary> /// <param name="drawable">Object to draw</param> /// <param name="states">Render states to use for drawing</param> //////////////////////////////////////////////////////////// public void Draw(Drawable drawable, RenderStates states) { drawable.Draw(this, states); }
//////////////////////////////////////////////////////////// /// <summary> /// Draw primitives defined by a sub-array of vertices /// </summary> /// <param name="vertices">Pointer to the vertices</param> /// <param name="start">Index of the first vertex to use in the array</param> /// <param name="count">Number of vertices to draw</param> /// <param name="type">Type of primitives to draw</param> /// <param name="states">Render states to use for drawing</param> //////////////////////////////////////////////////////////// public void Draw(Vertex[] vertices, uint start, uint count, PrimitiveType type, RenderStates states) { RenderStates.MarshalData marshaledStates = states.Marshal(); unsafe { fixed(Vertex *vertexPtr = vertices) { sfRenderWindow_drawPrimitives(CPointer, vertexPtr + start, count, type, ref marshaledStates); } } }
public SfmlRenderer(Config config, RenderWindow window, CommonResource resource) { try { Console.Write("Initialize renderer: "); this.config = config; config.video_gamescreensize = Math.Clamp(config.video_gamescreensize, 0, MaxWindowSize); config.video_gammacorrection = Math.Clamp(config.video_gammacorrection, 0, MaxGammaCorrectionLevel); sfmlWindow = window; palette = resource.Palette; sfmlWindowWidth = (int)window.Size.X; sfmlWindowHeight = (int)window.Size.Y; if (config.video_highresolution) { screen = new DrawScreen(resource.Wad, 640, 400); sfmlTextureWidth = 512; sfmlTextureHeight = 1024; } else { screen = new DrawScreen(resource.Wad, 320, 200); sfmlTextureWidth = 320; sfmlTextureHeight = 200; } sfmlTextureData = new byte[4 * screen.Width * screen.Height]; sfmlTexture = new SFML.Graphics.Texture((uint)sfmlTextureWidth, (uint)sfmlTextureHeight); sfmlSprite = new SFML.Graphics.Sprite(sfmlTexture); sfmlSprite.Position = new Vector2f(0, 0); sfmlSprite.Rotation = 90; var scaleX = (float)sfmlWindowWidth / screen.Width; var scaleY = (float)sfmlWindowHeight / screen.Height; sfmlSprite.Scale = new Vector2f(scaleY, -scaleX); sfmlStates = new RenderStates(BlendMode.None); menu = new MenuRenderer(resource.Wad, screen); threeD = new ThreeDRenderer(resource, screen, config.video_gamescreensize); statusBar = new StatusBarRenderer(resource.Wad, screen); intermission = new IntermissionRenderer(resource.Wad, screen); openingSequence = new OpeningSequenceRenderer(resource.Wad, screen, this); autoMap = new AutoMapRenderer(resource.Wad, screen); finale = new FinaleRenderer(resource, screen); pause = Patch.FromWad(resource.Wad, "M_PAUSE"); var scale = screen.Width / 320; wipeBandWidth = 2 * scale; wipeBandCount = screen.Width / wipeBandWidth + 1; wipeHeight = screen.Height / scale; wipeBuffer = new byte[screen.Data.Length]; palette.ResetColors(gammaCorrectionParameters[config.video_gammacorrection]); Console.WriteLine("OK"); } catch (Exception e) { Console.WriteLine("Failed"); Dispose(); ExceptionDispatchInfo.Throw(e); } }
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /// <summary> /// Draws the widget on the render target /// </summary> /// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// public override void Draw(SFML.Graphics.RenderTarget target, SFML.Graphics.RenderStates states) { }
public void Draw(Sfg.RenderTarget target, Sfg.RenderStates states) { target.Draw(_score, states); }
public void Draw(RenderTarget target, SRenderStates states) { Parent.Draw(target, states); }
//////////////////////////////////////////////////////////// /// <summary> /// Draw primitives defined by an array of vertices /// </summary> /// <param name="vertices">Pointer to the vertices</param> /// <param name="type">Type of primitives to draw</param> /// <param name="states">Render states to use for drawing</param> //////////////////////////////////////////////////////////// public void Draw(Vertex[] vertices, PrimitiveType type, RenderStates states) { Draw(vertices, 0, (uint)vertices.Length, type, states); }