RE: Surely a simple prob i hope

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Hi Daniel,

Just in response to the 790/800 pixel issue. I experienced the same thing
and although i never really looked into it, i think it was due to the window
having a 5 pixel border to the left and right (adding up to 10 pixels). This
meant that only 790 pixels were actually being displayed. I may be wrong
though :)

ta,
Brook

"Daniel" wrote:

Hey guys

I have a few issues all of which are strange so i hope someone can clarify
fo rme.

First of all i have a windowed app, 800 x 600 in size.

I write all my mouse positions to the console verytime i move the mouse and
i find when i move th emouse to the far right edge of my window it goes to
790...but not 800?

Next i draw a sprite at position 500,0,0
Then draw some 2d text at the same position 500,0

Yet on the screen the 2d text appears about 60pixels more across.

The 2D text seems to be accurate, if i set it to 790 it goes right at the
edge of my form, as you would expect after the first weird issue of the edge
being 790 instead of 800.

So why does my sprite not position correctly? ALso note it is not a set
offset, the more i move the sprite across the further the gap between it and
the text.

I am guessing my sprite is being drawn in a different acis or something and
i need it to match the one the 2d text is following. how do i do this???
please help

This is my code to initialise my perspective view.

// Set transforms

device.Transform.World = Matrix.Identity;

device.Transform.View = Matrix.Identity;

float aspect = (float)_displaySize.Width / (float)_displaySize.Height;


device.Transform.Projection = Matrix.PerspectiveFieldOfViewLeftHanded(
(float)Math.PI / 3.0f, aspect, 0.1f, 1000.0f );

float centerX = (float)_displaySize.Width / 2.0f;

float centerY = (float)_displaySize.Height / 2.0f;

Vector3 cameraPosition = new Vector3(centerX, centerY, -10.0f);

Vector3 cameraTarget = new Vector3(centerX, centerY, 0.0f);

device.Transform.View = Matrix.LookAtLeftHanded(cameraPosition,
cameraTarget, new Vector3(0.0f, 1.0f, 0.0f));

device.Transform.Projection =
Matrix.OrthoLeftHanded((float)_displaySize.Width,
(float)_displaySize.Height, 1.0f, 10.0f);

// Set render states

device.RenderState.Lighting = false;



.



Relevant Pages

  • Re: Surely a simple prob i hope
    ... Just in response to the 790/800 pixel issue. ... i find when i move th emouse to the far right edge of my window it goes ... Next i draw a sprite at position 500,0,0 ... Then draw some 2d text at the same position 500,0 ...
    (microsoft.public.win32.programmer.directx.managed)
  • Re: Surely a simple prob i hope
    ... Just in response to the 790/800 pixel issue. ... i find when i move th emouse to the far right edge of my window it goes ... Next i draw a sprite at position 500,0,0 ... Then draw some 2d text at the same position 500,0 ...
    (microsoft.public.win32.programmer.directx.managed)
  • Surely a simple prob i hope
    ... fo rme. ... i find when i move th emouse to the far right edge of my window it goes to ... Then draw some 2d text at the same position 500,0 ... So why does my sprite not position correctly? ...
    (microsoft.public.win32.programmer.directx.managed)
  • Re: How to do a getPixel on Win32 using Ruby?
    ... If so, I think you should use a GUI toolkit, create a maximized window, ... without a title bar and border, and then draw onto it. ... #Get the pixel color at which should be black. ...
    (comp.lang.ruby)
  • Draw a image into a window in Carbon
    ... I have the position and the 16bits pixel value of an image and I would ... like to draw into a window. ... I´ve read about Quartz but I don´t ... understand how use createimage from the pixels and so draw the image. ...
    (comp.sys.mac.programmer.help)