Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jul 24th, 2012  |  syntax: C++  |  size: 1.02 KB  |  hits: 12  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. // exemplo 2D.cpp : Defines the entry point for the console application.
  2. //
  3.  
  4. #include "stdafx.h"
  5. using namespace std;
  6. #include <SFML/Graphics.hpp>
  7. using namespace std;
  8. #include <vector>
  9.  
  10.  
  11. int main()
  12. {
  13.    
  14.         sf::RenderWindow window(sf::VideoMode(700, 700), "SFML works!");
  15.     sf::Text text("Ola MUNDO!");
  16.     text.setColor(sf::Color::Blue);
  17.         text.setPosition(150,100);
  18.  
  19.         sf::RectangleShape Shape(sf::Vector2f(40, 40));
  20.         Shape.setPosition(30,30);
  21.                 Shape.setFillColor(sf::Color::Yellow);
  22.                
  23.                
  24.                
  25.                 glMatrixMode(GL_PROJECTION);
  26.         glLoadIdentity();
  27.         glOrtho(0, window.getSize().x, 0, window.getSize().y, -1, 1);
  28.         glMatrixMode(GL_MODELVIEW);
  29.  
  30.  
  31.  
  32.  
  33.         while (window.isOpen())
  34.     {
  35.         sf::Event event;
  36.         while (window.pollEvent(event))
  37.         {
  38.             if (event.type == sf::Event::Closed)
  39.                 window.close();
  40.         }
  41.  
  42.         window.clear();
  43.         window.draw(text);
  44.                 window.draw(Shape);
  45.         window.display();
  46.         }
  47.  
  48.     return 0;
  49. }