Re: draw sprite doesn't work when inside VS (executable works fine)

From: Phil Taylor (phil_at_private-citizen.com)
Date: 12/28/04


Date: Tue, 28 Dec 2004 14:18:56 -0800

so have you stepped thru the code in a debugger and seen if all DX objects
are created and all media is found/

does the debug runtime output stream contain any info?

these are all standard debugging steps, no magic here.

<EberSys@gmail.com> wrote in message
news:1104271929.542294.106490@z14g2000cwz.googlegroups.com...
> This may be a known issue, but I haven't been able to find it
> anywhere... and I'm a good googler =o)...
>
> I have this code (directly taken from Microsoft) to draw a simple
> sprite:
>
> public Device device=null;
> public Microsoft.DirectX.Direct3D.Sprite sprite=null;
> public Texture tex=null;
>
> public void InitGraphics()
> {
> PresentParameters p=new PresentParameters();
> p.SwapEffect=SwapEffect.Discard;
> p.Windowed=true;
> device=new Device(0, DeviceType.Hardware, this,
> CreateFlags.SoftwareVertexProcessing, p);
> sprite=new Sprite(device);
> tex=TextureLoader.FromFile(device, "F:\\eber\\charmed2.bmp");
> }
>
> public void doRender()
> {
> device.Clear(ClearFlags.Target, Color.White, 1.0f, 0);
> device.BeginScene();
> sprite.Begin(SpriteFlags.None);
> sprite.Draw2D(tex, Rectangle.Empty, Rectangle.Empty, new
> Point(10, 10), Color.Blue);
> sprite.End();
> device.EndScene();
> device.Present();
> }
>
> static void Main()
> {
> Form1 frm = new Form1();
> frm.InitGraphics();
> frm.Show();
> while (frm.Created)
> {
> frm.doRender();
> Application.DoEvents();
> }
> }
>
>
> it's all good... except, when running from Visual Studio, the sprite
> doesn't show anywhere... if I run the generated executable, it shows up
> fine...
>
> what am I missing?
>
> I even tried this in a different IDE (Delphi 2005) with the exact same
> results
>
> thanks in advance
>



Relevant Pages

  • bug vs2005?
    ... The code runs fine outside the debugger but inside there are places where the ... have the main gui thread store the main form in a variable in a worker ... public partial class Form2: Form ... public void CallBack(Form f) ...
    (microsoft.public.vsnet.debugging)
  • Re: need help or explanation
    ... want to clear the previous draws on the screen, but I want to leave a trail. ... public static void main(Stringargs) { ... public void run{ ... ActionListener sprite = new ActionListener{ ...
    (comp.lang.java.programmer)
  • Re: need help or explanation
    ... you absolutely have to use proper synchronization when dealing with Swing components. ... public static void main(Stringargs) { ... public void run{ ... ActionListener sprite = new ActionListener{ ...
    (comp.lang.java.programmer)
  • Re: Trying to do a TRON ROM hack. The debugger doesnt seem to work very well.
    ... I hope you're not expecting anyone to be able to tell you what you're doing ... I guess I'm just wondering if this debugger actually works or not. ... GFXDECODE_START indicates REGION_GFX2 is the sprite data ... ROM_REGION indicates the sprite data is read from: ...
    (alt.games.mame)
  • draw sprite doesnt work when inside VS (executable works fine)
    ... public void InitGraphics() ... PresentParameters p=new PresentParameters; ... Form1 frm = new Form1; ... except, when running from Visual Studio, the sprite ...
    (microsoft.public.win32.programmer.directx.managed)