Stilllegung des Forums
Das Forum wurde am 05.06.2023 nach über 20 Jahren stillgelegt (weitere Informationen und ein kleiner Rückblick).
Registrierungen, Anmeldungen und Postings sind nicht mehr möglich. Öffentliche Inhalte sind weiterhin zugänglich.
Das Team von spieleprogrammierer.de bedankt sich bei der Community für die vielen schönen Jahre.
Wenn du eine deutschsprachige Spieleentwickler-Community suchst, schau doch mal im Discord und auf ZFX vorbei!
Werbeanzeige
Zitat von »"msdn"«
lpPoint [in]: Pointer to an array of three points in logical space that identify three corners of the destination parallelogram. The upper-left corner of the source rectangle is mapped to the first point in this array, the upper-right corner to the second point in this array, and the lower-left corner to the third point. The lower-right corner of the source rectangle is mapped to the implicit fourth point in the parallelogram.
...
The fourth vertex of the parallelogram (D) is defined by treating the first three points (A, B, and C) as vectors and computing D = B + C A.
Zitat von »"$nooc"«
ich brauch in einem array 3 punkte des parallelogramms in das ich das bild verschieben will, aber wie berechne ich diese?
Quellcode |
|
1 2 3 4 5 6 7 8 |
p[0].x = o.x + (-w/2 * cos(a) + h/2 * sin(a)) p[0].y = o.y + (-w/2 * sin(a) - h/2 * cos(a)) p[1].x = o.x + (w/2 * cos(a) + h/2 * sin(a)) p[1].y = o.y + (w/2 * sin(a) - h/2 * cos(a)) p[2].x = o.x + (-w/2 * cos(a) - h/2 * sin(a)) p[2].y = o.y + (-w/2 * sin(a) + h/2 * cos(a)) |
Zitat von »"$nooc"«
wie soll das array eigentlich aussehn?
C-/C++-Quelltext |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
void Graphics_RenderImage() { POINT Point[3]; Point[0].x = 0 + (-24/2 * cos(90.0) + 24/2 * sin(90.0)); Point[0].y = 0 + (-24/2 * sin(90.0) + 24/2 * cos(90.0)); Point[1].x = 0 + (-24/2 * cos(90.0) + 24/2 * sin(90.0)); Point[1].y = 0 + (-24/2 * sin(90.0) + 24/2 * cos(90.0)); Point[2].x = 0 + (-24/2 * cos(90.0) + 24/2 * sin(90.0)); Point[2].y = 0 + (-24/2 * sin(90.0) + 24/2 * cos(90.0)); // Bei den letzten 3 Parametern hab ich keinen Plan PlgBlt(Player.dcPlayerDCs, Point, Player.dcPlayerDCs, 0, 0, 24, 24, 0, 0, 0); TransparentBlt(dcBackBuffer, Player.x_pos, Player.y_pos, 24, 24, Player.dcPlayerDCs, 0, 0, 24, 24, RGB(0, 255, 0)); } // Graphics_RenderImage() |
Zitat
Point[0].x = 0 + (-24/2 * cos(90.0) + 24/2 * sin(90.0));
Zitat von »"dot"«
EDIT:
und gleich noch ne warnung dazu: die C++ sin/cos funktionen wollen den winkel in rad haben, nicht in °...
Zitat von »"$nooc"«
aber was ist eig. mit den letzten 3 parametern?
Zitat von »"dot"«
die letzten 3 parameter brauchst du nur, wenn du eine maske hast. damit gibst du an, ob bereiche des bildes transparent sein sollen. ich denk die setzt du auf 0 wenn du sie nicht brauchst, also sollte das schon passen
Werbeanzeige