Esempio n. 1
0
coord GetLocationChosenByUser(void)
{
	coord position;
	int i=0;
	double x,y;
	do
	{
		WaitForMouseDown();
		x=GetMouseX();
		y=GetMouseY();
		if (LG<x && x<16*LG && GetWindowHeight()-11.3*LG<y && y<GetWindowHeight()-1.3*LG)
		{
			i=1;
			for (i=16;i>=1;i--)
			{
				if (x>i*LG)
				{
					position.col=i-1;
					break;
				}
			}
			for (i=2;i<=12;i++)
			{
				if ((y-0.7*LG)>(GetWindowHeight()-i*LG))
				{
					position.row=i-3;
					break;
				}
			}
			return position;
		}
	}
	while (i==0);
}
Esempio n. 2
0
void MarkMiss(coord location)
{
	MovePen( (location.col+1)*LG,GetWindowHeight()-(location.row+1.3)*LG );
	DrawLine(LG,-LG);
	MovePen( (location.col+2)*LG,GetWindowHeight()-(location.row+1.3)*LG );
	DrawLine(-LG,-LG);
}
Esempio n. 3
0
/* Function: CalculateGeometry
 * ---------------------------
 * This internal helper does all the messy math to work out how to divide up the space
 * within the current graphics window to neatly fit the board, the cubes, and the word lists.
 */
static void CalculateGeometry(int numRows, int numCols)
{	
    double boardSize = min(min(GetWindowWidth()/3, GetWindowHeight() - LABEL_HEIGHT), 2.7);
    gState.cubeSize = min((boardSize-BOARD_BORDER)/numRows, (boardSize-BOARD_BORDER)/numCols);
    gState.board.w = gState.board.h = boardSize;
    gState.board.y = GetWindowHeight() - LABEL_HEIGHT - gState.board.h;
    double leftover = GetWindowWidth() - gState.board.w - 2*INDENT;
    gState.scoreBox[Human].x = INDENT;
    gState.scoreBox[Human].y = gState.scoreBox[Computer].y = gState.board.y + gState.board.h;
    gState.scoreBox[Human].h = gState.scoreBox[Computer].h = LABEL_HEIGHT;
    gState.scoreBox[Human].w = leftover*HUMAN_PERCENTAGE;
    gState.board.x = gState.scoreBox[Human].x + gState.scoreBox[Human].w;
    gState.scoreBox[Computer].x = gState.board.x + gState.board.w + INDENT;
    gState.scoreBox[Computer].w = GetWindowWidth() - gState.scoreBox[Computer].x - INDENT;
    gState.numRows = numRows;
    gState.numCols = numCols;
    SetFont(WORD_FONT);
    SetPointSize(WORD_FONT_SIZE);
    gState.wordColumnWidth = TextStringWidth("mmmmm");	// col size is 5 letters wide
    SetFont(CUBE_FONT);
    // iterate to find largest font that fits within given percentage
    for (gState.cubeFontSize = 8; gState.cubeFontSize < 48; gState.cubeFontSize++) {
	SetPointSize(gState.cubeFontSize);
	if ((TextStringWidth("M") > FONT_PERCENTAGE*gState.cubeSize) || 
	    (GetFontAscent() > FONT_PERCENTAGE*gState.cubeSize)) break;
    }
}
Esempio n. 4
0
	virtual void RenderFrame()
	{
		FBO.Bind();
		FBO.DrawFrameBuffer();

		glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
		glViewport(0, 0, GetWindowWidth(), GetWindowHeight());

		float r = flow / 100.0f;
		ProgramRender["varyingcolor"] = glm::vec4(r, 0.0f, 1.0f, 1.0f);
		ProgramRender["MVP"] = FPSCamera.GetModelViewProjection();
		ProgramRender.Use();
		Plain.DrawMesh();

		FBO.UnBind();

		glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
		glViewport(0, 0, GetWindowWidth(), GetWindowHeight());

		Text1.Activate();
		ProgramDraw.Use();
		glm::mat4 MVP = FPSCamera.GetModelViewProjection();
		ProgramDraw["transformMatrix"] = MVP;
		Android.DrawMesh();

		if (flow >= 100)
		{
			flow = 0;
		}
		flow++;
	}
