-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
64 lines (53 loc) · 1.67 KB
/
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#include <SFML/Graphics.hpp>
#include <SFML/Window.hpp>
#include <cstdlib>
#include <iostream>.
#define APP_WIDTH 800
#define APP_HEIGHT 600
using namespace sf;
using namespace std;
int main()
{
RenderWindow app(sf::VideoMode(APP_WIDTH, APP_HEIGHT), "Ninja - Initialisation");
app.setFramerateLimit(60);
RectangleShape bouton(Vector2f(100,100));
bouton.setPosition(Vector2f(200,200));
while (app.isOpen())
{
sf::Event event;
while (app.pollEvent(event))
{
if (event.type == sf::Event::Closed)
app.close();
}
if(Mouse::isButtonPressed(Mouse::Right))
{
if(Mouse::getPosition().x >= bouton.getPosition().x && Mouse::getPosition().x <= bouton.getPosition().x + bouton.getGlobalBounds().width && Mouse::getPosition().y >= bouton.getPosition().y && Mouse::getPosition().y <= bouton.getPosition().y + bouton.getGlobalBounds().height)
{
cout << "clic bouton" << endl;
}
}
app.clear();
app.draw(bouton);
app.display();
/*
archetypes = bdd();
while (continuer)
{
SDL_WaitEvent(&event);
switch(event.type)
{
case SDL_QUIT:
continuer = 0;
break;
case SDL_MOUSEMOTION:
positionZozor.x = event.motion.x;
positionZozor.y = event.motion.y;
break;
}
SDL_FillRect(ecran, NULL, SDL_MapRGB(ecran->format, 255, 255, 255));
SDL_BlitSurface(zozor, NULL, ecran, &positionZozor); /* On place Zozor à sa nouvelle position
SDL_Flip(ecran); */
}
return 0;
}