Beispiel #1
0
int main(){
    process_proc_file();
    cout<<"Size of process list  "<<process_list.size()<<"\n";
    //cout<<(process_list[1].phases[1]).io_time<<endl;
    process_scheduler_file();
    //cout<<my_scheduler.levels[1].time_slice<<endl;
    for(int i =0;i<process_list.size();i++){
        Event *e = new Event();
        
        e->eventType = ADMISSION_EVENT;
      //  printf("Admission event type is % d type is %d\n ",ADMISSION_EVENT,e->eventType);
        e->time =process_list[i].admission; 
        Process *p1 = new Process(process_list[i]);
       // std::cout<<" Process with pid" << p1->getPid()<<"\n";
        e->p = p1;
        eventManager.addEvent(e);
    }
    sch.initialize(my_scheduler.levels[0].time_slice);
    cpuStopEvent = new Event();
    cpuStopEvent->time = -1;
    cpuStopEvent->p = NULL;
    cpuStopEvent->eventType= DEFAULT;
    
    eventManager.start();
}
Beispiel #2
0
int main()
{

	UserRegistry* pUserRegistry = new UserRegistry();
	MessageFactory* pMessageFactory = new MessageFactory(pUserRegistry);

	DeliveryController* pDeliveryController = new DeliveryController(pUserRegistry,pMessageFactory);

	MessageBuffer* pMessageBuffer = new MessageBuffer(pDeliveryController);

	ServerSideCallBack* pServerSideCallBack = new ServerSideCallBack(pMessageBuffer);
	EventManager* pEventManager = new EventManager();

	Server* pServer = pEventManager->CreateServer(8888, pServerSideCallBack);
	pEventManager->Run();

	delete pUserRegistry;
	delete pMessageFactory;
	delete pDeliveryController;
	delete pMessageBuffer;
	delete pServerSideCallBack;
	delete pEventManager;
	delete pServer;


	return 0;
}
Beispiel #3
0
/**
 * Executed during the binding phase.
 * Returns false if one of the following Events have not been found:
 * - /Control/NextStep
 * - /Control/NextStepCompleted
 * - /Control/ResetSimulation
 * - /Control/ResetSimulationFinalized
 * - /Control/ResetSimulationSettings
 *
 * @return true if successful, otherwise false.
 */
bool PhysicsManager::bind() {

	EventManager *em = Core::getInstance()->getEventManager();
	mNextStepEvent = em->getEvent(NerdConstants::EVENT_EXECUTION_NEXT_STEP, true);
	mCompletedNextStepEvent = em->getEvent(
		NerdConstants::EVENT_EXECUTION_STEP_COMPLETED, true);
	
	mCurrentStep = Core::getInstance()->getValueManager()->getIntValue(SimulationConstants::VALUE_EXECUTION_CURRENT_STEP);

	if(mNextStepEvent == 0
		|| mCompletedNextStepEvent == 0
		|| mResetEvent == 0
		|| mResetSettingsEvent == 0
		|| mResetSettingsTerminatedEvent == 0
		|| mResetFinalizedEvent == 0)
	{
		Core::log("PhysicsManager: Required Events could not be found.");
		return false;
	}
	else {
		mResetEvent->addEventListener(this);
		mNextStepEvent->addEventListener(this);
	}
	return true;
}
Beispiel #4
0
void EventManagerFixture:: Should_Queue_Event_Successfully_Given_Intiailized()
{
    IEvent* event = new Event(TEST_EVENT);

    EventManager eventManager;
    eventManager.QueueEvent(event);
}
Beispiel #5
0
bool SimulationLoop::init() {
	
	Core::getInstance()->registerThread(this);

	ValueManager *vm = Core::getInstance()->getValueManager();
	EventManager *eManager = Core::getInstance()->getEventManager();
	mNextStepEvent = eManager->createEvent(NerdConstants::EVENT_EXECUTION_NEXT_STEP,
					 "Update the System.");

	mCompletedStepEvent = eManager->createEvent(
		NerdConstants::EVENT_EXECUTION_STEP_COMPLETED,
		"Triggerd AFTER the physic was updated. Can be used by Sensor to calculate "
		"the new sensor value.");

	Event *preStepCompletedEvent = eManager->createEvent(
		NerdConstants::EVENT_EXECUTION_PRE_STEP_COMPLETED,
		"Triggered shortly before the StepCompleted Event is triggered.");
	mCompletedStepEvent->addUpstreamEvent(preStepCompletedEvent);
	
	mPauseSimulation = new BoolValue(false);
	if(!vm->addValue(SimulationConstants::VALUE_EXECUTION_PAUSE, mPauseSimulation)) {
		Core::log("SimulationLoop: Required value could not be created ["
				+ SimulationConstants::VALUE_EXECUTION_PAUSE + "]");
		return false;
	}

	return true;
}
Beispiel #6
0
    status Queue::unregisterEvent(DataEvent *event) noexcept {
        status result = INVALID_EVENT;

        if (event) {
            EventManager *em = this->eventManager();
            if (em != nullptr) {
                em->unregisterHandler(event);
                result = OK;

                // This will block any further callback to client code, which may still exist in the queue
                auto it = std::find(m_registeredEvents.begin(), m_registeredEvents.end(), event);
                if (it != m_registeredEvents.end()) {
                    if (event->__awaitingDispatch()) {
                        event->__setPendingRemoval(true);
                    } else {
                        m_registeredEvents.erase(it);
                        delete event;
                    }
                }
            } else {
                result = EVM_NOTRUNNING;
            }

        }
        return result;
    }
