Seminar Computergrafik mit GameEngines: EventQueue (inspiriert von https://gameprogrammingpatterns.com/event-queue.html)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

45 lines
1.0 KiB

2 years ago
#include <QApplication>
#include <iostream>
#include "Queue.h"
#include "Audio.h"
#include "FileManager.h"
#include "Player.h"
2 years ago
#include "Window.h"
2 years ago
using std::cout, std::endl;
int main(int argc, char * argv[]){
QApplication app(argc, argv);
/*
for (int i = 0; i < 100'000; i++)
audioManager->playSound(1, i);
*/
/*
for (int i = 0; i < 10'000; i++){
FileManager->readFile("path" + std::to_string(i), [](const std::string& content){
2 years ago
std::cout << content << std::endl;
});
FileManager->writeFile("path" + std::to_string(i), "some content" + std::to_string(i));
2 years ago
}
*/
Window::InputQueue = new InputQueue;
Window::GameQueue = new GameQueue;
Window::AudioManager = new Audio;
Window::FileManager = new FileManager;
2 years ago
2 years ago
Window window;
2 years ago
window.show();
auto player = new Player;
Window::InputQueue->registerListener(player);
Window::GameQueue->registerListener(player);
Window::GameQueue->submitEvent<CoinCollectEvent>(new CoinCollectEvent);
Window::GameQueue->submitEvent<DamageEvent>(new DamageEvent);
2 years ago
return QApplication::exec();
}