add events
This commit is contained in:
parent
4695644204
commit
a134f76396
2
Makefile
2
Makefile
@ -7,7 +7,7 @@ LD := $(PREFIX)-ld
|
||||
CPPFLAGS := -I$(SFML_DIR)/include
|
||||
LDFLAGS := -L$(SFML_DIR)/lib -lsfml-system -lsfml-window -static-libstdc++ -static-libgcc
|
||||
|
||||
all: clock window
|
||||
all: clock window events
|
||||
|
||||
%: %.cpp
|
||||
$(CXX) -o $@ $(CPPFLAGS) $^ $(LDFLAGS)
|
||||
|
25
events.cpp
Executable file
25
events.cpp
Executable file
@ -0,0 +1,25 @@
|
||||
|
||||
#include <SFML/Window.hpp>
|
||||
|
||||
int main()
|
||||
{
|
||||
sf::Window App(sf::VideoMode(800, 600, 32), "SFML Window");
|
||||
|
||||
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.Display();
|
||||
}
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user