fixed clang warnings

This commit is contained in:
Squishy Bloob 2024-04-01 00:19:57 +00:00
parent 147bd4a206
commit 51ebae5c04
8 changed files with 18 additions and 15 deletions

View File

@ -133,7 +133,7 @@ void image::draw_rot(image const* image, vec2i pos, recti src_rect, double rot)
}
for(int y = 0; y <= end.y - start.y; ++y) {
auto yf = static_cast<double>(y) / crop.size.y * 2 - 1;
//auto yf = static_cast<double>(y) / crop.size.y * 2 - 1;
for(int x = 0; x <= end.x - start.x; ++x) {
double xf, yf;
int nx, ny;

View File

@ -18,6 +18,8 @@ for(int y = 0; y < s.y; ++y) {\
color in_t, in_b, in_l, in_r, in_m;\
color in_tl, in_tr, in_bl, in_br;\
color out_tl, out_tr, out_bl, out_br;\
(void)in_t; (void)in_b; (void)in_l; (void)in_r; (void)in_m;\
(void)in_tl; (void)in_tr; (void)in_bl; (void)in_br;\
in_t = img->get_safe(vec2i(x, y - 1));\
in_b = img->get_safe(vec2i(x, y + 1));\
in_l = img->get_safe(vec2i(x - 1, y));\
@ -44,6 +46,8 @@ for(int y = 0; y < s.y; ++y) {\
color in_tl, in_tr, in_bl, in_br;\
color out_t, out_b, out_l, out_r, out_m;\
color out_tl, out_tr, out_bl, out_br;\
(void)in_t; (void)in_b; (void)in_l; (void)in_r; (void)in_m;\
(void)in_tl; (void)in_tr; (void)in_bl; (void)in_br;\
in_t = img->get_safe(vec2i(x, y - 1));\
in_b = img->get_safe(vec2i(x, y + 1));\
in_l = img->get_safe(vec2i(x - 1, y));\

View File

@ -8,7 +8,7 @@ font::font(resource_manager& rm, ini_category const* ini, std::string const& pat
throw std::runtime_error("font needs assets.ini");
if(ini->get<bool>("proportional")) {
auto image = rm.get<::image>(path);
auto x = 0;
//auto x = 0;
std::vector<int> slices;
for(int i = 0; i < image->size().x; ++i) {
if(image->get(vec2i(i, 0)) & 0xff000000)
@ -28,8 +28,6 @@ font::font(resource_manager& rm, ini_category const* ini, std::string const& pat
_glyphs.at(ch).draw(image, vec2i::zero, r);
}
} else {
int width = ini->get<int>("tile_width");
int height = ini->get<int>("tile_height");
auto ts = rm.get<tileset>(path);
_lineheight = ts->_tile_size.y;
for(int i = 0; i < 256; ++i) {

View File

@ -17,7 +17,7 @@ LRESULT WINAPI wnd_proc(HWND window, UINT msg, WPARAM w, LPARAM l) {
return ::DefWindowProc(window, msg, w, l);
}
game::game(int argc, char** argv) : _cursor(0), _argc(argc), _argv(argv), _rm(argc, argv) {
game::game(int argc, char** argv) : _cursor(0), _rm(argc, argv), _argc(argc), _argv(argv) {
std::cout << "a\n";
}
@ -36,7 +36,7 @@ void game::run() {
.lpszClassName = title.c_str(),
};
auto atom = RegisterClass(&wc);
RegisterClass(&wc);
auto window = CreateWindow(
wc.lpszClassName,
title.c_str(),
@ -196,7 +196,6 @@ void play_logo(HWND window, image const* logo, image const* logo_slime) {
screen.blend_to(0x0, 2.0 - (frames / 30.0));
if(frames < 30)
screen.clear(0);
auto p = screen.raw_pointer();
window_image.draw_upscaled(&screen, upscaler::scale3x);

View File

@ -23,24 +23,24 @@ image::image(resource_manager& rm, ini_category const* ini, std::string const& p
}
image::image(vec2i size) :
_alpha(true),
_borrowed_pointer(false),
_data(new color[size.size()]),
_bounds(vec2i::zero, size),
_alpha(true)
_bounds(vec2i::zero, size)
{}
image::image(vec2i size, color* data) :
_alpha(true),
_borrowed_pointer(true),
_data(data),
_bounds(vec2i::zero, size),
_alpha(true)
_bounds(vec2i::zero, size)
{}
image::image(image const& other) :
_alpha(other._alpha),
_borrowed_pointer(false),
_data(new color[other.size().size()]),
_bounds(other.bounds()),
_alpha(other._alpha)
_bounds(other.bounds())
{
std::memcpy(_data, other._data, size().size() * 4);
}

View File

@ -2,12 +2,13 @@
#include "util.h"
ini_category const ini_category::empty;
std::string empty_str("");
std::string const& ini_category::get_string(std::string const& entry) const {
if(_data.contains(entry))
return _data.at(entry);
return std::string("");
return empty_str;
}
ini::ini(resource_manager& rm, ini_category const* ini, std::string const& path, std::vector<uint8_t> data) {

View File

@ -1,3 +1,4 @@
#pragma clang system_header
/* stb_image - v2.29 - public domain image loader - http://nothings.org/stb
no warranty implied; use at your own risk

View File

@ -51,7 +51,7 @@ void my_game::render(image& target) {
//target.draw_rot(slime, vec2i(200, 200), time);
//target.draw(slime, vec2i(40, 40));
//target.draw(tileset[0xda], vec2i(320, 180) + pos, 0xff00ff);
auto str = "Can only be played if\nthere are no card in\nyour draw pile.\nDeal 50 damage to ALL\nenemies.";
//auto str = "Can only be played if\nthere are no card in\nyour draw pile.\nDeal 50 damage to ALL\nenemies.";
//target.draw(str, vec2i(100, 100) + pos, font, 0xffffff, 0);
target.draw(bg, vec2i::zero);
target.draw(std::format("FPS: {}", fps()), vec2i(10, 10), font1, 0xffffff, 0);