Hello,

I was drawing tiles for the last few days...damn it sure takes a lot of time...and then it's still , I don't know , not good enough.

Anyway today I've decided to modify the mouse cursor thing, and I was playing with the AthorPanel... and I've realized, that we don't even need , on mouse enter or on mouse leave, or MyMouse valid for that matter, this is what I did :

Code:
 procedure TMain.Panel1MouseMove(Sender: TObject; Shift: TShiftState; X,
  Y: Integer);
begin
  if (MyMouse.Position.X < Panel1.Width) and (MyMouse.Position.Y < Panel1.Height) then    // Mouse can only go till edge of Panel1
    begin
      MyMouse.Position:=Mouse.CursorPos;   // I get mouse cursor position
      dec(myMouse.Position.X, Left+Panel1.Left+Panel2.Width); // I remove from the cursor position
      dec(myMouse.Position.Y, Top+Panel1.Top+Panel4.Height);
    end
  else
    begin
      MyMouse.Position.X:=MyMouse.Position.X-1;  // once it reaches edge , in order not to get stuck... I decrease it's value by 1
      MyMouse.Position.Y:=MyMouse.Position.Y-1;
    end;
end;
And on AsphyreDevice render

Code:
  // get position on map, for example 2;4  , but only if x < 20 and y < 15 , the myMouse.valid was not enough to prevent it from happening
  if (floor(myMouse.Position.X / (Panel1.Width / 20 )) < 20) and (floor(myMouse.Position.Y / (Panel1.Height / 15 )) < 15 ) then
    begin
      map_x_pos:=floor(myMouse.Position.X / (Panel1.Width / 20 ));
      map_y_pos:=floor(myMouse.Position.Y / (Panel1.Height / 15 ));
      Label16.Caption:=inttostr(map_x_pos)+','+inttostr(map_y_pos);
      with Selection do
        begin
            X:=map_x_pos*32;
            Y:=map_y_pos*32;
        end;
    end;
Does the same thing, + better , this way I NEVER-EVER leave the grid, sometimes with previous versions it was possible to leave the grid... the Selection cursor dissapeared, and your position was X:=20, or Y:=15 for example.

Greetings
Robert