本文整理汇总了C++中Loader::loadTexture方法的典型用法代码示例。如果您正苦于以下问题:C++ Loader::loadTexture方法的具体用法?C++ Loader::loadTexture怎么用?C++ Loader::loadTexture使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Loader
的用法示例。
在下文中一共展示了Loader::loadTexture方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
//Initialize the player.
Player::Player() {
Loader loader;
this->tex = loader.loadTexture("assets/pics/player.png");
this->setTexture(tex);
this->setTextureRect(sf::IntRect(0, 0, 170, 222));
this->setOrigin(this->getLocalBounds().width / 2, this->getLocalBounds().height / 2);
this->setScale(sf::Vector2f(0.3, 0.3));
this->shieldTex = loader.loadTexture("assets/pics/shield.png");
this->shieldTex.setSmooth(true);
this->shield.setTexture(shieldTex);
this->shield.setScale(sf::Vector2f(1.5, 1.5));
this->spawnPoint = sf::Vector2f(400, 500);
this->setPosition(sf::Vector2f(spawnPoint));
this->health = 100;
this->damage = 10;
this->ammoDescription = "Red Rays of Happiness";
this->shieldCharge = 200;
this->isShielded = false;
this->setRotation(0);
this->acceleration = .2f;
this->maxVelocity = 5.f;
this->velocity = sf::Vector2f(0, 0);
this->alive = true;
this->isDying = false;
this->pointMultiplier = 1;
this->rateOfFire = 0.2;
this->frameCount = 0;
}
示例2:
//Constructor takes in the texture path and an id for the Power-Up.
Powerups::Powerups(string path, string id) {
Loader loader;
this->setRadius(20);
this->tex = loader.loadTexture(path);
this->tex.setSmooth(true);
this->setTexture(&tex);
this->id = id;
}
示例3:
Water::Water(float x, float height, float z, glm::vec3 scale, Loader &loader, DisplayManager *display)
{
this->display = display;
modelMatrix = MyMaths::createTransformationmatrix(glm::vec3(x, height, z), 0, 0, 0,
scale);
this->x = x;
this->z = z;
this->height = height;
this->scale = scale;
reflectionBuffer.createFrameBuffer(1024, 1024);
reflectionBuffer.createTextureAttachment();
reflectionBuffer.createDepthBufferAttachment();
refractionBuffer.createFrameBuffer(1024, 1024);
refractionBuffer.createTextureAttachment();
refractionBuffer.createWaterDepthTextureAttachment();
dudvID = loader.loadTexture("./res/waterDUDV.png");
normalMap = loader.loadTexture("./res/matchingNormalMap.png");
}
示例4:
//Constructor. Only takes in the spawn position and initializes the Marauder.
Marauder::Marauder(sf::Vector2f spawn) {
Loader loader;
this->tex = loader.loadTexture("assets/pics/marauder.png");
this->setTexture(tex);
this->setTextureRect(sf::IntRect(0, 0, 162, 234));
this->setOrigin(this->getLocalBounds().width / 2, this->getLocalBounds().height / 2);
this->setScale(sf::Vector2f(0.7, 0.7));
this->setPosition(spawn);
this->setRotation(0);
this->damage = 20;
this->score = 40;
this->health = 120;
this->velocity = sf::Vector2f(1.5, 1.5);
this->frameCount = 0;
}
示例5: WinMain
int WINAPI WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPSTR lpCmdLine,int nCmdShow)
{
#pragma region win_set
WNDCLASSEX wc;
ZeroMemory(&wc, sizeof(WNDCLASSEX));
wc.cbSize = sizeof(WNDCLASSEX);
wc.style = CS_HREDRAW | CS_VREDRAW;
wc.lpfnWndProc = WindowProc;
wc.hInstance = hInstance;
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
wc.lpszClassName = "WindowClass";
RegisterClassEx(&wc);
RECT wr = {0, 0, SW, SH};
AdjustWindowRect(&wr, WS_OVERLAPPEDWINDOW, FALSE);
hWnd = CreateWindowEx(NULL,
"WindowClass",
"DirextX",
WS_DLGFRAME,
300,
300,
wr.right - wr.left,
wr.bottom - wr.top,
NULL,
NULL,
hInstance,
NULL);
ShowWindow(hWnd, nCmdShow);
#pragma endregion Window_Setup
//spawn a console window,useful for debugging ect
AllocConsole() ;
AttachConsole( GetCurrentProcessId() ) ;
freopen("CONIN$", "r", stdin);
freopen("CONOUT$", "w", stdout);
freopen("CONOUT$", "w", stderr);
////////////////////////////////////////////////////
////////////////////////////////////////////////////
/*
Comm * NewComm = new Comm;
NewComm->setup();
NewComm->RECIVE();
*/
//setup object
DxSetup * DX = new DxSetup;
DX->InitD3D();
DX->InitPipeline();
Loader *load = new Loader;
load->loadTexture("Kan.png");
//load->InitLoad("AssetList.txt");
load->LoadObj("cube.obj");
load->LoadObj("spit.obj");
load->LoadObj("box.obj");
//camera obj
Cam * CamOverView = new Cam;
MlistTest.push_back(CamOverView);
//set inittal Camrea postion
cX = 0.0f;
cY = 0.0f;
cZ = -50.0f;
MSG msg;
devcon->ClearRenderTargetView(backbuffer, D3DXCOLOR(0.1f, 0.1f, 0.1f, 1.0f));
//.........这里部分代码省略.........