修复Demo的Main.cpp的问题,并修复int32-float的转换。
This commit is contained in:
parent
e150b153b9
commit
3f6e2bab2c
|
|
@ -1,15 +1,13 @@
|
|||
#include <algorithm>
|
||||
#include <array>
|
||||
#include <chrono>
|
||||
#include <cstdint>
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
#include <cstdio>
|
||||
#include <iostream>
|
||||
#include <thread>
|
||||
#include <chrono>
|
||||
|
||||
#include "Color.h"
|
||||
#include <cstdlib>
|
||||
#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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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<float>(other.x)),
|
||||
y(static_cast<float>(other.y))
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 交换当前 Vector2 对象与另一个 Vector2 对象的 x 和 y 的值
|
||||
|
|
|
|||
Loading…
Reference in New Issue