diff --git a/src/Apps/Demo/main.cpp b/src/Apps/Demo/main.cpp index 0c781ab..818fb0b 100644 --- a/src/Apps/Demo/main.cpp +++ b/src/Apps/Demo/main.cpp @@ -1,15 +1,13 @@ -#include +#include #include #include +#include #include #include -#include #include #include -#include + #include "Color.h" -#include -#include "Timer.h" #include "DrawContext.h" #include "Image.h" #include "TimeSource.h" @@ -23,15 +21,10 @@ #include "SDLDisplay.h" #endif -const int32_t width = 1024; -const int32_t height = 600; - -static void PrintUsage(const char *program_name) +namespace { - std::cout - << "Usage: " << program_name << " [--fps 30|45|60]\n" - << " " << program_name << " [--fps=30|45|60]\n"; -} + const int32_t DemoWidth = 1024; + const int32_t DemoHeight = 600; struct ProgramOptions { @@ -45,6 +38,13 @@ static void PrintUsage(const char *program_name) } }; + static void PrintUsage(const char* program_name) + { + std::cout + << "Usage: " << program_name << " [--fps 30|45|60]\n" + << " " << program_name << " [--fps=30|45|60]\n"; + } + static Platform::IDisplay* CreateDisplay() { #ifdef USE_FRAMEBUFFER @@ -54,13 +54,6 @@ static void PrintUsage(const char *program_name) #endif } - static void PrintUsage(const char* program_name) - { - std::cout - << "Usage: " << program_name << " [--fps 30|45|60]\n" - << " " << program_name << " [--fps=30|45|60]\n"; - } - static ProgramOptions ParseProgramOptions(int argc, char* argv[]) { ProgramOptions options; diff --git a/src/Apps/Game/Main.cpp b/src/Apps/Game/Main.cpp index 9bb2ff9..511c7f2 100644 --- a/src/Apps/Game/Main.cpp +++ b/src/Apps/Game/Main.cpp @@ -205,6 +205,8 @@ namespace int main(int argc, char* argv[]) { + std::cout << "[INFO] Start make tom game." << std::endl; + const ProgramOptions options = ParseProgramOptions(argc, argv); if (options.show_help) { @@ -257,7 +259,7 @@ int main(int argc, char* argv[]) Core::Timer timer(options.target_fps); Platform::SteadyTimeSource time_source; - std::cout << "Tom game started. Target FPS: " << timer.target_fps() << std::endl; + std::cout << "[INFO] Tom game started. Target FPS: " << timer.target_fps() << std::endl; bool is_running = true; uint32_t animation_time_ms = 0; diff --git a/src/Core/Math/Vector2.h b/src/Core/Math/Vector2.h index 69c4b56..ff43622 100644 --- a/src/Core/Math/Vector2.h +++ b/src/Core/Math/Vector2.h @@ -35,7 +35,11 @@ namespace Math Vector2() : x(0), y(0) {} Vector2(float x, float y) : x(x), y(y) {} - Vector2(const Vector2Int& other) :x(other.x), y(other.y) {} + Vector2(const Vector2Int& other) + : x(static_cast(other.x)), + y(static_cast(other.y)) + { + } /// /// 交换当前 Vector2 对象与另一个 Vector2 对象的 x 和 y 的值