0 Members and 2 Guests are viewing this topic.
#include <SFML/Graphics.hpp>#include <SFML/Window.hpp>#include <windows.h>#include <vector>#include <iostream>int main(){ std::string wordArr[32] = {"integer", "character", "void", "main", "function", "implicit", "null", "include", "typename", "cast", "debug", "command"}; for(int i = 0; i < 32; i++) { std::cout << wordArr[i] << "\n"; } sf::RenderWindow App(sf::VideoMode(800, 600, 32), "Hangman: Programmer's edition"); const sf::Input& Input = App.GetInput(); sf::Image img; if(!img.LoadFromFile("sprites/head.png")) { MessageBox(NULL, "Error loading headsprite", "Error loading sprite part: head, located in 'sprites/head.png'.", MB_OK); } sf::Sprite Sprite; Sprite.SetColor(sf::Color(0, 255, 255, 128)); Sprite.SetX(200.f); Sprite.SetY(100.f); Sprite.SetPosition(200.f, 100.f); Sprite.SetRotation(30.f); Sprite.SetCenter(0, 0); Sprite.SetScaleX(2.f); Sprite.SetScaleY(0.5f); Sprite.SetScale(2.f, 0.5f); Sprite.SetBlendMode(sf::Blend::Multiply); Sprite.Move(10, 5); Sprite.Rotate(90); Sprite.Scale(1.5f, 1.5f); Sprite.SetImage(img); while (App.IsOpened()) { sf::Event Event; while (App.GetEvent(Event)) { if (Event.Type == sf::Event::Closed) App.Close(); if ((Event.Type == sf::Event::KeyPressed) && (Event.Key.Code == sf::Key::Escape)) App.Close(); } App.Draw(Sprite); App.Display(); } return EXIT_SUCCESS;}
Sprite.SetBlendMode(sf::Blend::Multiply);
And my code:Code: [Select] Sprite.SetColor(sf::Color(0, 255, 255, 128)); Sprite.SetX(200.f); Sprite.SetY(100.f); Sprite.SetPosition(200.f, 100.f); Sprite.SetRotation(30.f); Sprite.SetCenter(0, 0); Sprite.SetScaleX(2.f); Sprite.SetScaleY(0.5f); Sprite.SetScale(2.f, 0.5f); Sprite.SetBlendMode(sf::Blend::Multiply); Sprite.Move(10, 5); Sprite.Rotate(90); Sprite.Scale(1.5f, 1.5f); Sprite.SetImage(img);
Sprite.SetColor(sf::Color(0, 255, 255, 128)); Sprite.SetX(200.f); Sprite.SetY(100.f); Sprite.SetPosition(200.f, 100.f); Sprite.SetRotation(30.f); Sprite.SetCenter(0, 0); Sprite.SetScaleX(2.f); Sprite.SetScaleY(0.5f); Sprite.SetScale(2.f, 0.5f); Sprite.SetBlendMode(sf::Blend::Multiply); Sprite.Move(10, 5); Sprite.Rotate(90); Sprite.Scale(1.5f, 1.5f); Sprite.SetImage(img);
Sprite.SetColor(sf::Color(0, 255, 255, 128)); Sprite.SetPosition(210.f, 105.f); Sprite.Rotate(120); Sprite.SetScale(3.0f, 0.75f); Sprite.SetCenter(0, 0); // Be careful, rotation and scale will be based on (0,0) center when drawing the sprite Sprite.SetBlendMode(sf::Blend::Multiply); Sprite.SetImage(img);