コード例 #1
0
ファイル: gboggle.cpp プロジェクト: sunil3loq/cpptrials
/* 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;
    }
}
コード例 #2
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++;
	}
コード例 #3
0
ファイル: maze.cpp プロジェクト: roles/toy_program
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;	
}
コード例 #4
0
ファイル: credits.cpp プロジェクト: frank-borkin/gornak
void TCredits::Draw()
{
    if (mStart == 0) 
	{
        mStart= TPlatform::GetInstance()->Timer();
    }

    unsigned long now = TPlatform::GetInstance()->Timer();
    unsigned long elapsed = (now - mStart);
    if (elapsed < mCreditsIntroPause) 
	{
        elapsed = 0;
    } 
	else 
	{
        elapsed -= mCreditsIntroPause;
    }
    elapsed = elapsed % mCreditsTime;

    TReal pos = (TReal)(elapsed * mHeight)/mCreditsTime;

    TRenderer::GetInstance()->Begin2d();

    uint32_t middle = GetWindowWidth()/2 ;

    TRect screenRect;

    GetWindowRect(&screenRect);

    TRect dst
		(
        mColumnGap, -(int32_t)mFontSize, 
        middle-mColumnGap/2, GetParentRelativeRect().GetHeight()+mFontSize*2
        );

    mText1->SetStartLine(pos/mFontSize);
    mText1->Draw(dst);

    dst.x1 = GetWindowWidth()/2+mColumnGap/2;
    dst.x2 = GetWindowWidth()-mColumnGap;
    mText2->SetStartLine(pos/mFontSize);
    mText2->Draw(dst);

    dst.x1 = mColumnGap;
    dst.x2 = GetWindowWidth()-mColumnGap;
    mText3->SetStartLine(pos/mFontSize);
    mText3->Draw(dst);

    TRenderer::GetInstance()->End2d();
}
コード例 #5
0
ファイル: Main_Scene.cpp プロジェクト: JueSungMun/TOK
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();
	
}
コード例 #6
0
ファイル: App.cpp プロジェクト: gunsafighter/core3d
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;
}
コード例 #7
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;
}
コード例 #8
0
ファイル: Window.cpp プロジェクト: rarosu/WarSettlers
	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);
			}
		}
	}
コード例 #9
0
ファイル: DockLib.c プロジェクト: 4aiman/HexEdit
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);
}
コード例 #10
0
ファイル: Window.cpp プロジェクト: HirokiMiyaoka/Mikan
// ウィンドウ設定の復帰。
int Window::RepairWindow()
{
	wd = backup;
	return SetWindowPos(
		GetWindowHandle(), wd.winpos,
		GetPositionX(), GetPositionY(),
		GetWindowWidth(), GetWindowHeight(),
		wd.flags
		);
}
コード例 #11
0
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);
	}
}
コード例 #12
0
ファイル: MainGame.cpp プロジェクト: ChrisMelling/basicGame
void MainGame::Init()
{
	addEntity(new Player(this));
	fps = new FPS();

	for (int i = 0; i < 100; i++)
	{		
		addEntity(new Asteroid(sf::Vector2f(math::random(0, GetWindowWidth()),math::random(0, GetWindowHeight())),Asteroid::BIG,this));
	}


	loaded = true;
}
コード例 #13
0
ファイル: View.cpp プロジェクト: Emulai/ICT397-Project
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();
}
コード例 #14
0
ファイル: ControlRoom.cpp プロジェクト: johannawald/ICT207
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();
}
コード例 #15
0
ファイル: Window.cpp プロジェクト: HirokiMiyaoka/Mikan
/*!
@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;
}
コード例 #16
0
ファイル: View.cpp プロジェクト: Emulai/ICT397-Project
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();
}
コード例 #17
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();
}
コード例 #18
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
}
コード例 #19
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);
	}
コード例 #20
0
ファイル: winmain.c プロジェクト: rmallof/reactos
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);
}
コード例 #21
0
ファイル: DlgHighlight.c プロジェクト: 4aiman/HexEdit
HWND CreateHighlightView(HWND hwndParent)
{
	HWND hwndPanel;
	HWND hwndGridView;
	HWND hwndTB1;

//	RegisterGridView();

	InitGridView();

	//
	//	Create the base tool panel
	//
	hwndPanel = ToolPanel_Create(hwndParent, HighlightViewCommandHandler);
	//ToolPanel_AddVSpace(hwndPanel, 4);


	ToolPanel_AddGripper(hwndPanel);

	
	//
	//	Create the 1st toolbar (the "Goto" button)
	//
	hwndTB1   = CreateEmptyToolbar(hwndPanel, IDB_BITMAP11, 16, 666, TBSTYLE_LIST);
	SendMessage(hwndTB1, TB_SETEXTENDEDSTYLE, 0, TBSTYLE_EX_MIXEDBUTTONS);

	GetWindowWidth(hwndTB1);
	AddButton(hwndTB1, IDC_HIGHLIGHT_ADD, 0, TBSTYLE_BUTTON, _T("Add"));
	AddButton(hwndTB1, IDC_HIGHLIGHT_EDIT, 3, TBSTYLE_BUTTON, _T("Edit"));
	AddButton(hwndTB1, IDC_HIGHLIGHT_DELETE, 1, TBSTYLE_BUTTON, _T("Delete"));
	AddButton(hwndTB1, -0, 0, TBSTYLE_SEP, 0);
	AddButton(hwndTB1, IDC_HIGHLIGHT_SHOWALL, 2, TBSTYLE_BUTTON|TBSTYLE_CHECK, _T("Show All"));
	AddButton(hwndTB1, IDC_HIGHLIGHT_REPORT, 4, TBSTYLE_BUTTON, _T("Create Report"));
	ResizeToolbar(hwndTB1);
	ToolPanel_AddItem(hwndPanel, hwndTB1, 0);
	ToolPanel_AddNewLine(hwndPanel, 4);

	
	

	//
	//	Create the gridview!!
	//
	hwndGridView = PrepGridView2(hwndPanel, IDC_HIGHLIGHT_GRIDVIEW);
	
	GridView_SetStyle(hwndGridView, -1, GVS_READONLY|GVS_FULLROWSELECT|GVS_VERTGRIDLINES//|GVS_TREELINES
		//|GVS_SHOWFOCUS
		);//,GVS_FULLROWSELECT|GVS_GRIDLINES);

	
	
	//UpdateHighlights(g_hwndHexView, hwndGridView);
	//UpdateHighlights((HWND)-1, hwndGridView);

	ToolPanel_AddItem(hwndPanel, hwndGridView, 0);
	ToolPanel_AddAnchor(hwndPanel, 0, 2);

	ToolPanel_AutoSize(hwndPanel);
	SetWindowHeight(hwndPanel, 200, NULL);

	ShowWindow(hwndPanel, SW_SHOW);
	return hwndPanel;
}
コード例 #22
0
ファイル: Camera.cpp プロジェクト: fenakira/angel2d
const Vector2 Camera::GetWorldMaxVertex() const
{
	return MathUtil::ScreenToWorld(GetWindowWidth(), 0);
}
コード例 #23
0
ファイル: ControlRoom.cpp プロジェクト: johannawald/ICT207
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;
	}
}
コード例 #24
0
ファイル: Window.cpp プロジェクト: HirokiMiyaoka/Mikan
/*!
@brief ウィンドウの設定を変更する
@par   関数説明
ウィンドウスタイルを設定する。
@param Type WT_で始まる定数。
@return false=設定反映かSetWindowPosでの設定失敗。
@return true=SetWindowPosでの設定成功。
*/
BOOL Window::SetWindow( int type, int display )
{
	HWND myhwnd = NULL;//ウィンドウハンドル
	RECT myrect;//RECT構造体
	BOOL ret;

	// ディスプレイ番号から領域を割り出して移動してからサイズ変更とかを行うように書き換え

	switch ( type )
	{
	case WT_DEFAULT://サイズ固定のウィンドウ
		//ウィンドウスタイルの設定
		SetWindowStyle( WT_DEFAULT );
		//ウィンドウスタイルの変更
		SetWindowLong( GetWindowHandle(), GWL_STYLE, GetWindowStyle() );
		wd.flags = SWP_SHOWWINDOW;
		wd.winpos = HWND_TOP;
		//ウィンドウのサイズや位置を変更
		ret = SetWindowPos(
			GetWindowHandle(), wd.winpos,
			GetPositionX(), GetPositionY(),//CW_USEDEFAULT, CW_USEDEFAULT,
			GetWindowWidth(), GetWindowHeight(),
			wd.flags
			);
		SetPositionX( GetPositionX( 1 ) );
		SetPositionY( GetPositionY( 1 ) );
		return ret;
	case WT_NORMAL://通常のリサイズ可能ウィンドウ
		//ウィンドウスタイルの設定
		SetWindowStyle( WT_NORMAL );
		//ウィンドウスタイルの変更
		SetWindowLong( GetWindowHandle(), GWL_STYLE, GetWindowStyle() );
		wd.flags = SWP_SHOWWINDOW;
		//ウィンドウのサイズや位置を変更
		wd.winpos = HWND_TOP;
		ret = SetWindowPos(
			GetWindowHandle(), wd.winpos,
			GetPositionX(), GetPositionY(),//CW_USEDEFAULT, CW_USEDEFAULT,
			GetWindowWidth(), GetWindowHeight(),
			wd.flags
			);
		SetPositionX( GetPositionX( 1 ) );
		SetPositionY( GetPositionY( 1 ) );
		return ret;
	case WT_NOFRAME:
	case WT_FULLSCREEN:
		//ウィンドウスタイルの設定
		SetWindowStyle( WT_NOFRAME );

		//ウィンドウスタイルの変更
		SetWindowLong( GetWindowHandle(), GWL_STYLE, GetWindowStyle() );
		wd.flags = SWP_SHOWWINDOW;
		wd.winpos = HWND_TOP;
		//ウィンドウのサイズや位置を変更
		return SetWindowPos(
			GetWindowHandle(), wd.winpos,
			GetPositionX(), GetPositionY(),
			GetWindowWidth(), GetWindowHeight(),
			wd.flags
			);
	case WT_NORESIZEFULLSCREEN://画面設定を変えないフルスクリーン
		//プログラムを起動したデスクトップサイズのウィンドウで
		//描写優先度が一番上のウィンドウを生成する

		//ウィンドウスタイルの設定
		SetWindowStyle( WT_NORESIZEFULLSCREEN );

		// 対象ディスプレイのサイズなどを取得。
		if ( GetDisplayRect( display, &myrect ) == 0 )
		{
			// 成功したので、うまい具合に設定。
			// 位置はディスプレイの左上。
			SetPositionXY( myrect.left, myrect.top );
			// サイズはディスプレイに合わせる。
			SetWindowSize( myrect.right - myrect.left, myrect.bottom - myrect.top );
		} else
		{
			// 失敗したので、デスクトップから取得。

			//デスクトップのウィンドウハンドル取得
			myhwnd = GetDesktopWindow();
			//デスクトップのサイズなどを取得
			if ( myhwnd && GetClientRect( myhwnd, &myrect ) )
			{
				//位置は原点に設定
				SetPositionXY( 0, 0 );
				//サイズはデスクトップと同じサイズに設定
				SetWindowSize( myrect.right, myrect.bottom );
			}
		}

		//ウィンドウスタイルの変更
		SetWindowLong( GetWindowHandle(), GWL_STYLE, GetWindowStyle() );
		wd.flags = SWP_SHOWWINDOW;
		wd.winpos = HWND_TOPMOST;
		//ウィンドウのサイズや位置を変更
		return SetWindowPos(
			GetWindowHandle(), wd.winpos,
			GetPositionX(), GetPositionY(),
			GetWindowWidth(), GetWindowHeight(),
			wd.flags
			);

	default:
		//後で考える
		//リサイズ程度
		MoveWindow(
			GetWindowHandle(),
			GetPositionX(), GetPositionY(),
			GetWindowWidth(), GetWindowHeight(),
			TRUE
			);
		break;
	}
	return 0;
}
コード例 #25
0
ファイル: splitter.c プロジェクト: RPG-7/reactos
/* 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);
}
コード例 #26
0
void CVideoControlSoft::OnPaint(wxPaintEvent& event)
{
#ifdef __WXGTK__
    double scale_factor = GetContentScaleFactor();
#else
    double scale_factor = 1.0f;
#endif
    GLTexture * glTexture = nullptr;
    //printf("OnPaint Soft Render begin \n"); 
#ifndef WIN32
    if(!renderBitmapOpenGL->IsInit())
    {
        renderBitmapOpenGL->Init(this);
        
    }
#endif
    
    std::clock_t start;
    start = std::clock();    
    

    int width = GetWindowWidth() * scale_factor;
    int height = GetWindowHeight() * scale_factor;
    if(width == 0 || height == 0)
        return;
	
	if (quitWindow)
        return;

#ifdef WIN32
    renderBitmapOpenGL->SetCurrent(*this);
#else
    if(updateContext)
    {
        renderBitmapOpenGL->SetCurrent(*this);
        updateContext = false;
    }   
#endif
    

    if (openCLEngine == nullptr)
    {
		openCLEngine = new COpenCLEngine();

		if (openCLEngine != nullptr)
			openclContext = openCLEngine->GetInstance();

		openclEffectYUV = new COpenCLEffectVideoYUV(openclContext);
    }

    nbFrame++;
    printf("Nb Frame per Seconds : %d \n",nbFrame);


    if (videoRenderStart && initStart)
    {
		//nbFrame = 0;
        if(!fpsTimer->IsRunning())
            fpsTimer->Start(1000);
	}

	if(videoRenderStart)
	{
        glTexture = RenderToGLTexture();
        if(glTexture != nullptr)
            printf("glTexture id : %d \n",glTexture->GetTextureID());
    }
    
    if(videoRenderStart && glTexture != nullptr)
    {       
        renderBitmapOpenGL->CreateScreenRender(width, height, CRgbaquad(0,0,0,0));

        if(glTexture != nullptr)
        {
            
            muVideoEffect.lock();
            int enableopenCL = videoEffectParameter.enableOpenCL;
            muVideoEffect.unlock();
            
            int inverted = 1;
            int x = (width - glTexture->GetWidth()) / 2;
            int y = (height  - glTexture->GetHeight()) / 2;
            if(openclContext->IsSharedContextCompatible())
                inverted = 0;
               
            if(!enableopenCL)
                inverted = 1;
                
            if(isffmpegDecode)
                inverted = 1;
                
            //printf("Inverted %d Enable OpenCL %d \n",inverted, enableopenCL);
            printf("flipH : %d flipV : %d inverted : %d \n", flipH, flipV, inverted);
            muVideoEffect.lock();
            renderBitmapOpenGL->RenderWithEffect(x,y, glTexture, &videoEffectParameter, flipH, flipV, inverted);
            printf("Rotation : %d \n",videoEffectParameter.rotation);
            muVideoEffect.unlock();
            
             
        }

        muVideoEffect.lock();
        if(videoEffectParameter.showFPS)
        {
            renderBitmapOpenGL->Print(0, 1, CConvertUtility::ConvertToUTF8(msgFrame));
        }
        muVideoEffect.unlock();

        muSubtitle.lock();

        if(subtilteUpdate && pictureSubtitle != nullptr)
        {
            renderBitmapOpenGL->SetSubtitle(pictureSubtitle);

            delete pictureSubtitle;
            pictureSubtitle = nullptr;

            subtilteUpdate = false;
        }
        else if(subtilteUpdate)
        {
            renderBitmapOpenGL->DeleteSubtitle();
            subtilteUpdate = false;
        }

        muSubtitle.unlock();

        if(videoEffectParameter.enableSubtitle)
        {
            renderBitmapOpenGL->ShowSubtitle();
        }    
	}
	else
	{
		renderBitmapOpenGL->CreateScreenRender(width, height, CRgbaquad(0,0,0,0));
	}

	this->SwapBuffers();

    if(deleteTexture && glTexture != nullptr)
        delete glTexture;
    

    double duration = ( std::clock() - start ) / (double) CLOCKS_PER_SEC;


    std::cout<<"Video OnPaint Time : "<< duration <<'\n';
    

   // printf("OnPaint end \n");
}
コード例 #27
0
double GetChainReactionWindowWidth() { return GetWindowWidth(); }
コード例 #28
0
ファイル: main.cpp プロジェクト: gitter-badger/cpp_codes
static double GetMazeLowerLeftX()
{
	double cx = GetWindowWidth()/2;
	return cx - kMazeDimension/2;
}
コード例 #29
0
ファイル: Main_Scene.cpp プロジェクト: JueSungMun/TOK
void Main_Scene::Initialize(const HWND& hWnd)
{
	if(!Manage_Scene::Initialized())
	{
		Manage_Scene::Initialize(hWnd);
	}
	
	if (!SUCCEEDED(D3DXCreateTextureFromFileEx(gDevice->g_pd3dDevice, background.c_str(), GetWindowWidth(), GetWindowHeight(), 1, NULL, D3DFMT_UNKNOWN, D3DPOOL_MANAGED,
		D3DX_FILTER_NONE, D3DX_FILTER_NONE, NULL, NULL, NULL, &texture)))
	{
		MessageBox(NULL,_T("Image Load error"),NULL,NULL);
	}
	
	if (!SUCCEEDED(D3DXCreateSprite(gDevice->g_pd3dDevice, &spriter)))
	{
		MessageBox(NULL,_T("Error on generating spriter"),NULL,NULL);
	}

	if (!SUCCEEDED(D3DXCreateFont(gDevice->g_pd3dDevice, 30,15, 255, 1, FALSE, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS,
		DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE, _T("맑은 고딕"), &pFont)))
	{
		MessageBox(NULL, _T("Load Error of Font from the System"), NULL, NULL);
	}

	if (!SUCCEEDED(D3DXCreateFont(gDevice->g_pd3dDevice, 30,15, 255, 1, FALSE, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS,
		DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE, _T("맑은 고딕"), &pServerMsgFont)))
	{
		MessageBox(NULL, _T("Load Error of Font from the System"), NULL, NULL);
	}

	if (!SUCCEEDED(hEditWnd = CreateWindow(_T("edit"), _T(""), WS_CHILD | WS_VISIBLE | WS_BORDER | ES_AUTOHSCROLL, 200, 350, 225, 25, hWnd, (HMENU) EDITBTN_ID, NULL, NULL)))
	{
		MessageBox(NULL, _T("Generation error of Edit Box"), NULL, NULL);
	}

	
	if (!SUCCEEDED(btnWnd = CreateWindow(_T("button"),_T("확인"),WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON, 450,350,100,25,hWnd,(HMENU)NAME_SEND_BTN,NULL,NULL)))
	{
		MessageBox(NULL, _T("Generation error of Button"), NULL, NULL);
	}

	if (!SUCCEEDED(permissionWnd = CreateWindow(_T("button"),_T("게임시작"),WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON, 250,400,100,25,hWnd,(HMENU)ACCESS_PERMISSION_BTN,NULL,NULL)))
	{
		MessageBox(NULL, _T("Generation error of Button"), NULL, NULL);
	}
	ShowWindow(permissionWnd, SW_HIDE);
}
コード例 #30
0
ファイル: LuaBind_MyFunc.cpp プロジェクト: oilcode/SoLuaBind
//-----------------------------------------------------------------------------
int luaGetWindowWidth(lua_State* pLuaState)
{
	SoLuaBind::FuncBegin();
	SoLuaBind::Return(GetWindowWidth(SoLuaBind::GetInt(0)));
	return SoLuaBind::FuncEnd();
}