42 lines
930 B
C++
42 lines
930 B
C++
#include <cstdio>
|
|
#include <SFML/System.hpp>
|
|
#include <SFML/Graphics.hpp>
|
|
#include <SFML/Window.hpp>
|
|
#include <spdlog/spdlog.h>
|
|
#include "UtilTool.h"
|
|
#include "mediaService.h"
|
|
|
|
constexpr int CLIENT_WIDTH = 800;
|
|
constexpr int CLIENT_HEIGHT = 600;
|
|
|
|
|
|
int main(int argc, char** argv){
|
|
// spdlog::info("Current WorkDir Is: {}",argv[0]);
|
|
if(argc != 2){
|
|
spdlog::error("Usage: mp filename ");
|
|
return 0;
|
|
}
|
|
MediaService mediaService(argv[1], CLIENT_WIDTH, CLIENT_HEIGHT);
|
|
sf::RenderWindow window(sf::VideoMode(CLIENT_WIDTH, CLIENT_HEIGHT), "mp");
|
|
bool running = true;
|
|
|
|
while(running){
|
|
sf::Event event;
|
|
while(window.pollEvent(event)){
|
|
if(event.type == sf::Event::Closed){
|
|
running = false;
|
|
}
|
|
if(event.type == sf::Event::KeyPressed){
|
|
if(event.key.code == sf::Keyboard::Escape){
|
|
running = false;
|
|
}
|
|
}
|
|
|
|
}
|
|
window.clear();
|
|
window.draw(mediaService.GetSprite());
|
|
window.display();
|
|
}
|
|
return 0;
|
|
}
|