void MyDrawText( HDC hdc, int y, LPCTSTR szText, int CharWidth, int CharHeight, int WindowWidth, COLORREF ColorText, COLORREF ColorBorder ) { SIZE sz; HFONT hf = MakeFont( CharWidth, CharHeight ); HBRUSH hbr = ::CreateSolidBrush( ColorText ); HPEN hpen = ::CreatePen( PS_SOLID, 1, ColorBorder ); HFONT hf1 = (HFONT) ::SelectObject(hdc, hf); HBRUSH hbr1 = (HBRUSH ) ::SelectObject(hdc, hbr); HPEN hpen1 = (HPEN) ::SelectObject(hdc, hpen); int len = lstrlen(szText); GetTextExtentPoint( hdc, szText, len, &sz ); int TextWidth = sz.cx; ::SetBkMode(hdc, TRANSPARENT); ::BeginPath(hdc); ::TextOut(hdc, (WindowWidth - TextWidth)/2, y, szText, len ); ::EndPath(hdc); ::StrokeAndFillPath(hdc); ::SelectObject(hdc, hf1); ::SelectObject(hdc, hbr1); ::SelectObject(hdc, hpen1); ::DeleteObject(hf); ::DeleteObject(hbr); ::DeleteObject(hpen); }
void RenderParameters::Zoom(int z) { zoom = z; min_filter_width = (((int)(z * def_min_width / 100.0))); min_filter_height = (((int)(z * def_min_height / 100.0))); pin_spacing = (int)(z * def_pin_spacing / 100.0); if (font_filter.m_hObject != 0) { font_filter.DeleteObject(); } if (font_pin.m_hObject != 0) { font_pin.DeleteObject(); } int size = 5 + (int) (5.0 * z / 100.0); MakeFont(font_filter, _T("Arial"), size, false, false); size = 5 + (int) (2.0 * z / 100.0); MakeFont(font_pin, _T("Arial"), size, false, false); }
void OGLwin_DrawString(char *s) { if (fontBase < 0) fontBase = MakeFont(Dsp, XFONT_STRING); glPushAttrib(GL_LIST_BIT); glListBase(fontBase); glCallLists(strlen(s), GL_UNSIGNED_BYTE, (GLubyte *) s); glPopAttrib(); }
FilterListCtrl::FilterListCtrl() { MakeFont(font_filter, _T("Tahoma"), 8, false, false); MakeFont(font_filter_sel, _T("Tahoma"), 8, true, false); MakeFont(font_info, _T("Tahoma"), 8, false, false); color_font = RGB(0,0,0); color_info = RGB(128, 128, 128); color_selected = RGB(178, 201, 211); color_error = RGB(255, 0, 0); type_colors[0] = RGB(0,0,0); // Filter type_colors[1] = RGB(0,128,0); // DMO type_colors[2] = RGB(128,0,0); // KSProxy type_colors[3] = RGB(0,0,128); // ACM/ICM type_colors[4] = RGB(128,0,128); // PNP type_colors[5] = RGB(240,128,0); // Selection callback = NULL; filters.RemoveAll(); }
// on load, initilization function void onload() { // load up the font table mfonts[0] = MakeFont("Verdana",14); mfonts[1] = MakeFont("Verdana",20); //mxhwnd.HideCursor(); intro.load(); start.load(); game.load(); shandle.load(); // possibly read in timer speed, to set the timer on #ifndef WIN2K mxhwnd.InitTimer(1,2); #else mxhwnd.InitTimer(1,50); #endif mxhwnd.SetScreen(ID_INTRO); }
bool Game_Init(HWND hwnd) { srand((unsigned int)time(NULL)); Direct3D_Init(hwnd,SCREENW,SCREENH,false); DirectInput_Init(hwnd); //create pointer to the back buffer d3ddev->GetBackBuffer(0, 0, D3DBACKBUFFER_TYPE_MONO, &backbuffer); //create a font font = MakeFont("Arial", 24); BuildGameWorld(); start = GetTickCount(); return true; }
LRESULT CALLBACK ErrorWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { switch (msg) { case WM_CREATE: { RECT r; ::GetClientRect(hWnd, &r); r.left += 10; r.top += 10; r.right -= 10; r.bottom -= 10; gErrorTxt = ::CreateWindow( WC_EDIT, "", WS_VISIBLE | WS_CHILD | ES_AUTOVSCROLL | ES_READONLY | ES_MULTILINE, r.left, r.top, r.right-r.left, r.bottom-r.top, hWnd, 0, 0, 0); MakeFont(); ::SendMessage(gErrorTxt, WM_SETFONT, (WPARAM)gPrettyFont, FALSE); } break; case WM_SIZE: { RECT r; ::GetClientRect(hWnd, &r); r.left += 10; r.top += 10; r.right -= 10; r.bottom -= 10; ::MoveWindow(gErrorTxt, r.left, r.top, r.right-r.left, r.bottom-r.top, true); } break; case WM_CLOSE: ::DestroyWindow(hWnd); break; case WM_DESTROY: gErrorTxt = NULL; gErrorWnd = NULL; break; } return ::DefWindowProc(hWnd, msg, wParam, lParam); }
void OnSplashWndPaint( HWND hWnd ) { PAINTSTRUCT ps; HDC hdc = NULL; RECT rt; //#ifdef _UNICODE //#define MY_T2(x) L#x //#else //#define MY_T2(x) x //#endif //#define MY_T(x) MY_T2(x) LPCTSTR szProduct = TMEX_NAME; //LPCTSTR szVersion = MY_T( VERSIONPRODUCTVERSIONSTR ); //LPCTSTR szCopy1 = MY_T( COPYRIGHT1 ); //LPCTSTR szCopy2 = MY_T( COPYRIGHT2 ); USES_CONVERSION; LPCTSTR szVersion = A2CT( VERSIONPRODUCTVERSIONSTR ); LPCTSTR szCopy1 = A2CT( COPYRIGHT1 ); LPCTSTR szCopy2 = A2CT( COPYRIGHT2 ); hdc = BeginPaint(hWnd, &ps); ::GetClientRect(hWnd, &rt); int width = rt.right - rt.left; // int height = rt.bottom - rt.top; int charWidth = width/lstrlen(szProduct); int MainTextHeight = iSplashInternalHeight*iTextHeightName/100; int y = (iSplashHeight - iSplashInternalHeight)/2; int TextWidth = 0; do { charWidth--; HFONT hf = MakeFont( charWidth, MainTextHeight ); HFONT hf1 = (HFONT)::SelectObject(hdc, hf); SIZE sz; GetTextExtentPoint( hdc, szProduct, lstrlen(szProduct), &sz ); TextWidth = sz.cx; ::SelectObject(hdc, hf1); ::DeleteObject( hf ); } while( TextWidth > iSplashInternalWidth && charWidth > 1 ); HPEN hPen = CreatePen( PS_SOLID, 1, crDarkBorder ); //GetSysColor(COLOR_WINDOWFRAME) ); HPEN hPen1 = (HPEN) ::SelectObject(hdc, hPen); HBRUSH hBrush = CreateSolidBrush( crBackground ); ::Rectangle( hdc, rt.left, rt.top, rt.right, rt.bottom ); rt.left++, rt.top++, rt.right--, rt.bottom--; // Inflate rectangle by 1 pixel ::FillRect( hdc, &rt, hBrush ); ::DeleteObject( hBrush ); ::SelectObject(hdc, hPen1); ::DeleteObject(hPen); int h; h = MainTextHeight; MyDrawText( hdc, y, szProduct, charWidth, h, width, crText, crTextBorder ); y += h; h = iSplashInternalHeight*iTextHeightVersion/100; MyDrawText( hdc, y, szVersion, charWidth*iCharWidthVersion/100, h, width, crText, crTextBorder ); y += h; h = iSplashInternalHeight*iTextHeightCopy1/100; MyDrawText( hdc, y, szCopy1, charWidth*iCharWidthCopy1/100, h, width, crText, crDarkBorder ); y += h; h = iSplashInternalHeight*iTextHeightCopy2/100; MyDrawText( hdc, y, szCopy2, charWidth*iCharWidthCopy2/100, h, width, crText, crDarkBorder ); y += h; EndPaint(hWnd, &ps); }