Beispiel #7
0
bool OnlinePlotter::bind() {
    bool ok = true;

    EventManager *em = Core::getInstance()->getEventManager();

    mStartEvent = em->registerForEvent(DynamicsPlotConstants::EVENT_CALCULATION_STARTED, this);
    mFinishEvent = em->registerForEvent(DynamicsPlotConstants::EVENT_CALCULATION_COMPLETED, this);

    mVM = Core::getInstance()->getValueManager();
    mActiveCalculatorValue = mVM->getStringValue(DynamicsPlotConstants::VALUE_PLOTTER_ACTIVE_PLOTTER);
    mPlotterProgramValue = mVM->getStringValue(DynamicsPlotConstants::VALUE_PLOTTER_OUTPUT_FORMAT);
    mPlotterOnlineValue =
        mVM->getBoolValue("/DynamicsPlotters/OfflinePlot");

    if(mStartEvent == 0
            || mFinishEvent == 0
            || mActiveCalculatorValue == 0
            || mPlotterProgramValue == 0
            || mPlotterOnlineValue == 0)
    {
        Core::log("OnlinePlotter: Could not find all required value objects!", true);
        ok = false;
    }

    return ok;
}
bool SeedUDPClientHandler::handleEventRegistrationCommand() {

	int id = 0;

	QString eventName = mReadDatagram.readNextString();

	if(eventName.compare("") != 0) {
		EventManager *em = Core::getInstance()->getEventManager();
		Event *event = em->registerForEvent(eventName, this);

		if(event != 0) {
			if(mRegisteredEvents.keys().contains(event)) {
				id = mRegisteredEvents.value(event);
			}
			else {
				id = mEventIdCounter++;
				mRegisteredEvents.insert(event, id);
			}
		}
	}

	mWriteDatagram.clear();
	mWriteDatagram.writeByte(SeedUDPCommunication::UDP_REGISTER_FOR_EVENT_ACK);
	mWriteDatagram.writeInt(id);
	sendDatagram();

	return true;
}
Beispiel #9
0
/**
 * Standard constructor.
 */
