Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 17 Mar 2007
Offline Last Active May 07 2013 11:38 AM

Topics I've Started

I'm desperate. Isometric Mouse Coordinates

06 May 2013 - 07:08 AM

After browsing the web and reading dozens of examples and tutorials I still can't figure out how to translate mouse X;Y screen position in pixels to X;Y isometric tile index. All the examples I tried returned strange values.


The attached picture shows exactly the tiles' redering order. The Zig-Zag  rendering mode was so simple to implement with the help of a colored coded tile. But this diamond shapped design is really giving me a hard time.


I guess the formula involves the following variables:


- MousePos.X

- MousePos.Y

- TileWidth

- TileHeight

- ScreenWidth

- ScreenHeight


Now I just need to know how to put the pieaces the together as I really can't see any logic behind it.


Thank you very much for any possible help.

Need guidance on which gfx lib to use for .NET

18 March 2012 - 11:16 AM

GDI+ is clearly not fast enough for me. I really don't understand why .NET has such library capable of doing so much with such low performance. Having said that, I now seek a new graphics library for my project which is a tiled 2D game, being developed in C#.

I've browsed the web and I've found some interesting things like the SDL lib. There is SDL C# wrapper for .NET which seems rather nice. After I tried it I realize it would not compile on x64 architectures. So I went to their forum just to look at its scary inactivity. There is one post over there that actually describes my problem, unfortunately it has not been answered, not even after almost an year. SDL C# last update was in 21 November 2010, so I can sadly assume it is pretty dead. Moving on.

I want to do simple things like drawing images and text, something that is quite hard to achieve with OpenGL's .NET wrappers I've come across. I really don't need that much performance just something simple to use, for the very own simple things I mentioned above. SDL C# was very easy to work with, too bad it is gone...

I still didn't get it. Managed Direct X was discontinued, does this means June's DirectX SDK does not support it? Does not support it but still includes their libraries? I'm using some libraries that came with it. Are those managed? They are inside a folder named: DirectX for Managed Code. The most recent library seems to have the version 1.0.2911.0 last updated on 31-03-2006. Can someone please clarify if these are the libs that were discontinued? I really don't want to use stuff at the edge of dying.

Anyway, I just need a simple solution for drawing 2D graphics inside multiple .NET controls, namely panels and forms. I really don't care if it does not support advanced 3D features or 3D at all, all I need is a solid 2D gfx lib with good support and easy to work with. I wouldn't mind at all using DirectX since I'm a bit familiar with it. But a solution like SDL would be the key. XNA seems to be quite different from those-libs-I'm-not-sure-if-they-are-managed. So I'm avoiding it.

Thank you very much for any possible help in this issue. I'm a developer eager to develop in my not-so-available-spare-time and I have this project I want to share with the rest of the world, but the beginning seems to be challenging already.

Reading pixels from a surface

03 July 2008 - 10:59 PM

I need to read the pixels' colors inside a the locked surface and return their ARGB value. But I don't have a clue on how to do it, I've posted in other forums but with no luck... This is what I've learned so far: int pitch; Surface s = dxDevice.GetBackBuffer(0, 0, BackBufferType.Mono); GraphicsStream gs = s.LockRectangle(new Rectangle(0,0,32,32), LockFlags.None, out pitch); From what I've read, I think the GraphicsStream object will get then a single long number which contains everything from the backbuffer, but I don't understand how do I access a x,y pixel and return their ARGB value from this long number. Thank you for any help

Managed DX - C# - Pixel collision

28 June 2008 - 08:31 AM

Hello, I need to return the pixel color of my backbuffer from a given x,y position, but I don't have a clue how to do it. well, I know I have to get the buffer from the device: Surface s = myDXDevice.GetBackBuffer(); And then lock the surface and use pointers... but how? This is C#. Thank you

Scalling not conserving texture's original coordenates

19 January 2008 - 06:28 AM

Hello, I need to apply scaling to a smoke effect I'm doing for some game I'm currently developing. Sure, scaling, no problem at all, except for the 'small' side effect.

Whenever I scale the sprites their original position is also readjusted (as demonstrated bellow):


Here is the code of the looping which draw all the sprites. I read something about translating, is this related with this problem? If so, could please someone show me how to do it?
for (int i = 0; i < VAR.lActiveExplosions.Count; i++)
    c_explosion c = VAR.lActiveExplosions[i];
    for (int n = 0; n < c.lSmoke.Count; n++)
    sprite3.Transform = Matrix.Scaling(1.0f, 1.0f, 1.0f);                                   

    sprite3.Draw((Texture)c.htGfx[c.lSmoke[n].sSpriteNum], new Rectangle(0,0,6
        4,64), new Vector3(0, 0, 0.1f), new Vector3(c.lSmoke[n].fPosX,        
        c.lSmoke[n].fPosY, 1.0f), 

Thank you very much for any possible help!

[Edited by - EFileTahi-A on January 19, 2008 12:52:15 PM]