void ConfigFont( void ) { wnd_class_wv wndclass; PrintFont( WND_ALL, NULL ); for( wndclass = 0; wndclass < WND_NUM_CLASSES; ++wndclass ) { if( wndclass == WND_ALL ) continue; PrintFont( wndclass, WndFontInfo[WND_ALL] ); } }
int main(int ac, const char *av[]) { const uint8_t *p = nullptr; for (int i = 1; i < ac; ++i) { p = nullptr; /***/if (ac > 1 && strstr(av[i], "04x06") != nullptr) p = font_04x06; else if (ac > 1 && strstr(av[i], "05x08") != nullptr) p = font_05x08; else if (ac > 1 && strstr(av[i], "05x12") != nullptr) p = font_05x12; else if (ac > 1 && strstr(av[i], "06x08") != nullptr) p = font_06x08; else if (ac > 1 && strstr(av[i], "06x10") != nullptr) p = font_06x10; else if (ac > 1 && strstr(av[i], "07x12") != nullptr) p = font_07x12; else if (ac > 1 && strstr(av[i], "08x08") != nullptr) p = font_08x08; else if (ac > 1 && strstr(av[i], "08x12") != nullptr) p = font_08x12; else if (ac > 1 && strstr(av[i], "08x14") != nullptr) p = font_08x14; else if (ac > 1 && strstr(av[i], "10x16") != nullptr) p = font_10x16; else if (ac > 1 && strstr(av[i], "12x16") != nullptr) p = font_12x16; else if (ac > 1 && strstr(av[i], "12x20") != nullptr) p = font_12x20; else if (ac > 1 && strstr(av[i], "16x26") != nullptr) p = font_16x26; if (p) PrintFont(p); else { FILE *fin = stdin; if (ac > 1) fin = fopen(av[i], "r"); ReadFont(fin); if (ac > 1) fclose(fin); } } }
__declspec(naked) void HookFpsFunc() { PrintFont(0, 30, 20, 0.0f, 0xFF00FFFF, "FPS 20"); __asm { //push eax //mov eax ,FpsFuncAddress //call eax //pop eax ret } }
void Game_Run(HWND window) { //make sure the Direct3D device is valid if (!d3ddev) return; //update input devices DirectInput_Update(); d3ddev->Clear(0, NULL, D3DCLEAR_TARGET , D3DCOLOR_XRGB(0,0,100), 1.0f, 0); bool isInput = false; SpeedX = 0; SpeedY = 0; //scroll based on key or controller input if (Key_Down(DIK_DOWN) || controllers[0].sThumbLY < -2000) { SpeedY = steps; isInput = true; } if (Key_Down(DIK_UP) || controllers[0].sThumbLY > 2000) { SpeedY = -steps; isInput = true; } if (Key_Down(DIK_LEFT) || controllers[0].sThumbLX < -2000) { SpeedX = -steps; isInput = true; } if (Key_Down(DIK_RIGHT) || controllers[0].sThumbLX > 2000) { SpeedX = steps; isInput = true; } //keep the game running at a steady frame rate if (GetTickCount() - start >= 30) { //reset timing start = GetTickCount(); //start rendering if (d3ddev->BeginScene()) { //update the scrolling view ScrollScreen(isInput); spriteobj->Begin(D3DXSPRITE_ALPHABLEND); std::ostringstream oss; oss << "Scroll Position = " << ScrollX << "," << ScrollY; PrintFont(font, 0, 0, oss.str()); spriteobj->End(); //stop rendering d3ddev->EndScene(); d3ddev->Present(NULL, NULL, NULL, NULL); } } //to exit if (Key_Down(VK_ESCAPE) || controllers[0].wButtons & XINPUT_GAMEPAD_BACK) gameOver = true; }