补充错误日志

This commit is contained in:
Nanako 2024-11-07 10:13:40 +08:00
parent 9dfc4f2fed
commit 755fe590a1
2 changed files with 6 additions and 5 deletions

View File

@ -87,9 +87,9 @@ void dx_window::begin_frame() {
context.draw_rounded_rectangle({ 100, 100 }, { 200, 200 }, { 1, 0, 0, 1 }, radius);
auto height = sin(get_total_time().count()) * 100;
context.draw_line({ 600, 600 - height }, { 700, 600 + height }, { 0, 0, 1, 1 }, 0.1);
context.draw_line({ 600, 600 - height }, { 700, 600 + height }, { 0, 0, 1, 1 }, 0.5);
context.draw_texture({0, 0}, test_texture->size(), test_texture);
if (test_texture) context.draw_texture({ 0, 0 }, test_texture->size(), test_texture);
context.flush();

View File

@ -5,6 +5,7 @@
#include "renderer_texture.h"
#include "core/window/renderer_window.h"
#define STB_IMAGE_IMPLEMENTATION
#define STBI_FAILURE_USERMSG
#include "stb_image.h"
#if DX_BACKEND
@ -24,12 +25,12 @@ void renderer::destroy_texture(renderer_texture* texture) { delete texture; }
renderer_texture* renderer::load_image(const std::string& file_path, texture_format in_format) {
int width, height, channels;
auto result = stbi_load(file_path.c_str(), &width, &height, &channels, 0);
const auto result = stbi_load(file_path.c_str(), &width, &height, &channels, 0);
if (!result) {
spdlog::critical("Failed to load image: {0}", file_path);
const char* reason = stbi_failure_reason();
spdlog::critical("加载图片 {0} 失败: {1}", file_path, reason);
return nullptr;
}
int target_channel_count = get_format_channel_count(in_format);
unsigned int row_pitch = 0;