Created
April 20, 2015 08:03
-
-
Save michaelgautier/58a573ffe5748afa05cb to your computer and use it in GitHub Desktop.
Building C++ Code with SFML, Top-level Program Implementation for Wave 1.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*Copyright 2015 Michael Gautier, Licensed under the Apache License, Version 2.0 (the "License"); | |
you may not use this file except in compliance with the License. | |
You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 | |
Software distributed under the License is distributed on an "AS IS" BASIS, | |
NO WARRANTIES OR CONDITIONS OF ANY KIND, explicit or implicit. | |
See the License for details on permissions and limitations.*/ | |
/* | |
Discussed in a WordPress Post: Exploring SFML Graphics in C++ | |
https://gautiertalkstechnology.wordpress.com/2014/08/16/exploring-sfml-graphics-in-c-refactoring-wave-1/ | |
Full, version 1 tree: | |
https://github.com/michaelgautier/codeexpo/tree/master/building_cpp_with_sfml_wave_01 | |
*/ | |
#include "program.h" | |
#include "visualcommon.h" | |
#include "windowcommonimpl.h" | |
using namespace Gautier::SFMLApp; | |
void Program::Execute() | |
{ | |
WindowCommonImpl WindowTools; | |
SFMLVideoMode ProgramWindowVideoMode; | |
const AreaSize WindowAreaSize(800, 600); | |
ProgramWindowVideoMode = WindowTools.CreateCoreInterationVisualMode(ProgramWindowVideoMode, WindowAreaSize); | |
SFMLWindow ProgramWindow(ProgramWindowVideoMode, "Program Window"); | |
_WindowEventController.CollectNextEvent(ProgramWindow); | |
bool EventCollectionIsActive = _WindowEventController.GetEventCollectionIsActive(); | |
while(EventCollectionIsActive) | |
{ | |
_WindowEventController.CollectNextEvent(ProgramWindow); | |
WindowEventModel EventModel = _WindowEventController.GetEventModel(); | |
WindowTools.ProcessEvent(EventModel, ProgramWindow); | |
EventCollectionIsActive = _WindowEventController.GetEventCollectionIsActive(); | |
if(EventCollectionIsActive) | |
{ | |
Draw(ProgramWindow); | |
} | |
else | |
{ | |
break; | |
} | |
} | |
} | |
void Program::Draw(SFMLWindow& programWindow) | |
{ | |
programWindow.clear(); | |
//programWindow.draw(); | |
programWindow.display(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment