And if map's viewport is moved away from 0,0 (top-left corner) and occupy only part of screen (after all tile palette should go somewhere), equation would be:
GridXPosition := OffsetX + ((Mouse.X + ViewpoirtX) div GridCellWidth);
am I correct?
And if map's viewport is moved away from 0,0 (top-left corner) and occupy only part of screen (after all tile palette should go somewhere), equation would be:
GridXPosition := OffsetX + ((Mouse.X + ViewpoirtX) div GridCellWidth);
am I correct?
No, you don't need 2 offset variables, ViewPointX already does that. If you wanted to also draw a tool panel (instead of using IDE components) on the left side, and always draw the entire map more to right, then you would use OffsetX. But then it would be
GridXPosition := ((Mouse.X + ViewPointX - ToolPanelWidth) div GridCellWidth);
Last edited by User137; 13-06-2013 at 04:30 PM.
Well, allegro.pas don't mix well with Lazarus' forms and allegro gui library looks terrible (just look at ASEPRITE for example).
None of the game graphical engines doesn't mix wel with either VCL or LCL. The main reason for this is the technology that is used for each learegly differs from others.
Most game graphical libraries use either DirectX or OpenGL as their main technology.
VCL and LCL use default system GUI which is quite slow in comparison to DirectX or OpenGL. Also the biggest problem of default OS GUI is that it laregly depends on system messages which can also be quite slow. That is why it is much better to create your own internal game messaging system rather than using OS messaging system.
I'm experimenting with forms based ui along with opengl scene rendering, so far so good
Bookmarks