Esempio n. 5
0
void DrawStartingBoard(string choice)
{
	int i;
	string letter[10]={"A","B","C","D","E","F","G","H","I","J"};
	if( StringEqual(choice,"y") ) { PlayNamedSound("Fanfare"); }
	for (i=0;i<=NUM_COLS;i++)
	{
		if (i!=NUM_COLS)
		{
			MovePen((i+1.3)*LG,GetWindowHeight()-LG);
			DrawTextString(IntegerToString(i));
		}
		MovePen((i+1)*LG,GetWindowHeight()-1.3*LG);
		DrawLine(0,(-NUM_ROWS)*LG);
	}
	for (i=0;i<=NUM_ROWS;i++)
	{
		if (i!=NUM_ROWS)
		{
			MovePen(LG/4,GetWindowHeight()-(11.1-i)*LG);
			DrawTextString(letter[9-i]);
		}
		MovePen(LG,GetWindowHeight()-(11.3-i)*LG);
		DrawLine((NUM_COLS)*LG,0);
	}
}
Esempio n. 6
0
void Maze::configureGraphics()
{
	cellSize = min(GetWindowWidth()/numCols(), GetWindowHeight()/numRows());
	originX = (GetWindowWidth() - numCols()*cellSize)/2;
	originY = (GetWindowHeight() - numRows()*cellSize)/2;
    originX = originX >= 0 ? originX : 0;
    originY = originY >= 0 ? originY : 0;
	configured = true;	
}
Esempio n. 7
0
void DrawPrintfMessage(string message)
{
	MovePen( LG , GetWindowHeight()-11.5*LG );
	SetPenColor("White");
	StartFilledRegion(1);
	DrawLine(0,-2*LG);
	DrawLine(23*LG,0);
	DrawLine(0,2*LG);
	DrawLine(-23*LG,0);
	EndFilledRegion();
	SetPenColor("Black");
	MovePen( 2*LG , GetWindowHeight()-12.3*LG );
	DrawTextString(message);
}
Esempio n. 8
0
void Main_Scene::Draw(const float gameTime)
{
	gDevice->Clear(D3DCOLOR_XRGB(0,0,255));
	gDevice->Begin();

	RECT rcSrcRect;
	rcSrcRect.left = 0;
	rcSrcRect.right = GetWindowWidth();
	rcSrcRect.bottom = GetWindowHeight();
	rcSrcRect.top = 0;
	

	RECT textRect = {100,343,-1,-1};
	RECT serverTextRect = {200,450,-1,-1};
    if(spriter && texture)
	{
		spriter->Begin(D3DXSPRITE_ALPHABLEND);
		spriter->Draw(texture,&rcSrcRect,NULL, &position, color);
		//spriter->Draw(NULL, &button, NULL, NULL, D3DCOLOR_ARGB(255,0,255,0));
		if(pFont)
			pFont->DrawText(spriter, _T("닉네임"), -1, &textRect, DT_NOCLIP, D3DXCOLOR(1,1,1,1));

		if(pServerMsgFont)
			pServerMsgFont->DrawText(spriter, serverMsg.c_str(), -1, &serverTextRect, DT_NOCLIP, D3DXCOLOR(1,1,1,1));
		spriter->End();
	}

	gDevice->End();
	gDevice->Present();
	
}
Esempio n. 9
0
bool App::CreateWorld()
{
	m_pkCamera	= NULL;
	m_hSphere	= NULL;

	// COMMENT : Create and setup camera
	m_pkCamera	= new FreeCamera(GetGraphics());
	if(false == m_pkCamera->CreateRenderCamera(GetWindowWidth(), GetWindowHeight())) {return false;}
	m_pkCamera->CalculateProjection(CORE3D_PI * 0.5f, 10.0f, 0.1f);
	m_pkCamera->SetPosition(C3DVECTOR3(0.0f, 0.0f, -2.0f));
	m_pkCamera->SetLookAt(C3DVECTOR3(0.0f, 0.0f, 0.0f), C3DVECTOR3(0.0f, 1.0f, 0.0f));
	m_pkCamera->CalculateView();

	// COMMENT : Register board entity and create an instance
	GetScene()->RegisterEntityType(_T("DisplacedSphere"), &Core3D::CreateDisplacedSphere);
	m_hSphere	= GetScene()->CreateEntity(_T("DisplacedSphere"));
	if(NULL == m_hSphere) {return false;}

	DisplacedSphere* pkSphere = static_cast<DisplacedSphere*>(GetScene()->GetEntity(m_hSphere));
	if(false == pkSphere->Initialize(1.0f, 12, 12, _T("earth.png"))) {return false;}

	// COMMENT : Enable Core3D's subdivision stage, which will be the base for displacement mapping.
	GetGraphics()->SetRenderState(Core3D::RS_SUBDIVISIONMODE, Core3D::SUBDIV_ADAPTIVE);
	GetGraphics()->SetRenderState(Core3D::RS_SUBDIVISIONLEVELS, 1);

	const C3DFLOAT32 fSubdivisionMaxScreenArea = 14.0f * 14.0f; // Triangles larger than 14x14 square-pixels will be subdivided.
	GetGraphics()->SetRenderState(Core3D::RS_SUBDIVISIONMAXSCREENAREA, *(C3DUINT32*)&fSubdivisionMaxScreenArea);
	GetGraphics()->SetRenderState(Core3D::RS_SUBDIVISIONMAXINNERLEVELS, 2);
	
	GetGraphics()->SetRenderState(Core3D::RS_FILLMODE, Core3D::FILL_WIREFRAME);

	return true;
}
Esempio n. 10
0
void Game::RunGame()
{

	while( !glfwWindowShouldClose( m_pWindow ) && m_bGameOver == false )
	{
		//Calculates time between frames (Delta Time)
		m_fLastTime		=  m_fCurrentTime;
		m_fCurrentTime	=  glfwGetTime();
		m_fDeltaTime	=  m_fCurrentTime - m_fLastTime;
		m_fTotalTime	+= m_fDeltaTime;
		++m_iTotalFrames;

		m_fFPS	= m_iTotalFrames / m_fTotalTime;
		
		glfwGetCursorPos(m_pWindow, &mx, &my);
		my = GetWindowHeight() - my;
		

		glClear(GL_COLOR_BUFFER_BIT);
			
		Update();
		
		Draw();

		glfwSwapBuffers( m_pWindow );
		glfwPollEvents();		

	}
}
Esempio n. 11
0
	void Window::HandleSizeMessage()
	{
		WINDOWINFO info;
		GetWindowInfo(m_handle, &info);

		bool resized = false;
		if (GetRectWidth(info.rcClient) != GetRectWidth(m_clientRect))
			resized = true;
		else if (GetRectHeight(info.rcClient) != GetRectHeight(m_clientRect))
			resized = true;

		m_clientRect = info.rcClient;
		m_windowRect = info.rcWindow;
				
		if (resized)
		{
			unsigned int clientWidth = GetClientWidth();
			unsigned int clientHeight = GetClientHeight();
			unsigned int windowWidth = GetWindowWidth();
			unsigned int windowHeight = GetWindowHeight();

			for (size_t i = 0; i < m_eventListeners.size(); ++i)
			{
				m_eventListeners[i]->WindowResized(clientWidth, clientHeight, windowWidth, windowHeight);
			}
		}
	}
