cmake添加windows编译, main 输入文件名调整, constexpr使用string_view
This commit is contained in:
13
main.cc
13
main.cc
@@ -6,29 +6,30 @@
|
||||
#include <spdlog/spdlog.h>
|
||||
#include "UtilTool.h"
|
||||
#include "mediaService.h"
|
||||
#include "SFML/Window/VideoMode.hpp"
|
||||
|
||||
#define DEBUG
|
||||
|
||||
#define DEBUG
|
||||
using namespace std::string_view_literals;
|
||||
constexpr int CLIENT_WIDTH = 800;
|
||||
constexpr int CLIENT_HEIGHT = 600;
|
||||
|
||||
|
||||
int main(int argc, char** argv){
|
||||
auto filename = R"(C:/document/project/mp-sfml/img/ocean.mp4)"sv;
|
||||
spdlog::info("Current WorkDir Is: {}",argv[0]);
|
||||
#ifdef DEBUG
|
||||
argv[1] = R"(../img/ocean.mp4)";
|
||||
#else
|
||||
filename = argv[1];
|
||||
if(argc != 2){
|
||||
spdlog::error("Usage: mp filename ");
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
spdlog::info("filename: {}", argv[1]);
|
||||
MediaService mediaService(argv[1], CLIENT_WIDTH, CLIENT_HEIGHT);
|
||||
spdlog::info("filename: {}", filename);
|
||||
MediaService mediaService(filename.data(), 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;
|
||||
|
||||
while(running){
|
||||
sf::Event event;
|
||||
while(window->pollEvent(event)){
|
||||
|
||||
Reference in New Issue
Block a user