PhysicsManager::PhysicsManager() : mPhysicalSimulationAlgorithm(0), mCollisionManager(0),
		mSynchronizeObjectsWithPhysicalModel(true), mNextStepEvent(0),
		mCompletedNextStepEvent(0),
		mResetEvent(0), mResetFinalizedEvent(0), mResetSettingsEvent(0), 
		mResetSettingsTerminatedEvent(0), mInitialResetDone(false), mCurrentSimulationTime(0),
		mCurrentRealTime(0),  mCurrentStep(0), mResetDuration(0), mStepExecutionDuration(0),
		mPhysicalStepDuration(0), mSynchronizationDuration(0), mPostStepDuration(0),
		mCollisionHandlingDuration(0), mDisablePhysics(0), mResetMutex(QMutex::Recursive)
{
	EventManager *em = Core::getInstance()->getEventManager();

	//make sure these events are created right at the beginning (required for morphology evolution)
	em->getEvent(NerdConstants::EVENT_EXECUTION_RESET_SETTINGS, true);
	em->getEvent(NerdConstants::EVENT_EXECUTION_RESET_SETTINGS_COMPLETED, true);
	mPhysicsEnvironmentChangedEvent = em->createEvent(
					SimulationConstants::EVENT_PHYSICS_ENVIRONMENT_CHANGED);
	
	CommandLineArgument *switchXZArg = new CommandLineArgument("switchYZAxis", "switchYZAxis", "",
						"The y-axis now means height, so that the position of a robot in the plane is (x,z).",
						0, 0, true, false);
	bool switchXZ = switchXZArg->getNumberOfEntries() > 0 ? false : true;
	
	mSwitchYZAxes = new BoolValue(switchXZ);
	mSwitchYZAxes->setDescription("Changes the XYZ space to a XZY space, so that X and Y are in the plain.");
	Core::getInstance()->getValueManager()->addValue(SimulationConstants::VALUE_SWITCH_YZ_AXES, mSwitchYZAxes);
	
	mDisablePhysics = new BoolValue(false);
	mDisablePhysics->setDescription("If true, then the physical simulation is skipped and no update or resets of the physics takes place.");
	Core::getInstance()->getValueManager()->addValue(SimulationConstants::VALUE_DISABLE_PHYSICS, mDisablePhysics);
}
    void runTest() {
        m_strategy = new OpenConnectionStrategy(this);

        m_client_listener = new ClientTcpListener(this);
        m_server_listener = new ServerTcpListener(this);

        m_evmanager = new EventManager();
        m_client = new TcpConnection(IpAddress("127.0.0.1", 9999));
        m_listener = new TcpListener();

        m_listener->listen(9999);
        m_listener->setListener(this);

        m_client->setEventManager(m_evmanager);
        m_client->setListener(m_client_listener);
        m_client->open();

        m_evmanager->registerClient(m_listener);
        m_evmanager->registerClient(m_client);

        m_evmanager->execute();

        delete m_strategy;

        delete m_client_listener;
        delete m_server_listener;

        delete m_client;
        delete m_server;
        delete m_listener;
        delete m_evmanager;
    }
void GameView::run()
{
	float frameCounter = 0, frameSpeed = 500;
	Clock clock;
	
	bool updateFrame = true;
	while(_screen.isOpen())
	{
		EventManager eventManager;
		sf::Event event;
		while (_screen.pollEvent(event))
		{
			eventManager.processEvent(event);
		}
		updateScreen(eventManager);
		if(updateFrame)
			frameCounter += frameSpeed*clock.restart().asSeconds();
		else
			frameCounter = 0;
		
		frameCounter += frameSpeed*clock.restart().asSeconds();
		
		renderScreen();
	}
}
void GameView::updateScreen(const EventManager& eventManager)
{
	sf::Vector2f movement(0.f, 0.f);
	if(_moveUp)
	{
		movement.y =eventManager.getYPosition();
	}
	if(_moveDown)
	{
		movement.y =eventManager.getYPosition();
	}
	if(_moveLeft)
	{
		_playerID.setTexture(_playerTexture);
		_playerID.setRotation(0);
		movement.x =eventManager.getXPosition();
	}
	if(_moveRight)
	{
		_playerID.setRotation(180);
		movement.x =eventManager.getXPosition();
	}
	_playerID.move(movement);

}
/**
 * Called when the FitnessFunction is attached to the System. 
 */
void ScriptedFitnessFunction::attachToSystem() {
	TRACE("ScriptedFitnessFunction::attachToSystem");

	ControllerFitnessFunction::attachToSystem();

	if(mScriptFileNameArg != 0) {
		int numberOfEntries = mScriptFileNameArg->getNumberOfEntries();
		for(int i = 0; i < numberOfEntries; ++i) {
			QStringList args = mScriptFileNameArg->getEntryParameters(i);
			if(args.size() != 2) {
				continue;
			}
			if(args.at(0) == getName()) {
				mScriptFileName->set(args.at(1));

				if(!loadScriptCode(false)) {
					continue;
				}
				break;
			}
		}
	}

	mScriptFileName->addValueChangedListener(this);

	EventManager *em = Core::getInstance()->getEventManager();
	mSimEnvironmentChangedEvent = em->registerForEvent(
					EvolutionConstants::EVENT_PHYSICS_ENVIRONMENT_CHANGED,
					this);
}
bool NeuralNetworkManager::bind() {
	TRACE("NeuralNetworkManager::bind");

	bool ok = true;

	EventManager *em = Core::getInstance()->getEventManager();
	mStepStartedEvent = em->getEvent(NerdConstants::EVENT_EXECUTION_NEXT_STEP, true);
	mStepCompletedEvent = em->getEvent(
			NerdConstants::EVENT_EXECUTION_STEP_COMPLETED, true);
	mResetEvent = em->getEvent(NerdConstants::EVENT_EXECUTION_RESET, true);

	if(mStepStartedEvent == 0) {
		Core::log(QString("NeuralNetworkManager: Could not find Event [")
				.append(NerdConstants::EVENT_EXECUTION_NEXT_STEP)
				.append("]! [TERMINATING]"));
		ok = false;
	}
	else {
		mStepStartedEvent->addUpstreamEvent(mNetworkEvaluationStarted);
	}
	if(mStepCompletedEvent == 0 || !mStepCompletedEvent->addEventListener(this)) {
		Core::log(QString("NeuralNetworkManager: Could not find Event [")
				.append(NerdConstants::EVENT_EXECUTION_STEP_COMPLETED)
				.append("]! [TERMINATING]"));
		ok = false;
	}
	if(mResetEvent == 0 || !mResetEvent->addEventListener(this)) {
		Core::log(QString("NeuralNetworkManager: Could not find Event [")
				.append(NerdConstants::EVENT_EXECUTION_RESET)
				.append("]! [TERMINATING]"));
		ok = false;
	}

	return ok;
}
Beispiel #15
0
void VirtualKeyboard::show() {
	if (!_loaded) {
		warning("Virtual keyboard not loaded");
		return;
	} else {
		_kbdGUI->checkScreenChanged();
	}

	switchMode(_initialMode);
	_kbdGUI->run();

	if (_submitKeys) {
		EventManager *eventMan = _system->getEventManager();
		assert(eventMan);

		// push keydown & keyup events into the event manager
		Event evt;
		evt.synthetic = false;
		while (!_keyQueue.empty()) {
			evt.kbd = _keyQueue.pop();
			evt.type = EVENT_KEYDOWN;
			eventMan->pushEvent(evt);
			evt.type = EVENT_KEYUP;
			eventMan->pushEvent(evt);
		}
	} else {
		_keyQueue.clear();
	}
}
Beispiel #16
0
void
App::Run()
{
    //
    // Initialize the event handler
    //
    EventManager eventHandler;
    
    // Main game loop
    while(1)
    {
        //
        // Draw the next screen
        //
        
        DrawScreen();
        
        // Step the physics world
        PhysicsWorld::GetInstance()->Step(1.0 / 60.0);
        
        // Sleep
        SDL_Delay(1000.0 / 60.0);
        
        //
        // Handle events
        //
        while(eventHandler.IsEventWaiting())
            eventHandler.HandleEvent();
    }
    
    
}
Beispiel #17
0
StateGame::StateGame(StateManager * stateManager) :BaseState(stateManager), mWorld(sf::Vector2u(800,600), 16)
{
	EventManager* evManager = getStateManager()->getStateContext()->mEventManager;
	mWorld.setupEventHandling(StateType::Game, evManager);
	evManager->addCallback(StateType::Game, "KeyEscape", &StateGame::goToMainMenu, this);
	evManager->addCallback(StateType::Game, "KeyP", &StateGame::goToPause, this);
}
Beispiel #18
0
GuiGameState::GuiGameState(StateStack& stack, Context context)
:State(stack, context),
mHealthBar(sf::Color::Red),
mStaminaContainersBar(sf::Color::Yellow),
mWindow(*context.window),
mSpiritCoresCircle(sf::Color::White),
mRestoringSpiritBar(sf::Color::Yellow)
{

	mRestoringSpiritBar.setSize(sf::Vector2f(70.f, 10.f));

	EventManager* eventManager = EventManager::getInstance();
		

	eventManager->addListener(EventType::PlayerHPChanged, 
		EventCallBackFunc(Utility::convertPointerToAddress(&mHealthBar),
		std::bind(&MeterBar::reactToChangingValue, &mHealthBar, _1)));

	eventManager->addListener(EventType::SpiritCoreChanged,
		EventCallBackFunc(Utility::convertPointerToAddress(&mRestoringSpiritBar),
		std::bind(&MeterBar::reactToChangingValue, &mRestoringSpiritBar, _1)));

	eventManager->addListener(EventType::SpiritCoreChanged,
		EventCallBackFunc(Utility::convertPointerToAddress(&mSpiritCoresCircle),
		std::bind(&CircleBar::reactToChangingValue, &mSpiritCoresCircle, _1)));
	
	/*eventManager->addListener(EventType::PlayerStaminaChanged,
		EventCallBackFunc(Utility::convertPointerToAddress(&mStaminaContainersBar),
		std::bind(&ContainerBar::reactToChangingValue, &mStaminaContainersBar, _1)));*/
	
}
Beispiel #19
0
StateGame::StateGame(StateManager* stateManager, sf::Vector2u windSize, int blockSize):BaseState(stateManager),mWorld(windSize, blockSize)
{
	EventManager* evManager = getStateManager()->getStateContext()->mEventManager;
	mWorld.setupEventHandling(StateType::Game, evManager);
	evManager->addCallback(StateType::Game, "KeyEscape", &StateGame::goToMainMenu, this);
	evManager->addCallback(StateType::Game, "KeyP", &StateGame::goToPause, this);

}
void State_MainMenu::OnCreate(){
	GUI_Manager* gui = m_stateMgr->GetContext()->m_guiManager;
	gui->LoadInterface(StateType::MainMenu, "MainMenu.interface", "MainMenu");
	gui->GetInterface(StateType::MainMenu, "MainMenu")->SetPosition(sf::Vector2f(250.f, 168.f));
	EventManager* eMgr = m_stateMgr->GetContext()->m_eventManager;
	eMgr->AddCallback(StateType::MainMenu, "MainMenu_Play", &State_MainMenu::Play, this);
	eMgr->AddCallback(StateType::MainMenu, "MainMenu_Quit", &State_MainMenu::Quit, this);
}
Beispiel #21
0
Receiver::~Receiver()
{
    EventManager* pEventManager = EventManager::getInstance();
    assert(pEventManager);
    pEventManager->unregiste(*this, getReceiverId());

    clearAllEvents();//     release();
}
Beispiel #22
0
void Receiver::clearAllEvents()
{
    EventManager* pEventManager = EventManager::getInstance();
    assert(pEventManager);
    pEventManager->clearAllEvents(getReceiverId());

    release();
}
Beispiel #23
0
void
DlgLog::updateDlg() {
	EventManager *em = EVENTMANAGER;
	if (em) {
		em->removeListener("LOG", this);
		em->addListener("LOG", this);
	}
}
Beispiel #24
0
void EventManagerFixture:: Should_Still_Remove_Listener_Given_Non_Existant_Listener_And_Initialized()
{
    Mock_EventSubject* eventSubject = new Mock_EventSubject();

    EventManager eventManager;
    eventManager.RemoveEventListener(TEST_EVENT, eventSubject, &Mock_EventSubject::EventHandler);

    delete eventSubject;
}
Beispiel #25
0
bool SettingsLogger::bind() {
	bool ok = true;

	ValueManager *vm = Core::getInstance()->getValueManager();

	mWorkingDirectory = dynamic_cast<FileNameValue*>(vm->getValue(
				EvolutionConstants::VALUE_EVO_WORKING_DIRECTORY));
	//mWorkingDirectory->useAsFileName(true);
	mCurrentGeneration = vm->getIntValue(
				EvolutionConstants::VALUE_EVO_CURRENT_GENERATION_NUMBER);

	if(mWorkingDirectory == 0) {
		Core::log("SettingsLogger: Could not find the Value with the current "
				  "working directory.! [DISABLING FUNCTION] ");
	}
	if(mCurrentGeneration == 0) {
		Core::log("SettingsLogger: Could not find the Value with the current "
				  "working directory.! [DISABLING FUNCTION] ");
	}

	EventManager *em = Core::getInstance()->getEventManager();

	mEvolutionCompletedEvent = em->registerForEvent(
			EvolutionConstants::EVENT_EVO_EVOLUTION_ALGORITHM_COMPLETED, this);

	if(mEvolutionCompletedEvent == 0) {
		Core::log(QString("SettingsLogger: Could not find the Event [")
				.append(EvolutionConstants::EVENT_EVO_EVOLUTION_ALGORITHM_COMPLETED)
				.append("working directory.! [DISABLING FUNCTION] "));
	}

	if(mIncrementalLogFileEnabled && mWorkingDirectory != 0 && mCurrentGeneration != 0) {
		mIncrementalFileName = mWorkingDirectory->get().append("Evolution.log");
		Core::getInstance()->enforceDirectoryPath(mWorkingDirectory->get());
	}

	QList<QString> numberOfIndividualsNames = vm->getValueNamesMatchingPattern(".*/Evo/.*/PopulationSize");
	for(QListIterator<QString> i(numberOfIndividualsNames); i.hasNext();) {
		IntValue *value = vm->getIntValue(i.next());
		if(value != 0) {
			mNumberOfIndividualsValues.append(value);
		}
	}
	QList<QString> bestFitnessNames = vm->getValueNamesMatchingPattern(".*/Fitness/.*/Fitness/MaxFitness");
	for(QListIterator<QString> i(bestFitnessNames); i.hasNext();) {
		DoubleValue *value = vm->getDoubleValue(i.next());
		if(value != 0) {
			mBestFitnessValues.append(value);
		}
	}

	mNumberOfSteps = vm->getIntValue(EvolutionConstants::VALUE_EXECUTION_NUMBER_OF_STEPS);
	mNumberOfTrys = vm->getIntValue(EvolutionConstants::VALUE_EXECUTION_NUMBER_OF_TRIES);

	return ok;
}
bool NetworkDegreeOfFreedomCalculator::bind() {
	EventManager *em = Core::getInstance()->getEventManager();
	mUpdateDegreeOfFreedomInformationEvent = em->registerForEvent(
					NeuralNetworkConstants::EVENT_CONSTRAINTS_UPDATED, this);

	if(mUpdateDegreeOfFreedomInformationEvent == 0) {
		Core::log("NetworkDegreeOfFreedomCalculator: Could not register for calculate DOF events.");
	}
	return true;
}
Beispiel #27
0
void Sender::send(
    EReceiverId receiver,   // to whom
    const void* msgdata, unsigned short msgsize, // data & its size
    DWORD timeAfterNow, unsigned long loopTime, DWORD loopDelay) // delayTime & repeatCount
{
    EventManager* pEventManager = EventManager::getInstance();
    assert(pEventManager);
    pEventManager->send(
        m_SenderId, receiver, (const char*)msgdata,msgsize, timeAfterNow, loopTime, loopDelay);
}
main (int argc, char *argv[])
{
	if (argc !=3) {
		cout<<"No IP Address and Port Number - Exit";
		exit(1);
	}
	
	EventManager evtMgr;
	evtMgr.createClientSocketHandler(atoi(argv[2]), argv[1]);
	return 1;
}
Beispiel #29
0
 SignalEvent *Queue::registerEvent(const int signal, const std::function<void(SignalEvent *, int)> &callback) noexcept {
     auto result = m_registeredEvents.emplace(new SignalEvent(this, signal, callback));
     SignalEvent *event = reinterpret_cast<SignalEvent *>(*result.first);
     EventManager *em = this->eventManager();
     if (em != nullptr) {
         em->registerHandler(event);
     } else {
         throw fp::exception("Event manager not running");
     }
     return event;
 }
Beispiel #30
0
int main (int argc, char* argv[])
{
  System& sys = System::instance();
  sys.init(PROGRAM VERSION, 640, 480, false);
  
  EventManager evmgr;
  CameraTest controller;
    
  evmgr.addVideoListener (&sys);
  evmgr.addKeyListener (&controller);
  
  sys.getCamera()->move(PointF(0.0, 0.0, 3.0 ) );
  sys.getCamera()->moveForward(1.0 );

#if 0  	
  //Set a new projection matrix
  glMatrixMode(GL_PROJECTION);  
  glLoadIdentity();
  //Angle of view:40 degrees
  //Near clipping plane distance: 0.5
  //Far clipping plane distance: 20.0
  gluPerspective(40.0,(GLdouble)1/(GLdouble)1,0.5,20.0);

  glMatrixMode(GL_MODELVIEW);
  glViewport(0,0,1,1);  //Use the whole window for rendering
#endif
  
#if 1
  Mix_Music *musica;
  int canal;
  musica = Mix_LoadMUS("./sounds/beboy.mp3"); 
  if (musica == NULL) {
    /* horror terror pastel de costo! */
    printf("No pude cargar sonido: %s\n", Mix_GetError());
    exit(1);
  }
  canal = Mix_PlayMusic(musica, -1);
#endif
  
  //glTranslatef(0.0,-1 ,0.0);

  //sys.getRootNode().attachDrawable(new PlyMesh("models/beethoven.ply"));
  //sys.getRootNode().attachDrawable(new Sphere);
  
  
  while (evmgr.update ());

#if 1
  Mix_HaltMusic();
  Mix_FreeMusic(musica);
#endif
  
  sys.close ();
}