Beispiel #1
0
void LOGO::run()
{
	//string settings.GetDataDir() = DATA_DIR;
	AddLogo(settings.GetFullDataPath("textures/" + settings.GetTexSize() + "/gui/logo_opengl.png"));
	//AddLogo(settings.GetDataDir() + "/tex/splash.jpg");
	AddLogo(settings.GetFullDataPath("textures/" + settings.GetTexSize() + "/gui/splash.png"));
	//AddLogo(settings.GetDataDir() + "/tex/logo_openal.png");
	
	//GLint t = SDL_GetTicks();
	float fps = 100.0;
	GLint T0 = SDL_GetTicks();
	
	bool lp = true;
	
	while (lp)
	{
		//glClearColor(1,1,1,0);
		//glClearColor(0,0,0,0);
		Draw();
		SDL_GL_SwapBuffers( );
		//glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
		
		//t = SDL_GetTicks();
		//fps = 1000000.0/(t - ot);
		//cout << fps << endl;

		GLint t = SDL_GetTicks();
		GLfloat seconds = (t - T0) / 1000.0;
		fps = 1.0 / seconds;
		T0 = t;
		
		t = T0;
		lp = IncrementTime(fps);
		//cout << lp << endl;
		
		SDL_Event event;
		while ( SDL_PollEvent( &event ) )
		{
		    switch( event.type )
			{
				case SDL_KEYDOWN:
					lp = false;
					break;
			}
		}
	}
}
Beispiel #2
0
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
	if (CXTMDIFrameWnd::OnCreate(lpCreateStruct) == -1)
		return -1;

	if (!m_wndMenuBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP
		| CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
		!m_wndMenuBar.LoadMenuBar(IDR_MAINFRAME))
	{
		TRACE0("Failed to create menubar\n");
		return -1;      // fail to create
	}
	
	if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP
		| CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
		!m_wndToolBar.LoadToolBar(IDR_MAINFRAME))
	{
		TRACE0("Failed to create toolbar\n");
		return -1;      // fail to create
	}

	//工具箱
	if (!m_wndToolboxBar.Create(this, WS_CHILD | WS_VISIBLE | CBRS_RIGHT
		| CBRS_SIZE_FIXED | CBRS_TOOLTIPS | CBRS_FLYBY, IDW_TOOLBOX_BAR) ||
		!m_wndToolboxBar.LoadToolBar(IDR_TOOLBAR_BOX))
	{
		TRACE0("Failed to create palette bar\n");
		return -1;      // fail to create
	}

	m_wndToolboxBar.ModifyStyle(0, TBSTYLE_FLAT);
	m_wndToolboxBar.SetColumns(3);
	m_wndToolboxBar.SetWindowText(_T("工具箱"));

	//格式工具栏
	// create the format toolbar.
	if (!m_wndFormatBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP
		| CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC, CRect(0,0,0,0), 59500) ||
		!m_wndFormatBar.LoadToolBar(IDR_FORMATTING))
	{
		TRACE0("Failed to create toolbar\n");
		return -1;      // fail to create
	}

	// set the title for the formatting toolbar.
    m_wndFormatBar.SetWindowText( _T( "格式工具栏" ) );
 	// initialize the color picker dropdown for the toolbar.
    m_wndFormatBar.AddDropDownButton( ID_FORMATTING_COLOR,
		m_crCurrent, CLR_DEFAULT, CPS_XT_EXTENDED | CPS_XT_MORECOLORS ); 

    m_wndFormatBar.AddDropDownButton( ID_FORMATTING_BACK_COLOR,
		m_crFillColor, CLR_DEFAULT, CPS_XT_EXTENDED | CPS_XT_MORECOLORS ); 

	m_wndFormatBar.AddDropDownButton(ID_LINE_WIDTH);
	m_wndFormatBar.AddDropDownButton(ID_LINE_STYPE);
	m_wndFormatBar.AddDropDownButton(ID_LEFTARROW_STYLE);
	m_wndFormatBar.AddDropDownButton(ID_RIGHTARROW_STYLE);

	m_wndFormatBar.AutoSizeToolbar();
	// initialize the style, font and size combo boxes.
	if ( !InitComboFont ( ) ||
         !InitComboSize ( ) )
	{
		return -1;
	}

	// Create the workspace bar.
	if( !m_wndTabDockBar.Create(this, IDW_TABDOCKBAR, _T("导航器窗口"),
		CSize(200, 150), CBRS_LEFT))
	{
		TRACE0("Failed to create workspace dock window\n");
		return -1;		// fail to create
	}

	if (!m_wndStatusBar.Create(this) ||
		!m_wndStatusBar.SetIndicators(indicators,
		  sizeof(indicators)/sizeof(UINT)))
	{
		TRACE0("Failed to create status bar\n");
		return -1;      // fail to create
	}

	// TODO: Delete these three lines if you don't want the toolbar to
	//  be dockable
	m_wndMenuBar.EnableDockingEx(CBRS_ALIGN_ANY, CBRS_XT_ALL_FLAT);
	m_wndToolBar.EnableDockingEx(CBRS_ALIGN_ANY, CBRS_XT_ALL_FLAT);
	m_wndTabDockBar.EnableDockingEx(CBRS_ALIGN_ANY, CBRS_XT_ALL_FLAT|CBRS_XT_GRIPPER_GRAD);
	m_wndToolboxBar.EnableDockingEx(CBRS_ALIGN_ANY, CBRS_XT_ALL_FLAT);
	m_wndFormatBar.EnableDockingEx(CBRS_ALIGN_ANY, CBRS_XT_ALL_FLAT);
	EnableDockingEx(CBRS_ALIGN_ANY, CBRS_XT_ALL_FLAT);
	DockControlBar(&m_wndMenuBar);
	DockControlBar(&m_wndToolBar);
	DockControlBar(&m_wndTabDockBar);
	DockControlBar(&m_wndToolboxBar);
	DockControlBar(&m_wndFormatBar);
	// Set the nubmer of columns for the m_wndToolboxBar bar.
	// Insert company name into the status bar.
	AddLogo();

	// TODO: Remove this line if you don't want cool menus.
	InstallCoolMenus(IDR_MAINFRAME);

// use multiple toolbars to initialize cool menus.
///UINT arToolbars[] = { IDR_MAINFRAME, IDR_TOOLBAR1 };
///InstallCoolMenus( arToolbars, _countof( arToolbars ) );

	XT_DROPDOWNBUTTON* pDDBtn = m_wndFormatBar.FindDropDownButton( ID_FORMATTING_COLOR );
	if ( pDDBtn != NULL ) {
		m_crCurrent = pDDBtn->clrColor;
	}

	return 0;
}