播放逻辑暂存
This commit is contained in:
70
main.cc
70
main.cc
@@ -1,47 +1,47 @@
|
||||
#include <SFML/Graphics/RenderWindow.hpp>
|
||||
#include <cstdio>
|
||||
#include <SFML/System.hpp>
|
||||
#include <SFML/Graphics.hpp>
|
||||
#include <SFML/Window.hpp>
|
||||
#include <spdlog/spdlog.h>
|
||||
#include "UtilTool.h"
|
||||
#include "mediaService.h"
|
||||
#include <SFML/Graphics.hpp>
|
||||
#include <SFML/Graphics/RenderWindow.hpp>
|
||||
#include <SFML/System.hpp>
|
||||
#include <SFML/Window.hpp>
|
||||
#include <cstdio>
|
||||
#include <spdlog/spdlog.h>
|
||||
|
||||
#define DEBUG
|
||||
#define DEBUG
|
||||
|
||||
constexpr int CLIENT_WIDTH = 800;
|
||||
constexpr int CLIENT_HEIGHT = 600;
|
||||
|
||||
|
||||
int main(int argc, char** argv){
|
||||
spdlog::info("Current WorkDir Is: {}",argv[0]);
|
||||
int main(int argc, char **argv) {
|
||||
spdlog::info("Current WorkDir Is: {}", argv[0]);
|
||||
#ifdef DEBUG
|
||||
argv[1] = R"(../img/ocean.mp4)";
|
||||
argv[1] = R"(../img/ocean.mp4)";
|
||||
#else
|
||||
if(argc != 2){
|
||||
spdlog::error("Usage: mp filename ");
|
||||
return 0;
|
||||
}
|
||||
if (argc != 2) {
|
||||
spdlog::error("Usage: mp filename ");
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
spdlog::info("filename: {}", argv[1]);
|
||||
MediaService mediaService(argv[1], CLIENT_WIDTH, CLIENT_HEIGHT);
|
||||
std::shared_ptr<sf::RenderWindow> window = std::make_shared<sf::RenderWindow>(sf::VideoMode(CLIENT_WIDTH, CLIENT_HEIGHT), "mp");
|
||||
mediaService.SetWindow(window);
|
||||
bool running = true;
|
||||
spdlog::info("filename: {}", argv[1]);
|
||||
std::shared_ptr<sf::RenderWindow> window =
|
||||
std::make_shared<sf::RenderWindow>(
|
||||
sf::VideoMode(CLIENT_WIDTH, CLIENT_HEIGHT), "mp");
|
||||
MediaService mediaService(window, argv[1], CLIENT_WIDTH, CLIENT_HEIGHT);
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
mediaService.Play();
|
||||
}
|
||||
return 0;
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
mediaService.Play();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user