Search Results

Search found 1 results on 1 pages for 'codingmadeeasy'.

Page 1/1 | 1 

  • Spritebatch not working in winforms

    - by CodingMadeEasy
    I'm using the Winforms sample on the app hub and everything is working fine except my spritebatch won't draw anything unless I call Invalidate in the Draw method. I have this in my initialize method: Application.Idle += delegate { Invalidate(); }; I used a breakpoint and it is indeed invalidating my program and it is calling my draw method. I get no errors with the spritebatch and all the textures are loaded I just don't see anything on the screen. Here's the code I have: protected override void Draw() { GraphicsDevice.Clear(Color.CornflowerBlue); spriteBatch.Begin(); tileSheet.Draw(spriteBatch); foreach (Image img in selector) img.Draw(spriteBatch); spriteBatch.End(); } But when I do this: protected override void Draw() { GraphicsDevice.Clear(Color.CornflowerBlue); spriteBatch.Begin(); tileSheet.Draw(spriteBatch); foreach (Image img in selector) img.Draw(spriteBatch); spriteBatch.End(); Invalidate(); } then all of a sudden the drawing starts to work! but the problem is that it freezes everything else and only that control gets updated. What can I do to fix this? It's really frustrating.

    Read the article

1