add events

This commit is contained in:
Josh Holtrop 2012-03-04 22:38:43 -05:00
parent 4695644204
commit a134f76396
2 changed files with 26 additions and 1 deletions

View File

@ -7,7 +7,7 @@ LD := $(PREFIX)-ld
CPPFLAGS := -I$(SFML_DIR)/include CPPFLAGS := -I$(SFML_DIR)/include
LDFLAGS := -L$(SFML_DIR)/lib -lsfml-system -lsfml-window -static-libstdc++ -static-libgcc LDFLAGS := -L$(SFML_DIR)/lib -lsfml-system -lsfml-window -static-libstdc++ -static-libgcc
all: clock window all: clock window events
%: %.cpp %: %.cpp
$(CXX) -o $@ $(CPPFLAGS) $^ $(LDFLAGS) $(CXX) -o $@ $(CPPFLAGS) $^ $(LDFLAGS)

25
events.cpp Executable file
View 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;
}