Autor Beitrag
hansdergott
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 55

XP Mediacenter Edition; XP Home
Delphi
BeitragVerfasst: So 10.08.08 11:56 
hallo zusammen

wie kann ich mit einem array[1..10] einzelne punte mit den variabeln x,y und color ausstatten also diese array's wie pixel behandeln und wie wende ich es an wenn ich diese 10 bewegen möchte

muss ich das mit einem TPoint machen? :?:
kann mir da jemand helfen :idea:

danke im vorraus

bye

Moderiert von user profile iconNarses: überflüssige Leerzeilen entfernt
GTA-Place
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
EE-Regisseur
Beiträge: 5248
Erhaltene Danke: 2

WIN XP, IE 7, FF 2.0
Delphi 7, Lazarus
BeitragVerfasst: So 10.08.08 12:26 
Mit einem record geht's am Besten:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
type
  TMyRecord = record
    Point: TPoint;
    Color: TColor;
  end;


// ... //

var
  MyRecord: Array[1..10] of TMyRecord;
begin
  MyRecord[0].Point.X := 10;
  MyRecord[0].Point.Y := 10;
  MyRecord[0].Color := clBlack;
end;


EDIT: Erster :D Aber Fehler drin gehabt :roll:

_________________
"Wer Ego-Shooter Killerspiele nennt, muss konsequenterweise jeden Horrorstreifen als Killerfilm bezeichnen." (Zeit.de)


Zuletzt bearbeitet von GTA-Place am So 10.08.08 12:30, insgesamt 1-mal bearbeitet
Hidden
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 2242
Erhaltene Danke: 55

Win10
VS Code, Delphi 2010 Prof.
BeitragVerfasst: So 10.08.08 12:28 
Hi,

Also mal abgesehen davon, dass du dann wohl besser gleich eine Bitmap nimmst, da die denn noch zusätzliche Methoden bietet.. 8)

Nimmst du ein mehrdimensionales Array: 'Array[0..1023, 0..767] of TColor;'.

Edit: Aso^^ Wenn du einzelne Punkte speichern willst, ist das natürlich klar :autsch:

mfG,

_________________
Centaur spears can block many spells, but no one tries to block if they see that the spell is a certain shade of green. For this purpose it is useful to know some green stunning hexes. (HPMoR)


Zuletzt bearbeitet von Hidden am So 10.08.08 12:31, insgesamt 1-mal bearbeitet
elundril
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 3747
Erhaltene Danke: 123

Windows Vista, Ubuntu
Delphi 7 PE "Codename: Aurora", Eclipse Ganymede
BeitragVerfasst: So 10.08.08 12:28 
Mist, zu langsam. aber wenn dann doch so, oder??

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
type 
  TMyRecord = record 
    Point: TPoint; 
    Color: TColor; 
  end; 

// ... // 

var 
  MyRecord: Array[1..10] of TMyRecord; 
begin 
  MyRecord[0].Point.X := 10; 
  MyRecord[0].Point.Y := 10; 
  MyRecord[0].Color := clBlack; 
end;

_________________
This Signature-Space is intentionally left blank.
Bei Beschwerden, bitte den Beschwerdebutton (gekennzeichnet mit PN) verwenden.
hansdergott Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 55

XP Mediacenter Edition; XP Home
Delphi
BeitragVerfasst: So 10.08.08 21:04 
Titel: funktioniert leider nicht
hallo

ich habe das jetzt mit einem record programmiert aber ich musste ein haufen überwachungen programmieren um zu erkennen das ich folgendes problem habe
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
type Partikel= record
     x:integer;
     y:integer;
     farbe:Tcolor;
     alter:integer;
     maxalter:integer;
     tot:integer;
end;

zb:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
partikel[1].x:=10;
partikel[1].Y:=10;
partikel[1].alter:=random(10);
partikel[1].maxalter:=10;
partikel[1].tot:=0;
partikel[1].farbe:=rgb(random(255),random(255),random(255));

for nr:=1 to partikelanz do
begin 
if partikel[nr].alter>=10 then
begin
partikel[nr].farbe:=clblack;
box1.Canvas.Pixels[p[nr].x , p[nr].y] := p[nr].farbe;
end;
end;
end;
das alter wird mit einem timer immer um eins erhöht bis es schießlich 10 erreicht hatt danach sollte der partikel mit der farbe schwarz übermalt werden tuts aber leider nicht anschließen wir das partikel in der liste für verbrauchte partikel auf "inaktiv" gesetzt damit beim nächsten mal dieses wieder mit verwendet wird

wie kann ich das jetzt lösen im moment male ich die partikel in einer paintbox auf die von mir eingegebenen x,y & farbwerten

gibt es da moch ne andere möglichkeit

wie kann ich diese einzelnen punte als object benutzen/setzen wie in einem zeichenprogramm meinetwegen anklicken und verschieben

danke im voraus

Moderiert von user profile iconNarses: Delphi-Tags hinzugefügt
hansdergott Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 55

XP Mediacenter Edition; XP Home
Delphi
BeitragVerfasst: Sa 16.08.08 18:01 
Titel: hat sich erledigt
habs gefunden

durch das verändern der point daten und ein neuzeichnen kann ich die einzelnen punkte ist mir es gelungen
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
partikel[nr].Position.X := partikel[nr].Position.X + random(partikel[nr].geschw_x);
partikel[nr].Position.Y := partikel[nr].Position.Y + random(partikel[nr].geschw_y);

xx:=partikel[nr].Position.X;
yy:=partikel[nr].Position.Y;

deckbild.Canvas.Pen.Color:=partikel[nr].farbe;
deckbild.Canvas.Brush.Color:=clblack;
deckbild.Canvas.Ellipse(xx -(partikel[nr].gr),
                        yy +(partikel[nr].gr),
                        xx +(partikel[nr].gr),
                        yy -(partikel[nr].gr));
end;
form1.Canvas.Draw(0,0,deckbild);
timer1.Enabled:=true;
exit;
end;

trotzden an alle vielen dank
bye

Moderiert von user profile iconNarses: Delphi-Tags hinzugefügt
Hidden
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 2242
Erhaltene Danke: 55

Win10
VS Code, Delphi 2010 Prof.
BeitragVerfasst: So 17.08.08 07:19 
Hi,

Deinen Quelltext packst du am besten in <span class="inlineSyntax"><span class="codecomment">{PROTECTTAGa40fe487f37e2172c255dba31e5b86b3}</span></span>.

In den Delphi-Tags solltest du dich mal mit Suche in der Entwickler-Ecke CODEFORMATIERUNG beschäftigen, das ist grauenhaft zu lesen ;)

mfG,

_________________
Centaur spears can block many spells, but no one tries to block if they see that the spell is a certain shade of green. For this purpose it is useful to know some green stunning hexes. (HPMoR)