mirror of
https://github.com/libSDL2pp/libSDL2pp.git
synced 2025-08-03 10:55:57 -04:00
Fix some type conversion warnings
This commit is contained in:
parent
206d430e25
commit
d29b7528a6
@ -231,11 +231,11 @@ Renderer& Renderer::DrawPoint(const Point& p) {
|
||||
|
||||
Renderer& Renderer::DrawPoints(const Point* points, int count) {
|
||||
std::vector<SDL_Point> sdl_points;
|
||||
sdl_points.reserve(count);
|
||||
sdl_points.reserve(static_cast<size_t>(count));
|
||||
for (const Point* p = points; p != points + count; ++p)
|
||||
sdl_points.emplace_back(*p);
|
||||
|
||||
if (SDL_RenderDrawPoints(renderer_, sdl_points.data(), sdl_points.size()) != 0)
|
||||
if (SDL_RenderDrawPoints(renderer_, sdl_points.data(), count) != 0)
|
||||
throw Exception("SDL_RenderDrawPoints");
|
||||
|
||||
return *this;
|
||||
@ -254,11 +254,11 @@ Renderer& Renderer::DrawLine(const Point& p1, const Point& p2) {
|
||||
|
||||
Renderer& Renderer::DrawLines(const Point* points, int count) {
|
||||
std::vector<SDL_Point> sdl_points;
|
||||
sdl_points.reserve(count);
|
||||
sdl_points.reserve(static_cast<size_t>(count));
|
||||
for (const Point* p = points; p != points + count; ++p)
|
||||
sdl_points.emplace_back(*p);
|
||||
|
||||
if (SDL_RenderDrawLines(renderer_, sdl_points.data(), sdl_points.size()) != 0)
|
||||
if (SDL_RenderDrawLines(renderer_, sdl_points.data(), count) != 0)
|
||||
throw Exception("SDL_RenderDrawLines");
|
||||
|
||||
return *this;
|
||||
@ -284,11 +284,11 @@ Renderer& Renderer::DrawRect(const Rect& r) {
|
||||
|
||||
Renderer& Renderer::DrawRects(const Rect* rects, int count) {
|
||||
std::vector<SDL_Rect> sdl_rects;
|
||||
sdl_rects.reserve(count);
|
||||
sdl_rects.reserve(static_cast<size_t>(count));
|
||||
for (const Rect* r = rects; r != rects + count; ++r)
|
||||
sdl_rects.emplace_back(*r);
|
||||
|
||||
if (SDL_RenderDrawRects(renderer_, sdl_rects.data(), sdl_rects.size()) != 0)
|
||||
if (SDL_RenderDrawRects(renderer_, sdl_rects.data(), count) != 0)
|
||||
throw Exception("SDL_RenderDrawRects");
|
||||
|
||||
return *this;
|
||||
@ -314,11 +314,11 @@ Renderer& Renderer::FillRect(const Rect& r) {
|
||||
|
||||
Renderer& Renderer::FillRects(const Rect* rects, int count) {
|
||||
std::vector<SDL_Rect> sdl_rects;
|
||||
sdl_rects.reserve(count);
|
||||
sdl_rects.reserve(static_cast<size_t>(count));
|
||||
for (const Rect* r = rects; r != rects + count; ++r)
|
||||
sdl_rects.emplace_back(*r);
|
||||
|
||||
if (SDL_RenderFillRects(renderer_, sdl_rects.data(), sdl_rects.size()) != 0)
|
||||
if (SDL_RenderFillRects(renderer_, sdl_rects.data(), count) != 0)
|
||||
throw Exception("SDL_RenderFillRects");
|
||||
|
||||
return *this;
|
||||
|
@ -192,11 +192,11 @@ Surface& Surface::FillRect(const Optional<Rect>& rect, Uint32 color) {
|
||||
|
||||
Surface& Surface::FillRects(const Rect* rects, int count, Uint32 color) {
|
||||
std::vector<SDL_Rect> sdl_rects;
|
||||
sdl_rects.reserve(count);
|
||||
sdl_rects.reserve(static_cast<size_t>(count));
|
||||
for (const Rect* r = rects; r != rects + count; ++r)
|
||||
sdl_rects.emplace_back(*r);
|
||||
|
||||
if (SDL_FillRects(surface_, sdl_rects.data(), sdl_rects.size(), color) != 0)
|
||||
if (SDL_FillRects(surface_, sdl_rects.data(), count, color) != 0)
|
||||
throw Exception("SDL_FillRects");
|
||||
return *this;
|
||||
}
|
||||
|
@ -61,10 +61,10 @@ static int Run() {
|
||||
render.Clear();
|
||||
|
||||
// Fill
|
||||
float dx = sin(SDL_GetTicks() / 5000.0f * pi) * 32.0f;
|
||||
float dy = cos(SDL_GetTicks() / 10000.0f * pi) * 32.0f;
|
||||
float dx = std::sin(SDL_GetTicks() / 5000.0f * pi) * 32.0f;
|
||||
float dy = std::cos(SDL_GetTicks() / 10000.0f * pi) * 32.0f;
|
||||
|
||||
render.FillCopy(sprite, NullOpt, Rect(32, 32, window.GetWidth() - 64, window.GetHeight() - 64), SDL2pp::Point(dx, dy), SDL_FLIP_HORIZONTAL);
|
||||
render.FillCopy(sprite, NullOpt, Rect(32, 32, window.GetWidth() - 64, window.GetHeight() - 64), SDL2pp::Point((int)dx, (int)dy), SDL_FLIP_HORIZONTAL);
|
||||
|
||||
render.Present();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user