Added the trunk/branches/tags directories at repository root, and moved previous root into trunk/
git-svn-id: https://sfml.svn.sourceforge.net/svnroot/sfml/trunk@1002 4e206d99-4929-0410-ac5d-dfc041789085
This commit is contained in:
commit
2f524481c1
974 changed files with 295448 additions and 0 deletions
54
build/xcode/templates/SFML Window-based Application/main.cpp
Normal file
54
build/xcode/templates/SFML Window-based Application/main.cpp
Normal file
|
@ -0,0 +1,54 @@
|
|||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/Window.hpp>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Entry point of application
|
||||
///
|
||||
/// \return Application exit code
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
int main()
|
||||
{
|
||||
// Create the main window
|
||||
sf::Window App(sf::VideoMode(640, 480, 32), "SFML Window");
|
||||
|
||||
// Start game loop
|
||||
while (App.IsOpened())
|
||||
{
|
||||
// Process events
|
||||
sf::Event Event;
|
||||
while (App.GetEvent(Event))
|
||||
{
|
||||
// Close window : exit
|
||||
if (Event.Type == sf::Event::Closed)
|
||||
App.Close();
|
||||
|
||||
// Escape key : exit
|
||||
if ((Event.Type == sf::Event::KeyPressed) && (Event.Key.Code == sf::Key::Escape))
|
||||
App.Close();
|
||||
|
||||
// Resize event : adjust viewport
|
||||
if (Event.Type == sf::Event::Resized)
|
||||
glViewport(0, 0, Event.Size.Width, Event.Size.Height);
|
||||
}
|
||||
|
||||
// Set the active window before using OpenGL commands
|
||||
// It's useless here because active window is always the same,
|
||||
// but don't forget it if you use multiple windows or controls
|
||||
App.SetActive();
|
||||
|
||||
// Clear color buffer
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
|
||||
// Your drawing here...
|
||||
|
||||
// Finally, display rendered frame on screen
|
||||
App.Display();
|
||||
}
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue