本文整理汇总了C++中Texture::GetResourceHeight方法的典型用法代码示例。如果您正苦于以下问题:C++ Texture::GetResourceHeight方法的具体用法?C++ Texture::GetResourceHeight怎么用?C++ Texture::GetResourceHeight使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Texture
的用法示例。
在下文中一共展示了Texture::GetResourceHeight方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LoadSprite
void Sprite::LoadSprite(const char * filename)
{
const std::string fullFileName(std::string(SPRITE_PATH) + std::string(filename) + std::string(".spr"));
ConfigLua conf(fullFileName.c_str());
mHeader.frameCount = conf.GetInt("gclsprite.frame_count");
mHeader.width = conf.GetInt("gclsprite.width");
mHeader.height = conf.GetInt("gclsprite.height");
mHeader.textureCount = conf.GetInt("gclsprite.texture_count");
std::stringstream fullTextureKey;
const std::string textureKey("gclsprite.textures.texture");
for (size_t i=0; i<mHeader.textureCount; ++i)
{
fullTextureKey.str("");
fullTextureKey << textureKey;
fullTextureKey << i;
const std::string filename = conf.GetString(fullTextureKey.str().c_str());
std::string fullTextureFileName(TEXTURE_PATH);
fullTextureFileName += filename;
Texture *texture = new Texture(fullTextureFileName.c_str());
GCLAssertMsg(mHeader.width <= texture->GetResourceWidth(), std::string(filename) + ": You have a sprite that is bigger than your texture");
GCLAssertMsg(mHeader.height <= texture->GetResourceHeight(), std::string(filename) + ": You have a sprite that is bigger than your texture");
mTextureList.push_back(texture);
}
MeshReal halfWidth = MeshReal(mHeader.width/2.0);
MeshReal halfHeight = MeshReal(mHeader.height/2.0);
square[0] = VertexPT(Point3<MeshReal>(-halfWidth, halfHeight, 0.0), Point2<MeshReal>(0.0, 1.0)); // top left
square[1] = VertexPT(Point3<MeshReal>(halfWidth, -halfHeight, 0.0), Point2<MeshReal>(1.0, 0.0)); // bot right
square[2] = VertexPT(Point3<MeshReal>(-halfWidth, -halfHeight, 0.0),Point2<MeshReal>(0.0, 0.0)); // bot left
square[3] = VertexPT(Point3<MeshReal>(halfWidth, halfHeight, 0.0), Point2<MeshReal>(1.0, 1.0)); // top right
square[4] = VertexPT(Point3<MeshReal>(halfWidth, -halfHeight, 0.0), Point2<MeshReal>(1.0, 0.0)); // bot right
square[5] = VertexPT(Point3<MeshReal>(-halfWidth, halfHeight, 0.0), Point2<MeshReal>(0.0, 1.0)); // top left
mMaterial = new Material("DefaultSprite");
mObj = new RenderObject( *mMaterial, square, 6);
}