/** Resize a clock tray component. */ void Resize(TrayComponentType *cp) { ClockType *clk; TimeType now; Assert(cp); clk = (ClockType*)cp->object; Assert(clk); if(cp->pixmap != None) { JXFreePixmap(display, cp->pixmap); } cp->pixmap = JXCreatePixmap(display, rootWindow, cp->width, cp->height, rootDepth); memset(&clk->lastTime, 0, sizeof(clk->lastTime)); GetCurrentTime(&now); DrawClock(clk, &now); }
void NLS::Map::Draw() { for (uint32_t i = 0; i < Backgrounds.size(); ++i) { Backgrounds[i]->Draw(); } for (uint32_t i = 0; i < Reactor::Reactors.size(); ++i) { Reactor::Reactors[i]->Draw(); } for (uint8_t i = 0; i < 8; i++) { Layers[i].Draw(); if (!Login and ThisPlayer->layer == i) { ThisPlayer->Draw(); } } for (uint32_t i = 0; i < Life::Mobs.size(); ++i) { Life::Mobs[i]->Draw(); } for (uint32_t i = 0; i < Life::Npcs.size(); ++i) { Life::Npcs[i]->Draw(); } for_each(Players.begin(), Players.end(), [](pair<uint32_t, Player*> p){p.second->Draw();}); for_each(Portal::begin(), Portal::end(), [](Portal* p){p->Draw();}); for (uint32_t i = 0; i < Foregrounds.size(); ++i) { Foregrounds[i]->Draw(); } DrawClock(); if(Login) { NLS::Sprite frameImg = WZ["UI"]["Login"]["Common"]["frame"]; frameImg.Draw(View::x+400,View::y+300); } }
/******************************************************************************* 関数名: void DrawGame(void) 引数: なし 戻り値: なし 説明: ゲームの描画関数 *******************************************************************************/ void DrawGame(void) { //カメラの設置 SetCamera(); //ステージの描画処理 DrawStageManager(); DrawMeshDome(); //DrawModel(); DrawParticle(); DrawEnemy(); DrawEnemyBullet(); DrawItemBullet(); if( IsDebugMode()) DrawPlayer(); DrawPlayerBullet(); DrawGun(); DrawShadow(); //DrawBillBoard(); DrawTime(); DrawGunSight(); DrawNumBullet(); DrawNumLife(); DrawClock(); DrawEnemyNum(); }
LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { static int cxClient, cyClient ; static SYSTEMTIME stPrevious ; BOOL fChange ; HDC hdc ; PAINTSTRUCT ps ; SYSTEMTIME st ; switch (message) { case WM_CREATE : SetTimer (hwnd, ID_TIMER, 1000, NULL) ; GetLocalTime (&st) ; stPrevious = st ; return 0 ; case WM_SIZE : cxClient = LOWORD (lParam) ; cyClient = HIWORD (lParam) ; return 0 ; case WM_TIMER : GetLocalTime (&st) ; fChange = st.wHour != stPrevious.wHour || st.wMinute != stPrevious.wMinute ; hdc = GetDC (hwnd) ; SetIsotropic (hdc, cxClient, cyClient) ; SelectObject (hdc, GetStockObject (WHITE_PEN)) ; DrawHands (hdc, &stPrevious, fChange) ; SelectObject (hdc, GetStockObject (BLACK_PEN)) ; DrawHands (hdc, &st, TRUE) ; ReleaseDC (hwnd, hdc) ; stPrevious = st ; return 0 ; case WM_PAINT : hdc = BeginPaint (hwnd, &ps) ; SetIsotropic (hdc, cxClient, cyClient) ; DrawClock (hdc) ; DrawHands (hdc, &stPrevious, TRUE) ; EndPaint (hwnd, &ps) ; return 0 ; case WM_DESTROY : KillTimer (hwnd, ID_TIMER) ; PostQuitMessage (0) ; return 0 ; } return DefWindowProc (hwnd, message, wParam, lParam) ; }
VOID ClkPaint (HWND hwnd) { RECTL rclUpdate; HPS hpsWnd; if (cp.usDispMode & DM_ANALOG) { WinBeginPaint (hwnd, hps, &rclUpdate); GpiCreateLogColorTable (hps, 0L, LCOLF_RGB, 0L, 0L, (PLONG)NULL); WinFillRect (hps, &rclUpdate, cp.clrBackground); if (fBufferDirty) { DrawClock (hpsBuffer); fBufferDirty = FALSE; } UpdateScreen (hps, &rclUpdate); /* * Draw the second hand last, so xor will work. */ if (fShowSecondHand && (cp.usDispMode & DM_SECONDHAND)) ClkDrawHand(hps, HT_SECOND, dt.seconds); WinEndPaint (hps); } else { /*For now, if it is not Analog, it must be digital*/ hpsWnd = WinBeginPaint (hwnd, NULLHANDLE, &rclUpdate); GpiCreateLogColorTable(hpsWnd, 0L, LCOLF_RGB, 0L, 0L, (PLONG) NULL); WinFillRect (hpsWnd, &rclUpdate, cp.clrBackground); memset (achOldTime, 0, sizeof(achOldTime)); memset (achOldAmPm, '0', sizeof(achOldAmPm)); memset (achOldDate, '0', sizeof(achOldDate)); DrawDigitalTime (hwnd); WinEndPaint (hpsWnd); } }
/** Update a clock tray component. */ void SignalClock(const TimeType *now, int x, int y, Window w, void *data) { ClockType *cp = (ClockType*)data; const char *longTime; DrawClock(cp, now); if(cp->cp->tray->window == w && abs(cp->mousex - x) < settings.doubleClickDelta && abs(cp->mousey - y) < settings.doubleClickDelta) { if(GetTimeDifference(now, &cp->mouseTime) >= settings.popupDelay) { longTime = GetTimeString("%c", cp->zone); ShowPopup(x, y, longTime, POPUP_CLOCK); } } }
// // FUNCTION: WndProc(HWND, UINT, WPARAM, LPARAM) // // PURPOSE: Processes messages for the main window. // // WM_COMMAND - process the application menu // WM_PAINT - Paint the main window // WM_DESTROY - post a quit message and return // // LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { int wmId, wmEvent; PAINTSTRUCT ps; HDC hdc; static int cxClient, cyClient; static SYSTEMTIME stPrevious; BOOL fChange; SYSTEMTIME st; switch (message) { case WM_CREATE: SetTimer(hWnd, ID_TIMER, 1000, NULL); GetLocalTime(&st); stPrevious = st; return 0; case WM_SIZE: cxClient = LOWORD(lParam); cyClient = HIWORD(lParam); return 0; case WM_TIMER: GetLocalTime(&st); fChange = ((st.wHour != stPrevious.wHour) || (st.wMinute != stPrevious.wMinute)); hdc = GetDC(hWnd); SetIsotropic(hdc, cxClient, cyClient); SelectObject(hdc, GetStockObject(WHITE_PEN)); DrawHands(hdc, &stPrevious, fChange); SelectObject(hdc, GetStockObject(BLACK_PEN)); DrawHands(hdc, &st, TRUE); ReleaseDC(hWnd, hdc); stPrevious = st; return 0; case WM_COMMAND: wmId = LOWORD(wParam); wmEvent = HIWORD(wParam); // Parse the menu selections: switch (wmId) { case IDM_ABOUT: DialogBox(hInst, MAKEINTRESOURCE(IDD_ABOUTBOX), hWnd, About); break; case IDM_EXIT: DestroyWindow(hWnd); break; default: return DefWindowProc(hWnd, message, wParam, lParam); } break; case WM_PAINT: hdc = BeginPaint(hWnd, &ps); // TODO: Add any drawing code here... SetIsotropic(hdc, cxClient, cyClient); DrawClock(hdc); DrawHands(hdc, &stPrevious, TRUE); EndPaint(hWnd, &ps); break; case WM_DESTROY: KillTimer(hWnd, ID_TIMER); PostQuitMessage(0); break; default: return DefWindowProc(hWnd, message, wParam, lParam); } return 0; }
int cr_CreditsUNI(HWND hWnd, AUDIO_DATA * p_ad) { DWORD dwStart, dwStop, dwEplased = 0; int y = 868; int dy = 868*2 + 2000; char text[256]; char cbmp[256]; FILE *file; int c = 0; int bmp = 0; RECT r; float f = p_ad->Music_Gain; int i; CREDIT_SURFACE cs[CREDIT_SURFACES]; int iActual = 0; int iClock[12]; APAK_HANDLE *hArchive = NULL; int error; for(i=0;i<12;i++) iClock[i] = -1; LoadClock(iClock); if(iClock[0] != -1) { ddxResizeCursorBack(iClock[0]); DrawClock(iClock, 0); } if(ogg_playing()) { while(f >= 0.05f) { f -= 0.05f; ogg_gain(f); Sleep(25); DrawClock(iClock, 0); } ap_Stop_Song(p_ad); } for(i=0;i<CREDIT_SURFACES;i++) { cs[i].iSurface = -1; cs[i].x = 0; cs[i].y = 0; } strcpy(text,BITMAP_DIR); chdir(text); hArchive = apakopen(cFontFile[2], text, &error); if(!hArchive) return 0; else hArchive->pActualNode = hArchive->pRootNode->pNextNode; file = aopen(hArchive, "credits.txt", "r"); if(!file) return 0; aunicode(file); while(!aeof(file)) { agets(text, 256, file); c++; } DrawClock(iClock, 1); aseek(file, 2, SEEK_SET); dy += c * 75; if(c > CREDIT_SURFACES-1) { kprintf(1, "Kredity: radku je vic jak surfacu!"); apakclose(&hArchive); return 0; } ddxSetFlip(0); fn_Set_Font(cFontFile[0]); DrawClock(iClock, 2); fn_Load_Bitmaps(); DrawClock(iClock, 3); cs[iActual].iSurface = ddxLoadBitmap("anakreon_small.bmp", pBmpArchive); if(cs[iActual].iSurface == -1) { cr_Release_Bitmaps(cs, iClock); apakclose(&hArchive); return 0; } else cr_Set_Surface(&cs[iActual], y); DrawClock(iClock, 4); y+= 250; iActual++; cs[iActual].iSurface = ddxLoadBitmap("cinemax_small.bmp", pBmpArchive); if(cs[iActual].iSurface == -1) { cr_Release_Bitmaps(cs, iClock); apakclose(&hArchive); return 0; } else cr_Set_Surface(&cs[iActual], y); iActual++; y+= 768; DrawClock(iClock, 5); r.left = 0; r.right = 1024; r.top = 0; r.bottom = 90; while(!aeof(file)) { ZeroMemory(text, 256); agets(text, 256, file); if(text[0] == '$') { if(bmp < 5) { if(bmp) { sprintf(cbmp, "brouk%d.bmp", bmp); cs[iActual].iSurface = ddxLoadBitmap(cbmp, pBmpArchive); if(cs[iActual].iSurface == -1) { cr_Release_Bitmaps(cs, iClock); apakclose(&hArchive); return 0; } else { cr_Set_Surface(&cs[iActual], y); y += ddxGetHight(cs[iActual].iSurface); iActual++; } } bmp++; } cs[iActual].iSurface = ddxCreateSurface(1024, 90, ddxFindFreeSurface()); if(cs[iActual].iSurface == -1) { cr_Release_Bitmaps(cs, iClock); apakclose(&hArchive); return 0; } else { ddxCleareSurfaceColor(cs[iActual].iSurface, 0); cr_Set_Text_CenterW(cs[iActual].iSurface, (WCHAR *)text, 1, r); cs[iActual].y = y; iActual++; } } else if(strcmp(text,"\n") && strlen(text)) { cs[iActual].iSurface = ddxCreateSurface(1024, 90, ddxFindFreeSurface()); if(cs[iActual].iSurface == -1) { cr_Release_Bitmaps(cs, iClock); apakclose(&hArchive); return 0; } else { ddxCleareSurfaceColor(cs[iActual].iSurface, 0); cr_Set_Text_CenterW(cs[iActual].iSurface, (WCHAR *)text, 0, r); cs[iActual].y = y; iActual++; } } y += 80; if(iActual >= CREDIT_SURFACES) { kprintf(1, "iActual >= CREDIT_SURFACES !!!!!!!!!!!"); break; } DrawClock(iClock, 6); } aclose(file); y = 0; ap_Play_Song(11,0, p_ad); ddxResizeCursorBack(0); ddxSetCursorSurface(0); for(i=0;i<12;i++) if(iClock[i] != -1) { ddxReleaseBitmap(iClock[i]); iClock[i] = -1; } ddxSetCursor(0); dwStart = timeGetTime(); while(!key[K_ESC]) { y = (int)ftoi((dwEplased * dy) / (float) 195000); if(y >= dy) key[K_ESC] = 1; cr_Draw_Creadits(cs, y); dwStop = timeGetTime(); dwEplased = dwStop - dwStart; ddxRestore(p_ad); } cr_Release_Bitmaps(cs, iClock); fn_Release_Font(1); if(ogg_playing()) ap_Stop_Song(p_ad); //Sleep(1000); ap_Play_Song(0, 0, p_ad); ddxSetCursor(1); ddxSetFlip(1); key[K_ESC] = 0; apakclose(&hArchive); return 0; }
//========================================================================= __myevic__ void ShowScreenSaver() { DrawClock( 54 ); }