Einzelnen Beitrag anzeigen

C.Schoch

Registriert seit: 2. Jan 2006
Ort: Wüstenrot
235 Beiträge
 
Turbo Delphi für Win32
 
#17

Re: [Editor] DrawBall - Editor

  Alt 2. Dez 2006, 20:54
Ich hab da mal einen Trick beim Zeichnen des Positionsrechtecks eingebaut, dann klappts auch bei mir.
Kompilieren geht nicht wirklich gut Da Ich nur Delphi 2005 hab.
Delphi-Quellcode:
procedure TForm1.iFocusMouseMove(Sender: TObject; Shift: TShiftState; X,
  Y: Integer);
var
  raster : RPoint;
begin
  raster := RPoint(Point(X div 20, Y div 20));
  if (raster.x <> oldPos.x) or (raster.y <> oldPos.y) then begin
    oldPos := raster;
    iFocus.Picture.Assign(iMap.Picture); // <-- Hier zeichne ich einfach die Map in die Auswahlgrafik da scheinbar die Map von der Auswahlgrafik überschrieben wird

    iFocus.Canvas.MoveTo((raster.x) * 20 + 1, (raster.y) * 20);
    iFocus.Canvas.LineTo((raster.x + 1) * 20 - 1, (raster.y) * 20);

    iFocus.Canvas.MoveTo((raster.x) * 20 + 1, (raster.y + 1) * 20 - 1);
    iFocus.Canvas.LineTo((raster.x + 1) * 20 - 1, (raster.y + 1) * 20 - 1);

    iFocus.Canvas.MoveTo((raster.x) * 20, (raster.y) * 20 + 1);
    iFocus.Canvas.LineTo((raster.x) * 20, (raster.y + 1) * 20 - 1);

    iFocus.Canvas.MoveTo((raster.x + 1) * 20 - 1, (raster.y) * 20 + 1);
    iFocus.Canvas.LineTo((raster.x + 1) * 20 - 1, (raster.y + 1) * 20 - 1);
  end;
end;

procedure TForm1.iFocusMouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
  var
  raster : RPoint;
begin
  if (selected <= 7) and (selected >= 2) then
    iMap.Canvas.Draw((x div 20) * 20, (y div 20) * 20, preBitMaps[0]);

  iMap.Canvas.Draw((x div 20) * 20, (y div 20) * 20, preBitMaps[selected]);

  Map[x div 20][y div 20] := selected;

  raster := RPoint(Point(X div 20, Y div 20)); //<-- Nach dem Zeichnen auf die Grafik muss natürlich die AuswahlGrafik neu gezeichnet werden
  iFocus.Picture.Assign(iMap.Picture);
    iFocus.Canvas.MoveTo((raster.x) * 20 + 1, (raster.y) * 20);
    iFocus.Canvas.LineTo((raster.x + 1) * 20 - 1, (raster.y) * 20);

    iFocus.Canvas.MoveTo((raster.x) * 20 + 1, (raster.y + 1) * 20 - 1);
    iFocus.Canvas.LineTo((raster.x + 1) * 20 - 1, (raster.y + 1) * 20 - 1);

    iFocus.Canvas.MoveTo((raster.x) * 20, (raster.y) * 20 + 1);
    iFocus.Canvas.LineTo((raster.x) * 20, (raster.y + 1) * 20 - 1);

    iFocus.Canvas.MoveTo((raster.x + 1) * 20 - 1, (raster.y) * 20 + 1);
    iFocus.Canvas.LineTo((raster.x + 1) * 20 - 1, (raster.y + 1) * 20 - 1);
end;
Tschau Christian
Das System hofft auf Besserung
[Siemens]
  Mit Zitat antworten Zitat