本文整理汇总了C++中sf::RectangleShape::setOutlineThickness方法的典型用法代码示例。如果您正苦于以下问题:C++ RectangleShape::setOutlineThickness方法的具体用法?C++ RectangleShape::setOutlineThickness怎么用?C++ RectangleShape::setOutlineThickness使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sf::RectangleShape
的用法示例。
在下文中一共展示了RectangleShape::setOutlineThickness方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: init
void WindowCreateThing::init(sf::RenderWindow &window) {
rectTitle.setSize(sf::Vector2f(window.getSize().x*0.45, window.getSize().y*0.07));
rectTitle.setPosition(sf::Vector2f(window.getSize().x/2-(rectTitle.getSize().x/2), window.getSize().x/4-(rectTitle.getSize().y/2)));
rectTitle.setFillColor(sf::Color(158, 158, 158));
rectTitle.setOutlineColor(sf::Color::Black);
rectTitle.setOutlineThickness(1.f);
rectMain.setSize(sf::Vector2f(window.getSize().x*0.45,window.getSize().y*0.45));
rectMain.setPosition(sf::Vector2f(rectTitle.getPosition().x, rectTitle.getPosition().y+rectTitle.getSize().y));
rectMain.setFillColor(sf::Color::White);
rectMain.setOutlineColor(sf::Color::Black);
rectMain.setOutlineThickness(1.f);
load();
starting_position = sf::Mouse::getPosition(window);
textTitle.setFont(font);
textTitle.setString("CreateThings.txt");
textTitle.setCharacterSize(24);
textTitle.setColor(sf::Color::White);
textTitle.setPosition(sf::Vector2f(rectTitle.getPosition().x+rectTitle.getSize().x*0.3, rectTitle.getPosition().y+rectTitle.getSize().y*0.1));
//textTitle.setPosition(sf::Vector2f(400,10));
textClose.setFont(font);
textClose.setString("X");
textClose.setStyle(sf::Text::Bold);
textClose.setCharacterSize(35);
textClose.setColor(sf::Color::White);
textClose.setPosition(sf::Vector2f(rectTitle.getPosition().x+rectTitle.getSize().x-30, rectTitle.getPosition().y+rectTitle.getSize().y*0.05));
///// FOLDER ICONE
textureFolder.setSmooth(true);
spriteFodler.setTexture(textureFolder);
sf::Vector2f targetSize(25.0f, 25.0f);
spriteFodler.setScale(
targetSize.x / spriteFodler.getLocalBounds().width,
targetSize.y / spriteFodler.getLocalBounds().height);
spriteFodler.setPosition(sf::Vector2f(textTitle.getPosition().x-targetSize.x, textTitle.getPosition().y));
///// CLOSE ICONE
/*textureClose.setSmooth(true);
spriteClose.setTexture(textureClose);
sf::Vector2f targetSize2(window.getSize().y*0.07, window.getSize().y*0.07);
spriteClose.setScale(
targetSize2.x / spriteClose.getLocalBounds().width,
targetSize2.y / spriteClose.getLocalBounds().height);
spriteClose.setPosition(rectTitle.getPosition().x+rectTitle.getSize().x-targetSize2.x, rectTitle.getPosition().y);*/
}
示例2: draw
void Sprited::draw(sf::RenderWindow *window)
{
// Scroll sprite
sf::Vector2i shift = this->currentAnimation->frames[this->currentFrame];
this->sprite.setTextureRect(sf::IntRect(shift.x, shift.y, this->width, this->height));
this->sprite.setRotation((this->getWRotation() - this->camera->getWRotation()) / (2 * M_PI) * 360); // + this->wRotation / (2 * M_PI) * 360);
if (this->camera) {
// Transform sprite wPosition based on camera wPosition & wRotation
this->sprite.setPosition(this->applyCameraTransformation(this->getWPosition()));
} else {
// No camera set, meaning this object's wPosition is not affected by camera.
this->sprite.setPosition(this->getWPosition().x, this->getWPosition().y);
}
window->draw(this->sprite);
Movable::draw(window);
#ifdef DEBUG
static sf::RectangleShape origin;
origin.setOrigin(2, 2);
origin.setSize(sf::Vector2f(5, 5));
origin.setPosition(this->sprite.getPosition());
origin.setFillColor(sf::Color(255, 0, 0, 128));
window->draw(origin);
static sf::RectangleShape rect;
rect.setFillColor(sf::Color::Transparent);
rect.setOutlineThickness(1);
rect.setOutlineColor(sf::Color::Blue);
rect.setOrigin(this->sprite.getOrigin());
rect.setPosition(this->sprite.getPosition());
rect.setRotation(this->sprite.getRotation());
rect.setSize(sf::Vector2f(this->sprite.getTextureRect().width, this->sprite.getTextureRect().height));
window->draw(rect);
sf::FloatRect wHitbox = this->getWHitbox();
static sf::RectangleShape hitboxRect;
hitboxRect.setFillColor(sf::Color::Transparent);
hitboxRect.setOutlineThickness(1);
hitboxRect.setOutlineColor(sf::Color::Red);
hitboxRect.setOrigin(sf::Vector2f(wHitbox.width / 2, wHitbox.height / 2));
hitboxRect.setSize(sf::Vector2f(wHitbox.width, wHitbox.height));
hitboxRect.setPosition(this->applyCameraTransformation(this->getWPosition()));
hitboxRect.setRotation(-this->camera->getWRotation() / M_PI * 180);
window->draw(hitboxRect);
#endif
}
示例3: TextSquare
inline TextSquare(Ctx& mCtx, const Vec2f& mPos) : Base{mCtx, mPos}
{
text = &create<Text>(ssvs::zeroVec2f);
bg.setSize(Vec2f{65, 65});
bg.setOutlineColor(sf::Color::White);
bg.setOutlineThickness(3);
}
示例4: setUpBall
void PongGame::setUpBall(int const mainWindowWidth, int const mainWindowHeight, sf::RectangleShape &ball) {
ball.setPosition(mainWindowWidth / 2, mainWindowHeight / 2);
ball.setSize(sf::Vector2f(20, 20));
ball.setFillColor(sf::Color::Red);
ball.setOutlineColor(sf::Color::Yellow);
ball.setOutlineThickness(2);
}
示例5: init
void init(const sf::Vector2f& position, const string filename)
{
_event = Event::NONE;
_shape->setPosition(position);
_shape->setSize(sf::Vector2f(TAILLE_SQUARE, TAILLE_SQUARE));
_shape->setFillColor(sf::Color::Black);
_shape->setOutlineColor(sf::Color::White);
_shape->setOutlineThickness(1);
}
示例6: set_info
// Post battle update
inline void set_info(int str)
{
info_str.setString(std::to_string(str));
health_bar_bg.setSize(sf::Vector2f(get_max_hp()/scale, 10));
health_bar_bg.setOutlineColor(sf::Color(125,125,125));
health_bar_bg.setOutlineThickness(1);
health_bar_current.setSize(sf::Vector2f(str/scale, 10));
health_bar_current.setFillColor(get_life_color(str));
}
示例7: Info
Info(sf::String& text)
{
box.setPosition(100,100);
box.setFillColor(sf::Color(245,248,6));
box.setSize(sf::Vector2f(300,300));
box.setOutlineColor(sf::Color::Red);
box.setOutlineThickness(3);
InfoText.setString(text);
InfoText.setPosition(110,110);
InfoText.setFillColor(sf::Color::White);
}
示例8:
// Constructeur & destructeur
Observer(const sf::Vector2f& center)
{
//sf::Font font;
assert(_font.loadFromFile("vera.ttf") == true);
_text.setColor(sf::Color::White);
_text.setFont(_font);
_text.setCharacterSize(50);
_text.setStyle(sf::Text::Italic);
_border.setPosition(center);
_border.setOutlineColor(sf::Color::White);
_border.setOutlineThickness(2.0);
_border.setFillColor(sf::Color::Transparent);
}
示例9: Demo
BroadphaseDemo(sf::RenderWindow &window) : Demo(window), broadphase(100, 100), mouseObject(sf::Vector2f(50, 50)) {
// set up our mouse object
mouseObject.setOrigin(mouseObject.getSize() / 2.0f);
mouseObject.setOutlineThickness(2);
mouseObject.setFillColor(sf::Color(0, 200, 0));
// set up some random rectangles
for (size_t i = 0; i < 2500; ++i) {
sf::RectangleShape *object = new sf::RectangleShape(sf::Vector2f(randb(5, 15), randb(5, 15)));
object->setOrigin(object->getSize() / 2.0f);
object->setOutlineThickness(2);
objects.push_back(object);
}
}
示例10: spawnFood
void Map::spawnFood() // Fix so doesn't spawn on snake
{
//Generate Random Numbers For Grid Pos For Food
srand(time(NULL));
int randomTile = rand() % numTiles;
if(foodSpawned != true)
{
food.setSize(sf::Vector2f(18, 18));
food.setFillColor(sf::Color::Red);
sf::Color outlineColour(145, 145, 145);
food.setOutlineColor(outlineColour);
food.setOutlineThickness(2);
food.setPosition(tiles[randomTile].getPosition().x, tiles[randomTile].getPosition().y);
foodSpawned = true;
}
else
{
food.setPosition(tiles[randomTile].getPosition().x, tiles[randomTile].getPosition().y);
}
}
示例11:
Selection(float thickness, sf::Color color)
{
rect.setFillColor(sf::Color::Transparent);
rect.setOutlineThickness(thickness);
rect.setOutlineColor(color);
}
示例12: Player
Player () {
PlayerNumber = totalPlayers;
Sprite = loadSpriteData("Player " + intToString(PlayerNumber + 1));
//Get Global width, seperate to rotation
CharacterWidth = Sprite.getGlobalBounds().width;
nameSpacing = 30;
healthBarSpacing = nameSpacing + 15;
Sprite.setOrigin(Sprite.getGlobalBounds().width/2, Sprite.getGlobalBounds().height/2);
Sprite.setPosition((App.getSize().x/2) - (Sprite.getGlobalBounds().width/2), (App.getSize().y/2) - (Sprite.getGlobalBounds().height/2));
//PlayerName.setFont(sf::Font::getDefaultFont());
PlayerName.setCharacterSize(15);
PlayerName.setString("Player: " + intToString(PlayerNumber + 1));
PlayerName.setOrigin(PlayerName.getGlobalBounds().width/2, PlayerName.getGlobalBounds().height/2);
PlayerName.setPosition(Sprite.getPosition().x, Sprite.getPosition().y + nameSpacing);
NameOutline.setSize(sf::Vector2f(PlayerName.getGlobalBounds().width, PlayerName.getGlobalBounds().height));
NameOutline.setOutlineThickness(2);
NameOutline.setFillColor(sf::Color(0, 0, 0, 120));
NameOutline.setOutlineColor(sf::Color::Black);
NameOutline.setOrigin(NameOutline.getGlobalBounds().width/2, NameOutline.getGlobalBounds().height/2);
NameOutline.setPosition(Sprite.getPosition().x + 1.5, Sprite.getPosition().y + nameSpacing + 4);
MaxHealth = Health = 100;
HealthBarSize = 50;
HealthBarRed.setSize(sf::Vector2f(HealthBarSize, 5));
HealthBarRed.setOutlineThickness(1);
HealthBarRed.setFillColor(sf::Color::Red);
HealthBarRed.setOutlineColor(sf::Color::Black);
HealthBarRed.setPosition(Sprite.getPosition().x - (CharacterWidth/2) - 5, Sprite.getPosition().y + healthBarSpacing);
HealthBarGreen.setSize(sf::Vector2f(HealthBarSize, 5));
HealthBarGreen.setOutlineThickness(1);
HealthBarGreen.setFillColor(sf::Color::Green);
HealthBarGreen.setOutlineColor(sf::Color::Black);
HealthBarGreen.setPosition(Sprite.getPosition().x - (CharacterWidth/2) - 5, Sprite.getPosition().y + healthBarSpacing);
if (controllerConnected) {
ControlScheme = ControlSchemes::Joystick;
Key k;
k.InputType = Input::JoystickMovedNeg;
k.KeyCode = sf::Joystick::Axis::Y;
Bindings["Up"] = k;
k.InputType = Input::JoystickMovedPos;
k.KeyCode = sf::Joystick::Axis::Y;
Bindings["Down"] = k;
k.InputType = Input::JoystickMovedNeg;
k.KeyCode = sf::Joystick::Axis::X;
Bindings["Left"] = k;
k.InputType = Input::JoystickMovedPos;
k.KeyCode = sf::Joystick::Axis::X;
Bindings["Right"] = k;
} else {
ControlScheme = ControlSchemes::KeyboardMouse;
Key k;
k.InputType = Input::KeyboardInput;
k.KeyCode = sf::Keyboard::W;
Bindings["Up"] = k;
k.InputType = Input::KeyboardInput;
k.KeyCode = sf::Keyboard::S;
Bindings["Down"] = k;
k.InputType = Input::KeyboardInput;
k.KeyCode = sf::Keyboard::A;
Bindings["Left"] = k;
k.InputType = Input::KeyboardInput;
k.KeyCode = sf::Keyboard::D;
Bindings["Right"] = k;
}
totalPlayers++;
}
示例13: main
void main()
{
menu();
while(true){
sf::Clock clock, clockInvincible;
score1 = 0;
int xBlock, yBlock, x, y, seconds = 0, red, green, blue;
int direction = 0, directionOfBack = 0, size;
bool checkGameOver = false, outOfBounds = false, restarter = false, breaker = false;
size = Robjects.size();
Robjects.erase(Robjects.begin()+0, Robjects.begin()+size);
window.clear();
//---------------------------------------------------------------------------
//sf::RenderWindow window(sf::VideoMode(600, 500), "Testing");
//---------------------------------------------------------------------------
event.type = sf::Event::Count;
sf::RectangleShape square(sf::Vector2f(sizex, sizey));
square.setFillColor(sf::Color(200, 60, 0));
square.setOutlineThickness(2);
square.setOutlineColor(sf::Color(140, 30, 0));
//---------------------------------------------------------------------------
sf::RectangleShape egg(sf::Vector2f(sizex + 2, sizey + 2));
egg.setFillColor(sf::Color(red, green, blue));
egg.setOutlineThickness(2);
egg.setOutlineColor(sf::Color(200, 200, 200));
//---------------------------------------------------------------------------
setAll(x, y, xBlock, yBlock);
//---------------------------------------------------------------------------
egg.setPosition(xBlock, yBlock);
//---------------------------------------------------------------------------
setEgg(red, green, blue);
while(window.isOpen())
{
if(invincible1 == true){
invincible2(x, y);
for(int i = 0; i < Robjects.size(); i++){
Robjects[i].setFillColor(sf::Color(200, 50, 50));
Robjects[i].setOutlineThickness(2);
Robjects[i].setOutlineColor(sf::Color(40, 40, 40));
}
}
else
outOfBounds = checkOutOfBounds(x , y);
sf::Time elapsed1 = clock.getElapsedTime();
seconds = elapsed1.asMilliseconds();
//---------------------------------------------------------------------------
restarter = updateGame(x, y, xBlock, yBlock, direction, directionOfBack, checkGameOver, seconds, red, green, blue);
egg.setFillColor(sf::Color(red, green, blue));
if(restarter == true)
clock.restart();
directionOfBack = CreateTail(x, y, direction, checkGameOver, false);
//---------------------------------------------------------------------------
if((x % 25 == 0)&&(y % 25 == 0)){
//------------------------------------------------------------
while(window.pollEvent(event)) {
if(event.type == sf::Event::Closed){
size = Robjects.size();
Robjects.erase(Robjects.begin()+0, Robjects.begin()+size);
window.close();
}
//---------------------------------------------------------------------
if((event.key.code == sf::Keyboard::P)&&(event.type == sf::Event::KeyPressed)){
window.draw(square);
for(int i = 0; i < Robjects.size(); i++)
window.draw(Robjects[i]);
if(eggs == true){}
else
window.draw(egg);
window.draw(score);
window.display();
while(true){
while(window.pollEvent(event)) {
if((event.key.code == sf::Keyboard::P)&&(event.type == sf::Event::KeyPressed))
breaker = true;
}
if(breaker == true)
break;
}
}
breaker = false;
event.key.code == sf::Keyboard::Q;
if(event.type == sf::Event::KeyPressed){
direction = move(direction, x, y);
square.setPosition(x,y);
}
}
}
//---------------------------------------------------------------------------
if((checkGameOver == true)||(outOfBounds == true))
{
window.clear();
window.draw(square);
for(int i = 0; i < Robjects.size(); i++)
window.draw(Robjects[i]);
window.draw(egg);
//.........这里部分代码省略.........
示例14: setUpPlayer
void PongGame::setUpPlayer(sf::RectangleShape &player) {
player.setSize(sf::Vector2f(borderSize, 90));
player.setFillColor(sf::Color(0, 122, 245));
player.setOutlineColor(sf::Color::Red);
player.setOutlineThickness(3);
}
示例15: setUpBorderRectangle
void PongGame::setUpBorderRectangle(sf::RectangleShape &topRectangle) {
const int outlineThickness = 3;
topRectangle.setFillColor(sf::Color(100, 100, 100));
topRectangle.setOutlineColor(sf::Color::Blue);
topRectangle.setOutlineThickness(outlineThickness);
}