Esempio n. 12
0
bool Settings::SaveSettings()
////////////////////////////////////////////////////////////////////////
{
	DataFile settingsfile;
	if (settingsfile.CreateDataFile(GetSettingsFile()))
	{
		settingsfile.WriteText(BString("############################\n"));
		settingsfile.WriteText(BString("# Genesis Commander settings file\n"));
		settingsfile.WriteText(BString("############################\n"));
		settingsfile.WriteText(BString("\n"));
		settingsfile.WriteText(BString("# General settings\n"));
		settingsfile.WriteString(BString("LANGUAGE"), GetLanguage());
		settingsfile.WriteBool(BString("ASKONEXIT"), GetAskOnExit());
		settingsfile.WriteInteger(BString("WINDOWLEFT"), GetWindowLeft());
		settingsfile.WriteInteger(BString("WINDOWTOP"), GetWindowTop());
		settingsfile.WriteInteger(BString("WINDOWWIDTH"), GetWindowWidth());
		settingsfile.WriteInteger(BString("WINDOWHEIGHT"), GetWindowHeight());
		settingsfile.WriteString(BString("TERMINALWINDOW"), GetTerminalWindow());
		settingsfile.WriteText(BString("\n"));
		settingsfile.WriteText(BString("# Left panel\n"));
		settingsfile.WriteString(BString("LEFTPANELPATH"), GetLeftPanelPath());
		settingsfile.WriteText(BString("\n"));
		settingsfile.WriteText(BString("# Right panel\n"));
		settingsfile.WriteString(BString("RIGHTPANELPATH"), GetRightPanelPath());
	
		return true;
	}
	else
		return false;
}
Esempio n. 13
0
void SizeToContent(DOCKPANEL *dwp)
{
	RECT  rect = { 0,0,0,0 }, rect2;
	int x = 0, y = 0;

	if(dwp->hwndPanel == 0 || dwp->hwndContents == 0)
		return;
	
	if(dwp->DockSize.cx == 0 || (dwp->dwStyle & DWS_FIXED_HORZ))
		dwp->DockSize.cx = GetWindowWidth(dwp->hwndContents);
	
	if(dwp->FloatSize.cx == 0 || (dwp->dwStyle & DWS_FIXED_HORZ))
		dwp->FloatSize.cx = GetWindowWidth(dwp->hwndContents);
	
	if(dwp->DockSize.cy == 0 || (dwp->dwStyle & DWS_FIXED_VERT))
		dwp->DockSize.cy = GetWindowHeight(dwp->hwndContents);
	
	if(dwp->FloatSize.cy == 0 || (dwp->dwStyle & DWS_FIXED_VERT))
		dwp->FloatSize.cy = GetWindowHeight(dwp->hwndContents);
	
	if(dwp->fDocked)
	{
		rect.right = dwp->DockSize.cx;
		rect.bottom = dwp->DockSize.cy;
	}
	else
	{
		rect.right = dwp->FloatSize.cx;
		rect.bottom = dwp->FloatSize.cy;
	}

	CopyRect(&rect2, &rect);
	AdjustRectBorders(dwp, &rect, 1);
	
	TRACEA("SizeToContent: client=%d %d %d %d  adjusted=%d %d %d %d\n",
				rect2.left, rect2.top, rect2.right, rect2.bottom,
				rect.left, rect.top, rect.right, rect.bottom
				);

	if(!dwp->fDocked)
		CalcFloatingRect(dwp->hwndPanel, &rect);

	SetWindowSize(dwp->hwndPanel, RectWidth(&rect), RectHeight(&rect), NULL);

	PositionContent(dwp);
}
Esempio n. 14
0
// ウィンドウ設定の復帰。
int Window::RepairWindow()
{
	wd = backup;
	return SetWindowPos(
		GetWindowHandle(), wd.winpos,
		GetPositionX(), GetPositionY(),
		GetWindowWidth(), GetWindowHeight(),
		wd.flags
		);
}
Esempio n. 15
0
void ControlRoom::BeforeCollision(int pIndex, float pCollisionValue)
{	
	GameController::BeforeCollision(pIndex, pCollisionValue);
	if (ObjectIsConsole(pIndex))
	{
		mNextState = new GameControllerLevelOne(GetAudio(), GetModel(), GetTexture(), GetWindowHeight(), GetWindowWidth());
	}
	else if (ObjectIsLadder(pIndex))
	{	
		StateMachine::mSetBushCourt = true;
	}
}
void Application::SetCursor(bool enable)
{
	if (enable)
	{
		glfwSetInputMode(m_window, GLFW_CURSOR, GLFW_CURSOR_NORMAL);
	}
	else
	{
		glfwSetInputMode(m_window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);
		SetMouseinput(GetWindowWidth() / 2, GetWindowHeight() / 2);
	}
}
Esempio n. 17
0
void MarkHit(coord location,string color,double density)
{
	SetPenColor(color);
	MovePen( (location.col+1.5)*LG,GetWindowHeight()-(location.row+1.3)*LG );
	StartFilledRegion(density);
	DrawLine(-LG/2,-LG/2);
	DrawLine(LG/2,-LG/2);
	DrawLine(LG/2,LG/2);
	DrawLine(-LG/2,LG/2);
	EndFilledRegion();
	SetPenColor("Black");
}
Esempio n. 18
0
void DrawScore(int MissilesLeft,int ShipsLeft,int hit,int total)
{
	MovePen(16.5*LG,GetWindowHeight());
	StartFilledRegion(1);
	SetPenColor("White");
	DrawLine(0,-10*LG);
	DrawLine(7*LG,0);
	DrawLine(0,10*LG);
	DrawLine(-7*LG,0);
	EndFilledRegion();
	SetPenColor("Black");
	MovePen(17*LG,GetWindowHeight()-4*LG);
	DrawTextString("Missiles left: ");
	DrawTextString(IntegerToString(MissilesLeft));
	MovePen(17*LG,GetWindowHeight()-5.5*LG);
	DrawTextString("Ships to sink: ");
	DrawTextString(IntegerToString(ShipsLeft));
	MovePen(17*LG,GetWindowHeight()-7*LG);
	DrawTextString("Hit rate: ");
	DrawTextString(IntegerToString(percent(hit,total)));
	DrawTextString("%");
}
Esempio n. 19
0
void View::EnterGameState(){
	glMatrixMode(GL_PROJECTION);

	glLoadIdentity();

	double l_ratio =  GetWindowWidth() * 1.0 / GetWindowHeight();

	gluPerspective(45.0f, l_ratio, 0.1f, 100.0f);
	std::cout << "Switching to game state" <<std::endl;
	glEnable(GLUT_DEPTH);

	glMatrixMode(GL_MODELVIEW);
	glutPostRedisplay();
}
Esempio n. 20
0
void  ControlRoom::DrawConsoleScreen(const GLdouble &xImgSize, const GLdouble &yImgSize, 
							         const GLdouble &xStart, const GLdouble &yStart, const GLdouble &zStart,
							         const GLdouble &xTimes, const GLdouble &yTimes, const bool &flip)
{
	
	glPushMatrix();
	glMatrixMode(GL_PROJECTION);
	glPushMatrix();
	glLoadIdentity();
	gluOrtho2D(0, GetWindowWidth(), 0, GetWindowHeight());
	glScalef(1, -1, 1);
		
	// move to centre of screen
	glTranslatef(GetWindowWidth()/2 -512.0, -GetWindowHeight()/2 -384, 0);
	glMatrixMode(GL_MODELVIEW);
	glLoadIdentity();	
	
	glBindTexture(GL_TEXTURE_2D, GetTexture()->getTextureID(taRoberConsoleSreen));

	// display image
	glBegin(GL_QUADS);
		glTexCoord2f(0, 0.0);
		glVertex3f(xStart, yStart, zStart);
		glTexCoord2f(0, yTimes);   
		glVertex3f(xStart, yStart + (yImgSize * yTimes), zStart);
		glTexCoord2f(xTimes, yTimes);
		glVertex3f(xStart + (xImgSize * xTimes), yStart + (yImgSize * yTimes), zStart);
		glTexCoord2f(xTimes, 0.0);
		glVertex3f(xStart + (xImgSize * xTimes), yStart, zStart);
	glEnd();

	// Reset Perspective Projection
	glMatrixMode(GL_PROJECTION);
	glPopMatrix();
	glMatrixMode(GL_MODELVIEW);
	glPopMatrix();
}
Esempio n. 21
0
/*!
@brief ウィンドウの生成
@par   関数説明
ウィンドウを生成する。
決まったウィンドウサイズやスタイルがあるのであればあらかじめSet系関数で設定しておく。
@param nCmdShow WinMain関数で取得できる第三引数。
@return 0=成功。
@return 1=生成に失敗。
*/
unsigned long Window::MakeWindow( int nCmdShow )
{
	//int w = 0, h = 0;
	unsigned long err;

	if ( wd.WindowParent )
	{
		SetWindowStyleDirect( GetWindowStyle() | WS_CHILD );
	} else
	{
		SetWindowStyleDirect( GetWindowStyle() & ( ~WS_CHILD ) );
	}

	// 判定。
	//if ( GetPositionX() < 0 ){ SetPositionX( 0 ); w = GetWindowWidth();  SetWindowWidth( 640 );  }
	//if ( GetPositionY() < 0 ){ SetPositionY( 0 ); h = GetWindowHeight(); SetWindowHeight( 480 ); }

	//ウィンドウの生成
	wd.WindowHandle = CreateWindowEx(
		GetWindowStyleEx(),
		wd.wcx.lpszClassName,//MIKANCLASSNAME,//GetClassNameEx(),
		GetWindowName(),
		GetWindowStyle(),
		GetPositionX(), GetPositionY(),
		GetWindowWidth(), GetWindowHeight(),
		GetParentWindowHandle(),
		GetMenuHandle(),
		GetInstanceHandle(),
		GetParameter()
		);
	/*if ( w > 0 || h > 0 )
	{
	SetWindowSize( w, h );
	SetWindow();
	}*/

	//生成に失敗したら1を返して終了
	if ( wd.WindowHandle == NULL )
	{
		err = GetLastError();
		return err;
	}

	ShowWindow( wd.WindowHandle, nCmdShow );
	UpdateWindow( wd.WindowHandle );
	//  SetWindowText( wd.WindowParent, GetWindowName() );

	return 0;
}
Esempio n. 22
0
void View::EnterMenuState(){
	std::cout << "Switching to menu state" << std::endl;
	std::cout << "Early prototype, some functionality missing" << std::endl
		<< "From top to bottom, functionality is \n\tResume\n\tOptions(unimplemented)" << std::endl
		<< "\tCredits(unimplemented)\n\tListCheckpoints[includes save/load](unimplemented)" << std::endl
		<< "\tExit" << std::endl;

	glMatrixMode(GL_PROJECTION);
	glLoadIdentity();
	gluOrtho2D(0.0f, GetWindowWidth(), 0.0f, GetWindowHeight());// 0.0f, 0.0f, 1.0f
	//glDisable(GLUT_DEPTH);

	glMatrixMode(GL_MODELVIEW);
	glutPostRedisplay();
}
Esempio n. 23
0
//-----------------------------------------------------------------------------
// Draws a quad
//-----------------------------------------------------------------------------
void CAVITestApp::DrawStuff( AVIMaterial_t hMaterial )
{
	int iViewableWidth = GetWindowWidth();
	int iViewableHeight = GetWindowHeight();

	g_pAVI->SetTime( hMaterial, Sys_FloatTime() - m_flStartTime );

	float flMaxU, flMaxV;
	g_pAVI->GetTexCoordRange( hMaterial, &flMaxU, &flMaxV );
	IMaterial *pMaterial = g_pAVI->GetMaterial( hMaterial );

	CMatRenderContextPtr pRenderContext( g_pMaterialSystem );

	pRenderContext->MatrixMode( MATERIAL_PROJECTION );
	pRenderContext->LoadIdentity();
	pRenderContext->Ortho( 0, 0, iViewableWidth, iViewableHeight, 0, 1 );

	pRenderContext->Bind( pMaterial );
	IMesh *pMesh = pRenderContext->GetDynamicMesh();
	CMeshBuilder meshBuilder;

	meshBuilder.Begin( pMesh, MATERIAL_QUADS, 1 );

	// Draw a polygon the size of the panel
	meshBuilder.Color4ub( 255, 255, 255, 255 );
	meshBuilder.Position3f( -0.5, iViewableHeight + 0.5, 0 );
	meshBuilder.TexCoord2f( 0, 0, 0 );
	meshBuilder.AdvanceVertex();

	meshBuilder.Color4ub( 255, 255, 255, 255 );
	meshBuilder.Position3f( -0.5, 0.5, 0 );
	meshBuilder.TexCoord2f( 0, 0, flMaxV );
	meshBuilder.AdvanceVertex();

	meshBuilder.Color4ub( 255, 255, 255, 255 );
	meshBuilder.Position3f( iViewableWidth - 0.5, 0.5, 0 );
	meshBuilder.TexCoord2f( 0, flMaxU, flMaxV );
	meshBuilder.AdvanceVertex();

	meshBuilder.Color4ub( 255, 255, 255, 255 );
	meshBuilder.Position3f( iViewableWidth - 0.5, iViewableHeight + 0.5, 0 );
	meshBuilder.TexCoord2f( 0, flMaxU, 0 );
	meshBuilder.AdvanceVertex();

	meshBuilder.End();
	pMesh->Draw();
}
Esempio n. 24
0
void CVideoControlSoft::Resize()
{
    updateContext = true;

    
    if(videoStart)
        ffmfc_videoDisplaySize(GetWindowWidth(),GetWindowHeight() );
  
    if(pause && isffmpegDecode  && copyFrameBuffer != nullptr)
    {
         SetFrameData(copyFrameBuffer);
    } 
    
#ifdef __APPLE__
         this->FastRefresh(this,true);
#else
         this->Refresh();
#endif
}
Esempio n. 25
0
	FrameBufferDemo() : Android("../assets/Android.obj"), Plain("../assets/Baseplain.obj")
		, flow(10), Text1(0)
	{
		ProgramRender[GL_VERTEX_SHADER] = "../shaders/simpleVertexFBO.glsl";
		ProgramRender[GL_FRAGMENT_SHADER] = "../shaders/simpleFragmentFBO.glsl";
		ProgramRender.Link();

		ProgramDraw[GL_VERTEX_SHADER] = "../shaders/texvert.glsl";
		ProgramDraw[GL_FRAGMENT_SHADER] = "../shaders/texfrag.glsl";
		ProgramDraw.Link();
		ProgramDraw["tex"] = 0;

		Android.Attach();
		Plain.Attach();

		Text1.Alloc(GetWindowWidth(), GetWindowHeight());
		Text1.Param(GL_TEXTURE_MIN_FILTER, GL_LINEAR);
		Text1.Param(GL_TEXTURE_MAG_FILTER, GL_LINEAR);
		FBO.AddRenderTargetAt(Text1, GL_COLOR_ATTACHMENT0);
	}
