コード例 #1
0
ファイル: FallingBall.c プロジェクト: 0circle0/FallingBall
int main()
{
    SetupAll();
    SetupBalls();
    DoTimers();
    LoadBitmaps();
    DoBlock();
    while (!key[KEY_ESC] && GoGame == 1)
    {
        CheckDead();
        CheckBlock();
        MoveBall();
        if (BallsToDrop > 0)
            DropBalls();
        if (Lives <= 0)
            GoGame = 0;
        DrawBack();
        CheckExplode();
        DrawBalls();
        MoveMouse();
        MoveStoneBlock();
        WaitTimer();
        flip();
    }
    EndOfGame();
    allegro_exit(); //Clean up allegro
    return 0;
}
コード例 #2
0
ファイル: wbbutton.cpp プロジェクト: else-if/FlatTabCtrl
void CWBButton::SetButtonDef(int TopHeight, int BottomHeight, int LeftWidth, int RightWidth)
{
	m_TopHeight = TopHeight;
	m_BottomHeight = BottomHeight;
	m_LeftWidth = LeftWidth;
	m_RightWidth = RightWidth;

	if (m_RcId != 0 && m_NumofPics != 0)
	{
		LoadBitmaps(m_RcId, m_NumofPics, TopHeight, BottomHeight, LeftWidth, RightWidth);
	}
}
コード例 #3
0
ファイル: bmpbtn.cpp プロジェクト: ABratovic/open-watcom-v2
BOOL CBitmapButton::AutoLoad( UINT nID, CWnd *pParent )
/*****************************************************/
{
    if( !SubclassDlgItem( nID, pParent ) ) {
        return( FALSE );
    }

    CString strText;
    GetWindowText( strText );
    ASSERT( strText.GetLength() > 0 );

    if( !LoadBitmaps( strText + _T("U"), strText + _T("D"), strText + _T("F"),
                      strText + _T("X") ) ) {
        return( FALSE );
    }

    SizeToContent();
    return( TRUE );
}
コード例 #4
0
IFaceposerModels::CFacePoserModel::CFacePoserModel( char const *modelfile, StudioModel *model )
{
	m_pModel = model;
	m_szActorName[ 0 ] = 0;
	m_szShortName[ 0 ] = 0;
	strcpy( m_szModelFileName, modelfile );
	Q_FixSlashes( m_szModelFileName );

	CStudioHdr *hdr = model->GetStudioHdr();
	if ( hdr )
	{	
		Q_StripExtension( hdr->pszName(), m_szShortName, sizeof( m_szShortName ) );
	}

	m_bVisibileIn3DView = false;
	m_bFirstBitmapLoad = true;

	LoadBitmaps();
}
コード例 #5
0
ファイル: winbtn.cpp プロジェクト: jbeaurain/omaha_vs2010
// Autoload will load the bitmap resources based on the text of
//  the button
// Using suffices "U", "D", "F" and "X" for up/down/focus/disabled
BOOL CBitmapButton::AutoLoad(UINT nID, CWnd* pParent)
{
	// first attach the CBitmapButton to the dialog control
	if (!SubclassDlgItem(nID, pParent))
		return FALSE;

	CString buttonName;
	GetWindowText(buttonName);
	ASSERT(!buttonName.IsEmpty());      // must provide a title

	LoadBitmaps(buttonName + _T("U"), buttonName + _T("D"),
	  buttonName + _T("F"), buttonName + _T("X"));

	// we need at least the primary
	if (m_bitmap.m_hObject == NULL)
		return FALSE;

	// size to content
	SizeToContent();
	return TRUE;
}
コード例 #6
0
ファイル: Timeout.cpp プロジェクト: mnar53/xlloop
void Timeout::Initialise(HINSTANCE hInstance, dictionary* ini)
{
    if(g_Initialised)
        return;

    // Check if the user wants this feature
    bool disable = iniparser_getboolean(ini, DISABLE_OPTION, false);
    if(disable) return;
    g_CanCancel = !iniparser_getboolean(ini, DISABLE_CANCEL, false);

    // Do some background stuff
    RegisterWindowClass(hInstance);
    LoadBitmaps(hInstance);

    // Create our font
    HDC hDC = GetDC(NULL);
    DWORD h = -MulDiv(10, GetDeviceCaps(hDC, LOGPIXELSY), 72);
    g_Font = CreateFont(h, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "Arial");
    g_hInstance = hInstance;
    g_Initialised = true;
}
コード例 #7
0
BitmapParticleType::BitmapParticleType( const string &name):
    ParticleType( name)
{
    XTRACE();
    LoadBitmaps();
}
コード例 #8
0
ファイル: StartupView.cpp プロジェクト: identity0815/os45
int CStartupView::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
   if (CScrollView::OnCreate(lpCreateStruct) == -1)
      return -1;
   CMainFrameA* pMainFrame = CMainFrameA::GetCurrentInstance();
   if(pMainFrame!=NULL)
   {
     m_pImageManager = pMainFrame->GetCommandBars()->GetImageManager();
   }
   WCHAR *pFontName = _T("Segoe UI");
   LOGFONT logFontBtn;
   XTPPaintManager()->GetRegularFont()->GetLogFont(&logFontBtn);
   //WCHAR *pFontName = _T("Segoe UI");
   _tcscpy(logFontBtn.lfFaceName, pFontName);
   //logFontBtn.lfUnderline = true;
   logFontBtn.lfHeight = 12 + 2;
   m_btnFont.CreateFontIndirect(&logFontBtn);

   LOGFONT logFontBtn14;
   XTPPaintManager()->GetRegularFont()->GetLogFont(&logFontBtn14);
   //WCHAR *pFontName = _T("Segoe UI");
   _tcscpy(logFontBtn14.lfFaceName, pFontName);
   logFontBtn14.lfWeight = FW_BOLD;
   logFontBtn14.lfHeight = 14 + 2;
   m_btnFont14.CreateFontIndirect(&logFontBtn14);

   LOGFONT logFontBtn12;
   XTPPaintManager()->GetRegularFont()->GetLogFont(&logFontBtn12);
   //WCHAR *pFontName = _T("Segoe UI");
   _tcscpy(logFontBtn12.lfFaceName, pFontName);
   logFontBtn12.lfWeight = FW_BOLD;
   logFontBtn12.lfHeight = 12 + 2;
   m_btnFont12.CreateFontIndirect(&logFontBtn12);



   LOGFONT logFontWebBtn;
   XTPPaintManager()->GetRegularFont()->GetLogFont(&logFontWebBtn);
   //WCHAR *pFontName = _T("Segoe UI");
   _tcscpy(logFontWebBtn.lfFaceName, pFontName);
   logFontWebBtn.lfItalic = true;
   logFontWebBtn.lfWeight = FW_BOLD;
   logFontWebBtn.lfHeight = 12 + 2;
   
   m_webBtnFont.CreateFontIndirect(&logFontWebBtn);
   
   // Calculate width and height of tab title region
   LOGFONT logFont;
   ASSISTANT::FillLogFont(logFont, m_csTabFontFamily, m_iTabFontSize, 
      _T("bold"), _T("roman"), false);
   m_iTabWidth = DrawSdk::Text::GetTextWidth(m_csStartPage, m_csStartPage.GetLength(), 
      &logFont) + 3;
   m_iTabHeight = DrawSdk::Text::GetTextHeight(m_csStartPage, m_csStartPage.GetLength(), 
      &logFont);

   LoadBitmaps();

   CreateCloseButton();
   CreateWelcomeButtons();
   //CreateRecentlyOpenedButtons();
   CreateShowAgainButton();
   CreateToolTips();

   SetScrollSizes( MM_TEXT, CSize(VIEW_DEFAULT_WIDTH, VIEW_DEFAULT_HEIGHT) );

   RepositionButtons();

   ShowToolTips();

   return 0;
}
コード例 #9
0
		  LRESULT CALLBACK WindowProc(HWND _hwnd,
		  UINT _msg,
		  WPARAM _wparam,
		  LPARAM _lparam)
{
	// This is the main message handler of the system.
	PAINTSTRUCT ps; // Used in WM_PAINT.
	HDC hdc; // Handle to a device context.
	// What is the message?
	switch (_msg)
	{
	case WM_CREATE:
	{
		_iNumThreads = std::thread::hardware_concurrency();				
		// Do initialization stuff here.
		// Return Success.
		return (0);
	}
		break;
	case WM_PAINT:
	{
		// Simply validate the window.
		hdc = BeginPaint(_hwnd, &ps);
		if (!bitmapsToDraw.empty())
		{
			//Starting coordinates
			int x = 0;
			int y = 0;
			
			//Used to nicely arrange the images
			int _iNum = int(ceil(sqrt(bitmapsToDraw.size())));
			int _iWidth = (1000 / _iNum);
			int _iHeight = _iWidth;

			//Drawing the images
			for (unsigned int i = 0; i < bitmapsToDraw.size(); i++)
			{
				BITMAP bitmap;
				GetObject(bitmapsToDraw[i], sizeof(BITMAP), &bitmap);
				HDC hdcMem = CreateCompatibleDC(hdc);
				HBITMAP oldBitmap = static_cast<HBITMAP>(SelectObject(hdcMem, bitmapsToDraw[i]));
				SetStretchBltMode(hdc, _iStretchColor);
				StretchBlt(hdc, x, y, _iWidth, _iHeight, hdcMem, 0, 0, bitmap.bmWidth, bitmap.bmHeight, SRCCOPY);
				SelectObject(hdcMem, oldBitmap);
				DeleteDC(hdcMem);
				x += _iWidth;
				//Adding new row
				if (x >= 1000)
				{
					y += _iWidth;
					x = 0;
				}
			}
		}	
		EndPaint(_hwnd, &ps);
		// Return Success.
		return (0);
	}
		break;
	case WM_COMMAND:
	{
		switch (LOWORD(_wparam))
		{
		case ID_FILE_LOADIMAGES:
		{
			LoadBitmaps();
			InvalidateRect(_hwnd, NULL, TRUE);
			break;
		}
		case ID_FILE_LOADSOUNDS:
		{
			LoadSounds();
			break;
		}
		case ID_COLORTYPE_HALFTONE:
		{
			_iStretchColor = HALFTONE;
			InvalidateRect(_hwnd, NULL, TRUE);
			break;
		}
		case ID_COLORTYPE_BLACKONWHITE:
		{
			_iStretchColor = BLACKONWHITE;
			InvalidateRect(_hwnd, NULL, TRUE);
			break;
		}
		case ID_COLORTYPE_COLORONCOLOR:
		{
			_iStretchColor = COLORONCOLOR;
			InvalidateRect(_hwnd, NULL, TRUE);
			break;
		}
		case ID_COLORTYPE_WHITEONBLACK:
		{
			_iStretchColor = STRETCH_ORSCANS;
			InvalidateRect(_hwnd, NULL, TRUE);
			break;
		}
		case ID_EXIT:
		{
			//Deleting bitmaps upon exiting
			for (unsigned int i = 0; i < bitmapsToDraw.size(); i++)
			{
				DeleteObject(bitmapsToDraw[i]);
			}
			PostQuitMessage(0);
			// Return success.
			return (0);
			break;
		}

		default:
			break;
		}
		return(0);
	
	}
	
		
	case WM_DESTROY:
	{	//Delete all bitmaps here
		// Kill the application, this sends a WM_QUIT message.
		for (unsigned int i = 0; i < bitmapsToDraw.size(); i++)
		{
			DeleteObject(bitmapsToDraw[i]);
		}
		
		PostQuitMessage(0);
		// Return success.
		return (0);
	}
		break;
	default:break;
	} // End switch.
	// Process any messages that we did not take care of...
	return (DefWindowProc(_hwnd, _msg, _wparam, _lparam));
}