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
Quellcode |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
#pragma once #include "ddutil.h" class display { private: CDisplay dsply; // Das Display CSurface *hgrnd; // Hintergrund ... public: display(void); void free_all(); HRESULT init( HWND wnd); void hintergrund(){dsply.Blt(0, 0, hgrnd);} |
Quellcode |
|
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 36 37 38 39 40 41 42 43 44 45 |
void display::free_all() { if( hgrnd) delete hgrnd; ... } HRESULT display::init(HWND wnd) { HRESULT hr; hr = dsply.CreateWindowedDisplay(wnd, 360, 520); if (hr < 0) return hr; hr = dsply.CreateSurfaceFromBitmap( &hgrnd, "ul_hgrnd.bmp", 360, 520); .... } HRESULT display::restore() { HRESULT hr; hr = dsply.GetDirectDraw()->RestoreAllSurfaces(); if (hr < 0) return hr; hr = dsply.CreateSurfaceFromBitmap( &hgrnd, "ul_hgrnd.bmp", 360, 520); } HRESULT display::present() { HRESULT hr; hr = dsply.Present(); if (hr == DDERR_SURFACELOST) return restore(); return hr; } display::~display(void) { free_all(); } |
Anonymous
unregistriert
Anonymous
unregistriert
Quellcode |
|
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 36 |
int test_width = 100; int test_height = 100; static int test_posx = 200; static int test_posy = 0; static long test_ix = 0; static long test_iy = 100; static int test_iwidth = 100; static long test_iheight = 1; static int test_start = 0; static int test_counter = 0; // nur am anfang anzeigen, wenn z.B. leertaste gedrückt if(test_start) { // wenn nicht alles sichtbar if(test_iy > 0) { test_iy--; } else { test_start = 0; } test_counter = (test_height-1) - test_iy; for(int i = (test_height-1); i >= test_iy; i--) { test_.drawEx(test_posx, test_counter, test_ix, i, test_iwidth, test_iheight); test_counter--; } } else { test_iy = (test_height-1); } |
Anonymous
unregistriert
Werbeanzeige