Esempio n. 26
0
LRESULT CALLBACK
MainWindowProc(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam)
{
    switch (Msg)
    {
        case WM_CREATE:
            if (!InitControls(hwnd))
                PostMessage(hwnd, WM_CLOSE, 0, 0);

            if (SettingsInfo.bUpdateAtStart)
                UpdateAppsDB();
            break;

        case WM_COMMAND:
            MainWndOnCommand(hwnd, wParam, lParam);
            break;

        case WM_NOTIFY:
        {
            LPNMHDR data = (LPNMHDR)lParam;

            switch (data->code)
            {
                case TVN_SELCHANGED:
                {
                    if (data->hwndFrom == hTreeView)
                    {
                        switch (((LPNMTREEVIEW)lParam)->itemNew.lParam)
                        {
                            case IDS_INSTALLED:
                                UpdateApplicationsList(ENUM_ALL_COMPONENTS);
                                break;

                            case IDS_APPLICATIONS:
                                UpdateApplicationsList(ENUM_APPLICATIONS);
                                break;

                            case IDS_UPDATES:
                                UpdateApplicationsList(ENUM_UPDATES);
                                break;

                            case IDS_AVAILABLEFORINST:
                                UpdateApplicationsList(ENUM_ALL_AVAILABLE);
                                break;

                            case IDS_CAT_AUDIO:
                                UpdateApplicationsList(ENUM_CAT_AUDIO);
                                break;

                            case IDS_CAT_DEVEL:
                                UpdateApplicationsList(ENUM_CAT_DEVEL);
                                break;

                            case IDS_CAT_DRIVERS:
                                UpdateApplicationsList(ENUM_CAT_DRIVERS);
                                break;

                            case IDS_CAT_EDU:
                                UpdateApplicationsList(ENUM_CAT_EDU);
                                break;

                            case IDS_CAT_ENGINEER:
                                UpdateApplicationsList(ENUM_CAT_ENGINEER);
                                break;

                            case IDS_CAT_FINANCE:
                                UpdateApplicationsList(ENUM_CAT_FINANCE);
                                break;

                            case IDS_CAT_GAMES:
                                UpdateApplicationsList(ENUM_CAT_GAMES);
                                break;

                            case IDS_CAT_GRAPHICS:
                                UpdateApplicationsList(ENUM_CAT_GRAPHICS);
                                break;

                            case IDS_CAT_INTERNET:
                                UpdateApplicationsList(ENUM_CAT_INTERNET);
                                break;

                            case IDS_CAT_LIBS:
                                UpdateApplicationsList(ENUM_CAT_LIBS);
                                break;

                            case IDS_CAT_OFFICE:
                                UpdateApplicationsList(ENUM_CAT_OFFICE);
                                break;

                            case IDS_CAT_OTHER:
                                UpdateApplicationsList(ENUM_CAT_OTHER);
                                break;

                            case IDS_CAT_SCIENCE:
                                UpdateApplicationsList(ENUM_CAT_SCIENCE);
                                break;

                            case IDS_CAT_TOOLS:
                                UpdateApplicationsList(ENUM_CAT_TOOLS);
                                break;

                            case IDS_CAT_VIDEO:
                                UpdateApplicationsList(ENUM_CAT_VIDEO);
                                break;
                        }
                    }
                }
                break;

                case LVN_ITEMCHANGED:
                {
                    LPNMLISTVIEW pnic = (LPNMLISTVIEW) lParam;

                    if (pnic->hdr.hwndFrom == hListView)
                    {
                        /* Check if this is a valid item
                         * (technically, it can be also an unselect) */
                        INT ItemIndex = pnic->iItem;
                        if (ItemIndex == -1 ||
                            ItemIndex >= ListView_GetItemCount(pnic->hdr.hwndFrom))
                        {
                            break;
                        }

                        /* Check if the focus has been moved to another item */
                        if ((pnic->uChanged & LVIF_STATE) &&
                            (pnic->uNewState & LVIS_FOCUSED) &&
                            !(pnic->uOldState & LVIS_FOCUSED))
                        {
                            if (IS_INSTALLED_ENUM(SelectedEnumType))
                                ShowInstalledAppInfo(ItemIndex);
                            if (IS_AVAILABLE_ENUM(SelectedEnumType))
                                ShowAvailableAppInfo(ItemIndex);
                        }
                    }
                }
                break;

                case LVN_COLUMNCLICK:
                {
                    LPNMLISTVIEW pnmv = (LPNMLISTVIEW) lParam;

                    (VOID) ListView_SortItems(hListView, ListViewCompareFunc, pnmv->iSubItem);
                    bAscending = !bAscending;
                }
                break;

                case NM_CLICK:
                    if (data->hwndFrom == hListView)
                    {
                        if (IS_INSTALLED_ENUM(SelectedEnumType))
                            ShowInstalledAppInfo(-1);
                        if (IS_AVAILABLE_ENUM(SelectedEnumType))
                            ShowAvailableAppInfo(-1);
                    }
                    break;

                case NM_RCLICK:
                    if (data->hwndFrom == hListView)
                        ShowPopupMenu(hListView, IDR_APPLICATIONMENU);
                    break;

                case EN_LINK:
                    RichEditOnLink(hwnd, (ENLINK*)lParam);
                    break;

                case TTN_GETDISPINFO:
                    ToolBarOnGetDispInfo((LPTOOLTIPTEXT)lParam);
                    break;
            }
        }
        break;

        case WM_PAINT:
        break;

        case WM_SIZE:
        {
            if ((GetClientWindowHeight(hMainWnd) - GetWindowHeight(hStatusBar) - SPLIT_WIDTH) < GetHSplitterPos())
            {
                INT NewSplitPos = GetClientWindowHeight(hwnd) - 100 - GetWindowHeight(hStatusBar) - SPLIT_WIDTH;
                if (NewSplitPos > GetWindowHeight(hToolBar) + SPLIT_WIDTH)
                    SetHSplitterPos(NewSplitPos);
            }

            MainWndOnSize(hwnd, wParam, lParam);
        }
        break;

        case WM_SIZING:
        {
            int RichEditHeight = GetWindowHeight(hRichEdit);
            LPRECT pRect = (LPRECT)lParam;

            while (RichEditHeight <= 100)
            {
                if (GetHSplitterPos() - 1 < GetWindowHeight(hToolBar) + GetWindowHeight(hListView) + SPLIT_WIDTH)
                    break;
                SetHSplitterPos(GetHSplitterPos() - 1);
                RichEditHeight++;
            }

            if (pRect->right-pRect->left < 565)
                pRect->right = pRect->left + 565;

            if (pRect->bottom-pRect->top < 300)
                pRect->bottom = pRect->top + 300;
            return TRUE;
        }

        case WM_SYSCOLORCHANGE:
        {
            /* Forward WM_SYSCOLORCHANGE to common controls */
            SendMessage(hListView, WM_SYSCOLORCHANGE, 0, 0);
            SendMessage(hTreeView, WM_SYSCOLORCHANGE, 0, 0);
            SendMessage(hToolBar, WM_SYSCOLORCHANGE, 0, 0);
            SendMessageW(hRichEdit, EM_SETBKGNDCOLOR, 0, GetSysColor(COLOR_BTNFACE));
        }
        break;

        case WM_DESTROY:
        {
            ShowWindow(hwnd, SW_HIDE);
            SaveSettings(hwnd);

            FreeLogs();

            if (IS_AVAILABLE_ENUM(SelectedEnumType))
                FreeAvailableAppList();
            if (IS_INSTALLED_ENUM(SelectedEnumType))
                FreeInstalledAppList();
            if (hImageTreeView) ImageList_Destroy(hImageTreeView);

            PostQuitMessage(0);
            return 0;
        }
        break;
    }

    return DefWindowProc(hwnd, Msg, wParam, lParam);
}
Esempio n. 27
0
VOID
MainWndOnSize(HWND hwnd, WPARAM wParam, LPARAM lParam)
{
    HDWP hdwp = BeginDeferWindowPos(5);
    INT SearchBarWidth = GetWindowWidth(hSearchBar);
    INT RichPos = GetWindowHeight(hRichEdit);
    INT NewPos = HIWORD(lParam) - (RichPos + SPLIT_WIDTH + GetWindowHeight(hStatusBar));
    INT VSplitterPos;

    /* Size status bar */
    SendMessage(hStatusBar, WM_SIZE, 0, 0);

    /* Size tool bar */
    SendMessage(hToolBar, TB_AUTOSIZE, 0, 0);

    /* Size SearchBar */
    MoveWindow(hSearchBar, LOWORD(lParam) - SearchBarWidth - 4, 5, SearchBarWidth, 22, TRUE);

    /*
     * HIWORD(lParam) - Height of main window
     * LOWORD(lParam) - Width of main window
     */

    /* Size vertical splitter bar */
    DeferWindowPos(hdwp,
                   hVSplitter,
                   0,
                   (VSplitterPos = GetWindowWidth(hTreeView)),
                   GetWindowHeight(hToolBar),
                   SPLIT_WIDTH,
                   HIWORD(lParam) - GetWindowHeight(hToolBar) - GetWindowHeight(hStatusBar),
                   SWP_NOZORDER|SWP_NOACTIVATE);

    /* Size TreeView */
    DeferWindowPos(hdwp,
                   hTreeView,
                   0,
                   0,
                   GetWindowHeight(hToolBar),
                   VSplitterPos,
                   HIWORD(lParam) - GetWindowHeight(hToolBar) - GetWindowHeight(hStatusBar),
                   SWP_NOZORDER|SWP_NOACTIVATE);

    while (NewPos < SPLIT_WIDTH + GetWindowHeight(hToolBar))
    {
        RichPos--;
        NewPos = HIWORD(lParam) - (RichPos +
                 SPLIT_WIDTH + GetWindowHeight(hStatusBar));
    }
    SetHSplitterPos(NewPos);

    /* Size ListView */
    DeferWindowPos(hdwp,
                   hListView,
                   0,
                   VSplitterPos + SPLIT_WIDTH,
                   GetWindowHeight(hToolBar),
                   LOWORD(lParam) - (VSplitterPos + SPLIT_WIDTH),
                   GetHSplitterPos() - GetWindowHeight(hToolBar),
                   SWP_NOZORDER|SWP_NOACTIVATE);

    /* Size RichEdit */
    DeferWindowPos(hdwp,
                   hRichEdit,
                   0,
                   VSplitterPos + SPLIT_WIDTH,
                   GetHSplitterPos() + SPLIT_WIDTH,
                   LOWORD(lParam) - (VSplitterPos + SPLIT_WIDTH),
                   RichPos,
                   SWP_NOZORDER|SWP_NOACTIVATE);

    /* Size horizontal splitter bar */
    DeferWindowPos(hdwp,
                   hHSplitter,
                   0,
                   VSplitterPos + SPLIT_WIDTH,
                   GetHSplitterPos(),
                   LOWORD(lParam) - (VSplitterPos + SPLIT_WIDTH),
                   SPLIT_WIDTH,
                   SWP_NOZORDER|SWP_NOACTIVATE);

    EndDeferWindowPos(hdwp);
}
Esempio n. 28
0
/* Callback for vertical splitter bar */
LRESULT CALLBACK
VSplitterWindowProc(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam)
{
    switch (Msg)
    {
        case WM_LBUTTONDOWN:
            SetCapture(hwnd);
        break;

        case WM_LBUTTONUP:
        case WM_RBUTTONDOWN:
            if (GetCapture() == hwnd)
            {
                ReleaseCapture();
            }
        break;

        case WM_MOUSEMOVE:
            if (GetCapture() == hwnd)
            {
                HDWP hdwp;
                POINT Point;

                GetCursorPos(&Point);
                ScreenToClient(hMainWnd, &Point);

                if ((GetClientWindowWidth(hMainWnd) - SPLIT_WIDTH) < Point.x)
                    break;

                if (SPLIT_WIDTH > Point.x)
                    break;

                hdwp = BeginDeferWindowPos(5);

                /* Size VSplitBar */
                DeferWindowPos(hdwp,
                               hwnd,
                               0,
                               Point.x,
                               GetWindowHeight(hToolBar),
                               SPLIT_WIDTH,
                               GetClientWindowHeight(hMainWnd) - GetWindowHeight(hToolBar) - GetWindowHeight(hStatusBar),
                               SWP_NOZORDER|SWP_NOACTIVATE);

                /* Size TreeView */
                DeferWindowPos(hdwp,
                               hTreeView,
                               0,
                               0,
                               GetWindowHeight(hToolBar),
                               Point.x,
                               GetClientWindowHeight(hMainWnd) - GetWindowHeight(hToolBar) - GetWindowHeight(hStatusBar),
                               SWP_NOZORDER|SWP_NOACTIVATE);

                /* Size ListView */
                DeferWindowPos(hdwp,
                               hListView,
                               0,
                               Point.x + SPLIT_WIDTH,
                               GetWindowHeight(hToolBar),
                               GetClientWindowWidth(hMainWnd) - (Point.x + SPLIT_WIDTH),
                               GetHSplitterPos() - GetWindowHeight(hToolBar),
                               SWP_NOZORDER|SWP_NOACTIVATE);

                DeferWindowPos(hdwp,
                               hRichEdit,
                               0,
                               Point.x + SPLIT_WIDTH,
                               GetHSplitterPos() + SPLIT_WIDTH,
                               GetClientWindowWidth(hMainWnd) - (Point.x + SPLIT_WIDTH),
                               GetClientWindowHeight(hMainWnd) - (GetHSplitterPos() + SPLIT_WIDTH + GetWindowHeight(hStatusBar)),
                               SWP_NOZORDER|SWP_NOACTIVATE);

                DeferWindowPos(hdwp,
                               hHSplitter,
                               0,
                               Point.x + SPLIT_WIDTH,
                               GetHSplitterPos(),
                               GetClientWindowWidth(hMainWnd) - (Point.x + SPLIT_WIDTH),
                               SPLIT_WIDTH,
                               SWP_NOZORDER|SWP_NOACTIVATE);

                EndDeferWindowPos(hdwp);
            }
        break;
    }

    return DefWindowProc(hwnd, Msg, wParam, lParam);
}
Esempio n. 29
0
const Vector2 Camera::GetWorldMinVertex() const
{
	return MathUtil::ScreenToWorld(0, GetWindowHeight());
}
Esempio n. 30
0
/* Callback for horizontal splitter bar */
LRESULT CALLBACK
HSplitterWindowProc(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam)
{
    switch (Msg)
    {
        case WM_CREATE:
        {
            SetHSplitterPos(GetWindowHeight(hListView));
        }
        break;

        case WM_LBUTTONDOWN:
        {
            SetCapture(hwnd);
        }
        break;

        case WM_LBUTTONUP:
        case WM_RBUTTONDOWN:
            if (GetCapture() == hwnd)
            {
                ReleaseCapture();
            }
        break;

        case WM_MOUSEMOVE:
            if (GetCapture() == hwnd)
            {
                int Width = GetClientWindowWidth(hMainWnd) - GetWindowWidth(hTreeView) - SPLIT_WIDTH;
                int NewPos;
                HDWP hdwp;
                POINT Point;

                GetCursorPos(&Point);
                ScreenToClient(hMainWnd, &Point);

                NewPos = Point.y;

                if ((GetClientWindowHeight(hMainWnd) - GetWindowHeight(hStatusBar) - SPLIT_WIDTH) < NewPos)
                    break;

                if ((GetWindowHeight(hToolBar) + SPLIT_WIDTH) > NewPos)
                    break;

                SetHSplitterPos(NewPos);

                hdwp = BeginDeferWindowPos(3);

                /* Size HSplitBar */
                DeferWindowPos(hdwp,
                               hHSplitter,
                               0,
                               GetWindowWidth(hTreeView) + SPLIT_WIDTH,
                               Point.y,
                               Width,
                               SPLIT_WIDTH,
                               SWP_NOZORDER|SWP_NOACTIVATE);

                /* Size ListView */
                DeferWindowPos(hdwp,
                               hListView,
                               0,
                               GetWindowWidth(hTreeView) + SPLIT_WIDTH,
                               GetWindowHeight(hToolBar),
                               Width,
                               Point.y - GetWindowHeight(hToolBar),
                               SWP_NOZORDER|SWP_NOACTIVATE);

                /* Size RichEdit */
                DeferWindowPos(hdwp,
                               hRichEdit,
                               0,
                               GetWindowWidth(hTreeView) + SPLIT_WIDTH,
                               Point.y + SPLIT_WIDTH,
                               Width,
                               GetClientWindowHeight(hMainWnd) - (Point.y + SPLIT_WIDTH + GetWindowHeight(hStatusBar)),
                               SWP_NOZORDER|SWP_NOACTIVATE);

                EndDeferWindowPos(hdwp);
            }
        break;
    }

    return DefWindowProc(hwnd, Msg, wParam, lParam);
}