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
Anonymous
unregistriert
C-/C++-Quelltext |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
HBITMAP RotateBmp(HWND hWnd, HBITMAP hBmp, INT Winkel) { HDC hDC; HDC hBmpDC; HDC hRotatedBmpDC; HBITMAP hRotatedBmp; COLORREF cv; int x1,y1,x2,y2; double w; hDC=GetDC(hWnd); hBmpDC=CreateCompatibleDC(hDC); hRotatedBmpDC=CreateCompatibleDC(hDC); hRotatedBmp=CreateCompatibleBitmap(hDC, 128, 64); SelectObject(hBmpDC, hBmp); SelectObject(hRotatedBmpDC, hRotatedBmp); w=DegToRad(Winkel); for(y1=0;y1<64;y1++) { for(x1=0;x1<128;x1++) { x2=(INT)((x1-64)*cos(w)-(y1-32)*sin(w)+64); y2=(INT)((x1-64)*sin(w)+(y1-32)*cos(w)+32); if(x2>=0&&x2<128&&y2>=0&&y2<64) { cv=GetPixel(hBmpDC, x2, y2); } else { cv=0; } SetPixel(hRotatedBmpDC, x1, y1, cv); } } DeleteDC(hBmpDC); DeleteDC(hRotatedBmpDC); ReleaseDC(hWnd, hDC); return(hRotatedBmp); } |
Anonymous
unregistriert
C-/C++-Quelltext |
|
1 2 3 4 |
void sprite::roto() { SDL_Surface * rotozoomSurface (SDL_Surface *src, double angle, double zoom, int smooth); } |
C-/C++-Quelltext |
|
1 |
c:\programme\microsoft visual studio\vc98\include\math.h(514) : error C2894: Vorlagen koennen nicht mit 'C'-Bindung deklariert werden |
Zitat von »"unsigned long"«
Natives rotieren (in GDI):
C-/C++-Quelltext
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 for(y1=0;y1<height1;y1++) { for(x1=0;x1<width1;x1++) { x2=(INT)((x1-width1 /2)*cos(w)-(y1-height1 /2)*sin(w)+width2 /2); y2=(INT)((x1-widht1 /2)*sin(w)+(y1-height1 /2)*cos(w)+heigth2 /2); if(x2>=0&&x2<width2&&y2>=0&&y2<heigth2) { cv=GetPixel(hBmpDC, x1, y1); } else { cv=0; } SetPixel(hRotatedBmpDC, x2, y2, cv); } } DeleteDC(hBmpDC); DeleteDC(hRotatedBmpDC); ReleaseDC(hWnd, hDC); return(hRotatedBmp); }
Easy
Werbeanzeige