本文整理汇总了C++中GetWidth函数的典型用法代码示例。如果您正苦于以下问题:C++ GetWidth函数的具体用法?C++ GetWidth怎么用?C++ GetWidth使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetWidth函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: Stretch
void Stretch(ConstImageBuffer src) {
Stretch(0, 0, GetWidth(), GetHeight(),
src, 0, 0, src.width, src.height);
}
开发者ID:XCSoar,项目名称:XCSoar,代码行数:4,代码来源:Canvas.hpp
示例2: m_Width
GeometryTerrain::GeometryTerrain(int size, int patch_size, int num_hills, float smoothness, int smooth_passes )
: m_Width(size),
m_Length(size),
m_patchSize(patch_size)
{
if(patch_size < 2) patch_size = 2;
if(patch_size > size) patch_size = size;
m_pHeight = new float*[m_Width+1];
m_fOffsetX = 1.0f;
m_fOffsetY = 1.0f;
m_fOffsetZ = 1.0f;
for(int i = 0; i <= m_Length; i++)
{
m_pHeight[i] = new float[m_Width+1];
memset(m_pHeight[i], 0, sizeof(float)*(m_Length+1));
}
m_pVertices = NULL;
m_nVertexCount = ((unsigned int)GetWidth()+1)*((unsigned int)GetLength()+1);
//memset(m_pVertices, 0, m_nVertexCount);
//memset(m_pNormals, 0, m_nVertexCount);
m_pVertices = new flx_Vertex[m_nVertexCount];
m_pTexCoords = new flx_TexCoord[m_nVertexCount];
m_pNormals = new flx_Normal[m_nVertexCount];
//Add some random Hills and smooth it
generateTerrain(num_hills);
for(int i = 0; i < smooth_passes; ++i)
smoothTerrain(smoothness);
int deg_x = 0, deg_z = 0;
for(int z = 0; z <= GetLength(); z++)
{
for(int x = 0; x <= GetWidth(); x++)
{
//fill Vertex array with data
m_pVertices[x + z * (GetWidth()+1)].x = (float)x * m_fOffsetX;
m_pVertices[x + z * (GetWidth()+1)].y = getHeight(x, z);
m_pVertices[x + z * (GetWidth()+1)].z = (float)z * m_fOffsetZ;
//fill TexCoord array with data
m_pTexCoords[x + z * (GetWidth()+1)].u = (float)((float)x/(GetWidth()+1));
m_pTexCoords[x + z * (GetWidth()+1)].v = (float)((float)z/(GetWidth()+1));
}
}
//Create Indices
for(int z = 0; z < GetLength()-1; z++)
{
//Even rows move left to right
if(z % 2 == 0)
{
int x;
for(x = 0; x < GetWidth(); x++)
{
m_Indices.push_back( x + (z * GetWidth()) );
m_Indices.push_back( x + (z * GetWidth()) + GetWidth() );
}
if(z != GetLength() - 2 )
m_Indices.push_back( --x + (z * GetWidth()) );
}
else
{
//odd rows move right to left
int x;
for(x = GetWidth() -1; x >= 0; x--)
{
m_Indices.push_back( x + (z * GetWidth()) );
m_Indices.push_back( x + (z * GetWidth()) + GetWidth() );
}
if(z != GetLength() - 2 )
m_Indices.push_back( ++x + (z * GetWidth()) );
}
}
//Fill the buffers with data
//VertexBuffer.setElementList(m_pVertices, m_nVertexCount);
//TexCoordBuffer.setElementList(m_pTexCoords, m_nVertexCount);
//...and calculate the Normals
computeNormals();
//Buffers ready to bind!
//NormalBuffer.build(GL_ARRAY_BUFFER, GL_NORMAL_ARRAY);
//VertexBuffer.build(GL_ARRAY_BUFFER, GL_VERTEX_ARRAY);
//TexCoordBuffer.build(GL_ARRAY_BUFFER, GL_TEXTURE_COORD_ARRAY);
buildPatches(0);
//delete [] m_pVertices; m_pVertices = NULL;
//.........这里部分代码省略.........
开发者ID:grimtraveller,项目名称:fluxengine,代码行数:101,代码来源:flx_geometry_terrain.cpp
示例3: getBytesRequired
long
ImageLoader::GetBytesPerLine () {
return getBytesRequired(GetWidth(), _myEncoding);
}
开发者ID:artcom,项目名称:y60,代码行数:4,代码来源:ImageLoader.cpp
示例4: shadowMapTexture
void GeometryTerrain::computeLightmap(Vector3 _vlightSource, bool update)
{
bool bIntegrateNormals = false;
std::vector<GLubyte> shadowMapTexture(GetWidth()*GetWidth()*4);
float maxHeight = -99999.0f;
for(int z =0; z <= GetLength(); ++z)
for(int x = 0; x <= GetWidth(); ++x)
maxHeight = max(getHeight(x,z), maxHeight);
for(int z =0; z <= GetLength(); ++z)
{
for(int x = 0; x <= GetWidth(); ++x)
{
float ambientLight = 255;
Ray lightRay(Vector3(x, getHeight(x, z), z), _vlightSource );
Vector3 current_ray_pos(Vector3(x, getHeight(x, z), z));
Vector3 direction_to_sun = lightRay.m_v3Direction.normalize();
int numRayHits = 0;
while(!(current_ray_pos.x <= 0 || current_ray_pos.x >= GetWidth() || current_ray_pos.z <= 0 || current_ray_pos.z >= GetWidth() ))
{
if(current_ray_pos.y > maxHeight) break;
// Is the terrain blocking the ray at this point?
if(getHeight((int)floor(current_ray_pos.x), (int)floor(current_ray_pos.z)) > current_ray_pos.y)
{
numRayHits++;
break;
}
//light still traveling...
current_ray_pos += direction_to_sun;
}
float ambientLightNormals = 0;
if(bIntegrateNormals)
{
Vector3 n(
m_pNormals[x+z * (GetWidth()+1)].x,
m_pNormals[x+z * (GetWidth()+1)].y,
m_pNormals[x+z * (GetWidth()+1)].z
);
ambientLightNormals = 0.5*( 1.0f + dot(n.normalize(), direction_to_sun) );
if(ambientLightNormals > 1.0f) ambientLightNormals = 1.0f;
if(ambientLightNormals < 0.0f) ambientLightNormals = 0.0f;
}
if(numRayHits > 0)
{
//ambientLight = (current_ray_pos - Vector3(x,getHeight(x,z),z)).magnitude() - ambientLightNormals * 255;
ambientLight = 170;
if(ambientLight > 255) ambientLight = 255;
if(ambientLight < 170) ambientLight = 170;
}
int index = (x + z * GetWidth()) * 3;
for (int i = 0; i < 3; ++i) {
shadowMapTexture[index + i] = (GLubyte)ambientLight;
}
}
}
for(int z =0; z <= GetLength(); ++z)
{
for(int x = 0; x <= GetWidth(); ++x)
{
int factor = 2;
ColorOGL colCurrent;
colCurrent.m_fRed = shadowMapTexture[(x + z * GetWidth()) * 3 + 0];
colCurrent.m_fGreen = shadowMapTexture[(x + z * GetWidth()) * 3 + 1];
colCurrent.m_fBlue = shadowMapTexture[(x + z * GetWidth()) * 3 + 2];
ColorOGL colT;
ColorOGL colD;
ColorOGL colL;
ColorOGL colR;
if(shadowMapTexture.size() > ((x + (z+factor) * GetWidth()) * 3 + 0) &&
shadowMapTexture.size() > ((x + (z+factor) * GetWidth()) * 3 + 1) &&
shadowMapTexture.size() > ((x + (z+factor) * GetWidth()) * 3 + 2)
)
{
colT.m_fRed = shadowMapTexture[(x + (z+factor) * GetWidth()) * 3 + 0];
colT.m_fGreen = shadowMapTexture[(x + (z+factor) * GetWidth()) * 3 + 1];
colT.m_fBlue = shadowMapTexture[(x + (z+factor) * GetWidth()) * 3 + 2];
}
if(shadowMapTexture.size() > ((x + (z-factor) * GetWidth()) * 3 + 0) &&
shadowMapTexture.size() > ((x + (z-factor) * GetWidth()) * 3 + 1) &&
shadowMapTexture.size() > ((x + (z-factor) * GetWidth()) * 3 + 2)
)
{
colD.m_fRed = shadowMapTexture[(x + (z-factor) * GetWidth()) * 3 + 0];
colD.m_fGreen = shadowMapTexture[(x + (z-factor) * GetWidth()) * 3 + 1];
colD.m_fBlue = shadowMapTexture[(x + (z-factor) * GetWidth()) * 3 + 2];
}
//.........这里部分代码省略.........
开发者ID:grimtraveller,项目名称:fluxengine,代码行数:101,代码来源:flx_geometry_terrain.cpp
示例5: Vector3
Vector3 GeometryTerrain::getNormal(int x, int z)
{
return Vector3(m_pNormals[x+z * (GetWidth()+1)].x,m_pNormals[x+z * (GetWidth()+1)].y,m_pNormals[x+z * (GetWidth()+1)].z);
}
开发者ID:grimtraveller,项目名称:fluxengine,代码行数:4,代码来源:flx_geometry_terrain.cpp
示例6: SetPos
void CUIQuestRestore::ResetPosition( PIX pixMinI, PIX pixMinJ, PIX pixMaxI, PIX pixMaxJ )
{
SetPos( ( pixMaxI + pixMinI - GetWidth() ) / 2 , ( pixMaxJ + pixMinJ - GetHeight() ) / 2 );
}
开发者ID:RocketersAlex,项目名称:LCSource,代码行数:4,代码来源:UIQuestRestore.cpp
示例7: CCreate_Rock_Fall_Message
void CEarthBoss::Update(float fElapsedTime)
{
CEnemy::Update(fElapsedTime);
if (m_pEState->GetState() == EntityState::DEAD)
{
return;
}
m_fUpdateOldPos += fElapsedTime;
if(m_nCoolDown > 0)
m_nCoolDown -= fElapsedTime;
if( m_fPunchCoolDown > 0.0f && m_bPunching == true)
m_fPunchCoolDown -= fElapsedTime;
else
{
m_fPunchCoolDown = 2.5f;
m_bPunching = false;
}
if (m_fSpecialTimer > 0.0f)
m_fSpecialTimer -= fElapsedTime;
else
{
CCreate_Rock_Fall_Message* pMsg = new CCreate_Rock_Fall_Message();
CSGD_MessageSystem::GetInstance()->SendMsg(pMsg);
pMsg = nullptr;
m_fSpecialTimer = 15.0f;
}
//if not rushing do basic path finding to the player
if(GetTarget() != nullptr)
{
float tar_pos_x = GetTarget()->GetPosX();
float tar_pos_y = GetTarget()->GetPosY();
if(tar_pos_x > GetPosX())
{
//set Grunt's animation's facing to the right
SetFlipped(true);
}
else
{
SetFlipped(false);
}
if(m_fMoveAway <= 0)
{
// tar_pos_x += (m_bFlipped) ? -236 : 236;
//Simple Pathing twards the player
if(tar_pos_y != GetPosY())//Above the Player
{
float min_Distance = (float)(GetTarget()->GetWidth()/2 + GetWidth()/2);
if(GetPosX() + min_Distance > tar_pos_x && GetPosX() - min_Distance < tar_pos_x)
{
if( tar_pos_x < GetPosX())
SetVelX(speed * fElapsedTime);
else
SetVelX(-speed * fElapsedTime);
}
else
{
if( tar_pos_y < GetPosY())
SetVelY(-speed * fElapsedTime);
else
SetVelY(speed * fElapsedTime);
if( tar_pos_x < GetPosX())
SetVelX(-speed * fElapsedTime);
else
SetVelX(speed * fElapsedTime);
if( tar_pos_x > (GetPosX() - 64) && tar_pos_x < (GetPosX() + 64) )
{
if( tar_pos_y > (GetPosY() - 32) && tar_pos_y < (GetPosY() + 32) && m_bPunching == false)
{
GetAnimInfo()->SetAnimationName("Boss1_Attack_Animation");
m_bPunching = true;
//dynamic_cast<CPlayer*>(GetTarget())->SetState(CEntityState::KNOCKED_DOWN);
}
}
}
}
else
{
SetVelY(0);
if( tar_pos_x < GetPosX())
//.........这里部分代码省略.........
开发者ID:kendellm,项目名称:Trials-of-Mastery,代码行数:101,代码来源:EarthBoss.cpp
示例8: Hide
void CTargetMenu::Update( POINT ptMouse )
{
if( !IsVision()) return;
CTDialog::Update( ptMouse );
if( m_iTargetAvatarID )
{
CObjCHAR *pObj = (CObjCHAR*)g_pObjMGR->Get_CharOBJ( m_iTargetAvatarID, true );
/// 유효하지 않은 타겟이다.. 마우스 컴맨드 초기화
if( pObj == NULL )
{
Hide();
}
else
{
if( g_pAVATAR->Get_DISTANCE( pObj ) >= 1200 )
Hide();
else
{
D3DVECTOR PosSCR;
POINT ptNew;
pObj->GetScreenPOS (PosSCR);
ptNew.x = (int)PosSCR.x - GetWidth() / 2;
ptNew.y = (int)PosSCR.y - ( GetHeight() * 2 / 3 );
MoveWindow( ptNew );
}
}
}
WINCTRL_LIST_ITOR iter;
CWinCtrl* pCtrl;
for( iter = m_listChild.begin(); iter != m_listChild.end(); ++iter)
{
pCtrl = *iter;
if( pCtrl->GetControlType() == CTRL_IMAGE )
continue;
if( pCtrl->IsInside(ptMouse.x, ptMouse.y ) )
{
// g_itMGR.DrawToolTip( (short)ptMouse.x, (short)ptMouse.y, GetDialogType(), pCtrl->GetControlID());
break;
}
}
/*
int iTargetID = g_pAVATAR->m_iServerTarget;
if( iTargetID )
{
CObjCHAR *pObj = (CObjCHAR*)g_pObjMGR->Get_CharOBJ( g_CommandState.GetCurrentTarget(), true );
/// 유효하지 않은 타겟이다.. 마우스 컴맨드 초기화
if( pObj == NULL )
{
g_CommandState.ClearMouseState();
Hide();
return;
}
///Target이 아바타일경우에만 현재 스크린 좌표에 따라서 윈도우의 위치 조정
if( pObj->Get_TYPE() == OBJ_AVATAR )
{
D3DVECTOR PosSCR;
POINT ptNew;
pObj->GetScreenPOS (PosSCR);
ptNew.x = (int)PosSCR.x - GetWidth() / 2;
ptNew.y = (int)PosSCR.y - ( GetHeight() * 2 / 3 );
MoveWindow( ptNew );
m_iTargetAvatarID = iTargetID;
// Show();
}
else
{
Hide();
}
}
else
Hide();
*/
}
开发者ID:PurpleYouko,项目名称:Wibble_Wibble,代码行数:82,代码来源:CTargetMenu.cpp
示例9: assert
void PlayScene::Start()
{
const auto fitsH = static_cast<int32_t>(std::ceil(static_cast<float>(GGame.GetWidth()) / kSpriteWidth)) + 1;
const auto fitsV = static_cast<int32_t>(std::ceil(static_cast<float>(GGame.GetHeight()) / kSpriteOddYOffset)) + 1;
_columns = fitsH;
_rows = fitsV;
SpriteParams params;
params.persistant = false;
params.texture = nullptr;
params.z = 5;
for (int32_t i = 0; i < kMap.size(); i++)
{
params.textureName = kMap[i];
auto sprite = GGame.Create<Sprite>(params);
assert(kSpriteWidth == sprite->GetWidth());
assert(kSpriteHeight == sprite->GetHeight());
auto pos = VectorIndexToXY(i);
sprite->SetCenterPosition(pos.first, pos.second);
_backgroundSprites.push_back(sprite);
}
params.z = 6;
params.textureName = "landingPlatform";
_landingPlatform = GGame.Create<Sprite>(params);
auto pos = VectorIndexToXY(RowColumnToVectorIndex(3, 5));
_landingPlatform->SetCenterPosition(pos.first, pos.second);
_landingPlatform->SetAlpha(0.0f);
params.z = 7;
params.textureName = "spaceCraft";
_spacecraft = GGame.Create<Sprite>(params);
pos = VectorIndexToXY(RowColumnToVectorIndex(3, 5));
pos.first += kLandingOffset.first;
pos.second += kLandingOffset.second - 150;
_spacecraft->SetCenterPosition(pos.first, pos.second);
ResourceBarParams resourceBarParams;
resourceBarParams.persistant = false;
resourceBarParams.initialWood = 150;
resourceBarParams.initialCrystal = 20;
resourceBarParams.z = 100;
_resourceBar = GGame.Create<ResourceBar>(resourceBarParams);
BuildingPanelParams buildingPanelParams;
buildingPanelParams.persistant = false;
buildingPanelParams.z = 100;
_buildingPanel = GGame.Create<BuildingPanel>(buildingPanelParams);
_buildingPanel->SetPosition(GGame.GetWidth() - _buildingPanel->GetWidth(),
GGame.GetHeight());
_landingTimer = 0.0f;
_landingFinished = false;
_landingDestination = VectorIndexToXY(RowColumnToVectorIndex(3, 5));
_landingDestination.first += kLandingOffset.first;
_landingDestination.second += kLandingOffset.second;
_uiSlideTimer = 0.0f;
_uiSlideFinished = false;
}
开发者ID:VHonzik,项目名称:Jadernak-ludum-dares,代码行数:68,代码来源:PlayScene.cpp
示例10: return
// Returns true if given co-ordinate is in this area
BOOL CSectionHandler::HasPoint(int iX,int iY)
{
return (iX>=m_iX && iY>=m_iY &&
iX<m_iX+GetWidth()+GetWidthOffset() && iY<m_iY+GetHeight()+GetHeightOffset());
}
开发者ID:quen,项目名称:leafdrums2,代码行数:6,代码来源:SectionHandler.cpp
示例11: ResizeRelation
/* Automatic type deduction, and placement
----------------------------------------------------------------------------------------------------*/
void TableSystemWidget::Insert( Widget *pwidget )
{
/* Try for IWTable interface
----------------------------------------------------------------------------------------------------*/
if ( IWTable *pi_tb = dynamic_cast<IWTable*>(pwidget) )
{
TableWidget *ptw = &pi_tb->Table();
if ( _p_main_table ) { APP_ERROR( Error("Insert: Table allready exists"), "TableSystemWidget"); }
_p_table_scroller->AttachWidget( (_p_main_table=pi_tb)->AtomPtr() );
_pri_tbl_width = pi_tb->Atom().GetWidth();
_pri_tbl_height= pi_tb->Atom().GetHeight();
pi_tb->Atom().OnResize.TieVoid( this, &TableSystemWidget::UpdateTableSizes );
if ( _p_caption_sizer )
{
_p_caption_sizer->Atom().Posses( new
ResizeRelation( _p_caption_sizer->Atom(), _p_main_table->Atom(), true, false )
);
}
}
/* Try for IWSizer interface
----------------------------------------------------------------------------------------------------*/
else if ( IWSizer *pi_siz = dynamic_cast<IWSizer *>(pwidget) )
{
SizerWidget *psw = &pi_siz->Sizer();
if ( _p_caption_sizer ) { APP_ERROR( Error("Insert: Caption sizer allready exists"), "TableSystemWidget"); }
_p_caption_scroller->AttachWidget( (_p_caption_sizer=pi_siz)->AtomPtr() );
_cs_height = _p_caption_sizer->Atom().GetHeight();
if ( _p_main_table )
{
_p_caption_sizer->Atom().Posses( new
ResizeRelation( _p_caption_sizer->Atom(), _p_main_table->Atom(), true, false )
);
}
}
/* Try for IWScrollbar interface
----------------------------------------------------------------------------------------------------*/
else if ( IWScrollbar *pi_sb = dynamic_cast<IWScrollbar*>(pwidget) )
{
ScrollbarWidget *psbw = &pi_sb->Scroller();
if ( psbw->IsHorizontal() )
{
if (_p_horiz_scrollbar ) { APP_ERROR( Error("Insert: H Scrollbar allready exists"), "TableSystemWidget"); }
HubWidget::Insert( (_p_horiz_scrollbar = pi_sb)->AtomPtr() );
_sb_height = _p_horiz_scrollbar->Atom().GetHeight();
assert(_p_main_table);
_p_table_scroller->Posses(
new AdvScrollRelation( *_p_table_scroller, *_p_horiz_scrollbar, false )
);
_p_horiz_scrollbar->Atom().OnVisible.TieVoid( this, &TableSystemWidget::UpdateScrollbarSizes );
}
else
{
if ( _p_verti_scrollbar ) { APP_ERROR( Error("Insert: V Scrollbar allready exists"), "TableSystemWidget"); }
HubWidget::Insert( (_p_verti_scrollbar = pi_sb)->AtomPtr() );
_sb_width = _p_verti_scrollbar->Atom().GetWidth();
assert(_p_main_table);
// if top gadget was inserted then relation type is disable-scrollbar relation
if ( _p_top_gadget )
{
_vertical_scroll_rel = new AdvScrollRelation2( *_p_table_scroller, *_p_verti_scrollbar, true );
_p_verti_scrollbar->Atom().Show();
}
// else it is hide scrollbar-relation
else
{
_vertical_scroll_rel = new AdvScrollRelation( *_p_table_scroller, *_p_verti_scrollbar, true );
}
_p_verti_scrollbar->Atom().OnVisible.TieVoid( this, &TableSystemWidget::UpdateScrollbarSizes );
}
}
/* Check if it's supposed to be a surrounding frame
----------------------------------------------------------------------------------------------------*/
else if ( FrameWidget *pfw = dynamic_cast<FrameWidget*>(pwidget) )
{
HubWidget::Retrieve( _p_table_scroller );
HubWidget::Retrieve( _p_caption_scroller );
HubWidget::Insert( _p_table_frame = pfw );
_p_table_frame->Insert( _p_table_scroller );
_p_table_frame->Insert( _p_caption_scroller );
}
/* We can place two small gadgets
----------------------------------------------------------------------------------------------------*/
else if ( !_p_bottom_gadget )
{
// if top gadget is beig inserted then change relation type to disable-scrollbar relation
if (!_p_top_gadget && _p_verti_scrollbar)
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:utgs-svn,代码行数:101,代码来源:TableSystemWidget.cpp
示例12: GetWidth
void TableSystemWidget::Fit()
{
int w = GetWidth(), h=GetHeight();
int sb_width = _sb_width;
int sb_height = _sb_height;
if (_p_verti_scrollbar && _p_verti_scrollbar->Atom().IsVisible() )
{
_ResizePositive( _p_verti_scrollbar->AtomPtr(), sb_width, h-(_cs_height+sb_height) );
_p_verti_scrollbar->Atom().SetPosition ( Pos( w-sb_width, _cs_height) );
}
if (_p_horiz_scrollbar && _p_horiz_scrollbar->Atom().IsVisible() )
{
_ResizePositive( _p_horiz_scrollbar->AtomPtr(), w-sb_width, sb_height );
_p_horiz_scrollbar->Atom().SetPosition ( Pos( 0, h-sb_height ) );
}
if (_p_table_frame)
{
int frame_w = w-sb_width;
int frame_h = h-sb_height;
_p_table_frame->Fill( Rect( 0, 0, frame_w, frame_h ));
Rect c = _p_table_frame->GetClientRect( _p_caption_scroller );
_p_caption_scroller->Resize( c.GetW(), _cs_height );
_p_caption_scroller->SetPosition( c.GetPos() );
_ResizePositive( _p_table_scroller, c.GetW(), c.GetH()-_cs_height );
_p_table_scroller->SetPosition( c.GetPos() + Pos( 0, _cs_height) );
}
else
{
if (_p_caption_scroller)
{
_p_caption_scroller->Resize( w-sb_width, _cs_height );
_p_caption_scroller->SetPosition( Pos(0,0) );
}
if (_p_table_scroller)
{
_ResizePositive( _p_table_scroller, w-sb_width, h-(_cs_height+sb_height) );
_p_table_scroller->SetPosition ( Pos(0,_cs_height) );
}
}
if ( _p_top_gadget )
{
_p_top_gadget->SetPosition( Pos( w-_p_top_gadget->GetWidth(), 0) );
HubWidget::BringOnTop( _p_top_gadget );
}
if ( _p_bottom_gadget )
{
if ( sb_width && sb_height )
{
_p_bottom_gadget->SetPosition( Pos( w-sb_width, h-sb_height) );
if ( !_p_bottom_gadget->Atom().IsVisible() ) { _p_bottom_gadget->Atom().Show(); }
}
else if ( _p_bottom_gadget->Atom().IsVisible() ) { _p_bottom_gadget->Atom().Hide(); }
}
if ( _auto_cover )
{
int pri_tbl_width = _pri_tbl_width;
int pri_tbl_height= _pri_tbl_height;
int table_w = pri_tbl_width;
int table_h = pri_tbl_height;
int client_w = _p_table_scroller->GetWidth();
int client_h = _p_table_scroller->GetHeight();
// try to cover all client area by table (if table is smaller than area)
if ( client_w > table_w )
{
_p_main_table->Atom().Resize( client_w, table_h );
}
else if ( client_w < pri_tbl_width )
{
_p_main_table->Atom().Resize( pri_tbl_width, table_h );
}
table_w = _p_main_table->Atom().GetWidth();
if ( client_h > table_h )
{
_p_main_table->Atom().Resize( table_w, client_h );
}
else if ( client_h < pri_tbl_height )
{
_p_main_table->Atom().Resize( table_w, pri_tbl_height );
}
table_h = _p_main_table->Atom().GetHeight();
// right scrollbar dissappears only if top-gadget does not exist
if ( !_p_top_gadget )
{
// Check if full table would be visible if we hide both scrollbars
bool would_fit_width = client_w + sb_width >= table_w;
bool would_fit_height= client_h + sb_height >= table_h;
if ( would_fit_width && would_fit_height )
{
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:utgs-svn,代码行数:101,代码来源:TableSystemWidget.cpp
示例13: CopyOr
void CopyOr(const Bitmap &src) {
CopyOr(0, 0, GetWidth(), GetHeight(), src, 0, 0);
}
开发者ID:XCSoar,项目名称:XCSoar,代码行数:3,代码来源:Canvas.hpp
示例14: assert
void vfeDisplay::DrawPixel(unsigned int x, unsigned int y, const RGBA8& colour)
{
assert (x < GetWidth() && y < GetHeight());
m_Pixels[y * GetHeight() + x] = colour;
}
开发者ID:Degot,项目名称:povray,代码行数:5,代码来源:vfedisplay.cpp
示例15: OnDeviceReset
void DiRenderWindow::OnDeviceReset()
{
if (mSceneManager)
mSceneManager->GetCamera()->SetAspectRatio(float(GetWidth())/float(GetHeight()));
}
开发者ID:redkaras,项目名称:Demi3D,代码行数:5,代码来源:RenderWindow.cpp
示例16: if
//.........这里部分代码省略.........
for(unsigned int l = 0; l < lights.Size(); l++)
{
Vector3f& p = lights[l]->p;
Vector3f& d = lights[l]->d;
float I = lights[l]->I;
// light is on wrong side of surface
if(Dot(p - lsurf->c, lsurf->N) < 0.1)
continue;
g_renderer->SetLight(0, p.x, p.y, p.z);
g_renderer->SetLightDir(0, d.x, d.y, d.z);
g_renderer->SetLightIntensity(0, I);
g_renderer->SetLightFraction(0, 1.0 / (float)lights.Size());
lsurf->Frame(p);
lsurf->CreateLightMap(p, d, surfaces);
lsurf->AccumulateResidualLight();
lsurf->AccumulateLight();
g_renderer->SetViewMatrix(0);
patches += lsurf->GetNumPatches();
}
r_resid.Set(r_resid.GetBool() ? "1" : "0");
}
}
surf++;
}
if(r_resid.Changed())
{
for(int i = 0; i < surfaces.Size(); i++)
{
Surface* lsurf = surfaces[i];
lsurf->Frame(lsurf->c + lsurf->N*10.0);
if(r_resid.GetBool())
lsurf->CopyResidualToLightMap();
else
lsurf->CopyAccumToLightMap();
}
}
// Render normal view
view.Translate() = Vector3f(cl_camx.GetFloat(),
cl_camy.GetFloat(),
cl_camz.GetFloat());
view = view.Inverse();
g_renderer->SetViewport(0,0, GetWidth(),GetHeight());
g_renderer->SetViewMatrix(view);
g_renderer->SetProjectionMatrix(0);
g_renderer->SetClearColor(0.25f, 0.25f, 0.35f, 1.0f);
g_renderer->BindMaterial(0);
g_renderer->Clear(R_COLOR_BUFFER | R_DEPTH_BUFFER);
g_renderer->SetColor(1,1,1);
int bsurf = 0;
float maxPower = 0.0;
for(unsigned int i = 0; i < surfaces.Size(); i++)
{
float p = surfaces[i]->GetPower();
if(p > maxPower)
{
bsurf = i;
maxPower = p;
}
}
// draw all surfaces normally
for(unsigned int i = 0; i < surfaces.Size(); i++)
{
if(r_showbrightest.GetBool())
{
if(i == bsurf)
g_renderDevice->SetColor(1.0, 1.0, 0.7);
else
g_renderDevice->SetColor(1,1,1);
}
surfaces[i]->Render();
}
g_console->Draw(g_renderer);
g_renderer->DrawTextP(15, 50, 16, r_resid.GetBool() ? "Residual" : "Accumulation");
g_renderer->DrawTextP(15, 30, 16, "Step: %d", pass);
g_renderer->DrawTextP(15, 10, 16, "Patches: %d", patches);
g_materialSystem->BindMaterial(logo);
g_renderer->DrawRect(GetWidth()-200, 0, 200, 50, 0,0,1,1);
g_renderer->Flip();
}
开发者ID:mironside,项目名称:rabid,代码行数:101,代码来源:rabid.cpp
示例17: Copy
void
Canvas::Copy(const Canvas &src, int src_x, int src_y)
{
Copy(0, 0, GetWidth(), GetHeight(), src, src_x, src_y);
}
开发者ID:nkgautam,项目名称:XCSoar,代码行数:5,代码来源:Canvas.cpp
示例18: AdjustPosition
void CUIQuestRestore::AdjustPosition( PIX pixMinI, PIX pixMinJ, PIX pixMaxI, PIX pixMaxJ )
{
if( m_nPosX < pixMinI || m_nPosX + GetWidth() > pixMaxI ||
m_nPosY < pixMinJ || m_nPosY + GetHeight() > pixMaxJ )
ResetPosition( pixMinI, pixMinJ, pixMaxI, pixMaxJ );
}
开发者ID:RocketersAlex,项目名称:LCSource,代码行数:6,代码来源:UIQuestRestore.cpp
示例19: RB_GLSL_SubmitDrawInteractions
//.........这里部分代码省略.........
else {
//no shadows
fhRenderProgram::SetShadowMappingMode( 0 );
}
//make sure depth hacks are disabled
//FIXME(johl): why is (sometimes) a depth hack enabled at this point?
RB_LeaveDepthHack();
fhRenderProgram::SetProjectionMatrix( backEnd.viewDef->projectionMatrix );
fhRenderProgram::SetPomMaxHeight( -1 );
const viewEntity_t* currentSpace = nullptr;
stageVertexColor_t currentVertexColor = (stageVertexColor_t)-1;
bool currentPomEnabled = false;
idScreenRect currentScissor;
bool depthHackActive = false;
bool currentHasBumpMatrix = false;
bool currentHasDiffuseMatrix = false;
bool currentHasSpecularMatrix = false;
idVec4 currentDiffuseColor = idVec4( 1, 1, 1, 1 );
idVec4 currentSpecularColor = idVec4( 1, 1, 1, 1 );
fhRenderProgram::SetDiffuseColor( currentDiffuseColor );
fhRenderProgram::SetSpecularColor( currentSpecularColor );
fhRenderProgram::SetBumpMatrix( idVec4::identityS, idVec4::identityT );
fhRenderProgram::SetSpecularMatrix( idVec4::identityS, idVec4::identityT );
fhRenderProgram::SetDiffuseMatrix( idVec4::identityS, idVec4::identityT );
glDepthRange(0, 1);
if (r_useScissor.GetBool()) {
auto fb = fhFramebuffer::GetCurrentDrawBuffer();
glScissor( 0, 0, fb->GetWidth(), fb->GetHeight() );
currentScissor.x1 = 0;
currentScissor.y1 = 0;
currentScissor.x2 = fb->GetWidth();
currentScissor.y2 = fb->GetHeight();
}
const int num = interactionList.Num();
for (int i = 0; i < num; ++i) {
const auto& din = interactionList[i];
const auto offset = vertexCache.Bind( din.surf->geo->ambientCache );
GL_SetupVertexAttributes( fhVertexLayout::Draw, offset );
if (currentSpace != din.surf->space) {
fhRenderProgram::SetModelMatrix( din.surf->space->modelMatrix );
fhRenderProgram::SetModelViewMatrix( din.surf->space->modelViewMatrix );
if (din.surf->space->modelDepthHack) {
RB_EnterModelDepthHack( din.surf->space->modelDepthHack );
fhRenderProgram::SetProjectionMatrix( GL_ProjectionMatrix.Top() );
depthHackActive = true;
}
else if (din.surf->space->weaponDepthHack) {
RB_EnterWeaponDepthHack();
fhRenderProgram::SetProjectionMatrix( GL_ProjectionMatrix.Top() );
depthHackActive = true;
}
else if (depthHackActive) {
RB_LeaveDepthHack();
fhRenderProgram::SetProjectionMatrix( GL_ProjectionMatrix.Top() );
depthHackActive = false;
}
开发者ID:RobertBeckebans,项目名称:fhDOOM,代码行数:67,代码来源:RenderList_interaction.cpp
示例20: POST_MESSAGE
void Brush::Send()
{
if (m_IsActive)
POST_MESSAGE(Brush, (GetWidth(), GetHeight(), GetData()));
}
开发者ID:Gallaecio,项目名称:0ad,代码行数:5,代码来源:Brushes.cpp
注:本文中的GetWidth函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论