merge: merge changes from upstream master
This commit is contained in:
+23
-14
@@ -20,6 +20,7 @@
|
||||
#else // IF Debug
|
||||
|
||||
#include <stdio.h>
|
||||
#include <debug.h>
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
#include <fstream>
|
||||
@@ -48,9 +49,7 @@ class TyraDebug {
|
||||
(void)expander{0, (void(ss << std::forward<Args>(args)), 0)...};
|
||||
|
||||
if (Tyra::Info::writeLogsToFile) {
|
||||
auto* logFile = getLogFile();
|
||||
*logFile << ss.str();
|
||||
logFile->flush();
|
||||
writeInLogFile(&ss);
|
||||
} else {
|
||||
printf("%s", ss.str().c_str());
|
||||
}
|
||||
@@ -65,9 +64,7 @@ class TyraDebug {
|
||||
ss1 << "|\n";
|
||||
|
||||
if (Tyra::Info::writeLogsToFile) {
|
||||
auto* logFile = getLogFile();
|
||||
*logFile << ss1.str();
|
||||
logFile->flush();
|
||||
writeInLogFile(&ss1);
|
||||
} else {
|
||||
printf("%s", ss1.str().c_str());
|
||||
}
|
||||
@@ -80,20 +77,22 @@ class TyraDebug {
|
||||
ss2 << "====================================\n\n";
|
||||
|
||||
if (Tyra::Info::writeLogsToFile) {
|
||||
auto* logFile = getLogFile();
|
||||
*logFile << ss2.str();
|
||||
logFile->flush();
|
||||
writeInLogFile(&ss2);
|
||||
} else {
|
||||
printf("%s", ss2.str().c_str());
|
||||
}
|
||||
|
||||
init_scr();
|
||||
for (;;) {
|
||||
scr_setXY(20, 10);
|
||||
scr_printf(ss1.str().c_str());
|
||||
writeAssertLinesInScreen(args...);
|
||||
scr_printf(ss2.str().c_str());
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
static std::unique_ptr<std::ofstream> logFile;
|
||||
static std::ofstream* getLogFile();
|
||||
static void writeInLogFile(std::stringstream* ss);
|
||||
|
||||
template <typename Arg, typename... Args>
|
||||
static void writeAssertLines(Arg&& arg, Args&&... args) {
|
||||
@@ -105,13 +104,23 @@ class TyraDebug {
|
||||
0, (void(ss << "| " << std::forward<Args>(args) << "\n"), 0)...};
|
||||
|
||||
if (Tyra::Info::writeLogsToFile) {
|
||||
auto* logfile = getLogFile();
|
||||
*logfile << ss.str();
|
||||
logFile->flush();
|
||||
writeInLogFile(&ss);
|
||||
} else {
|
||||
printf("%s", ss.str().c_str());
|
||||
}
|
||||
}
|
||||
|
||||
template <typename Arg, typename... Args>
|
||||
static void writeAssertLinesInScreen(Arg&& arg, Args&&... args) {
|
||||
std::stringstream ss;
|
||||
|
||||
ss << "| " << std::forward<Arg>(arg) << "\n";
|
||||
using expander = int[];
|
||||
(void)expander{
|
||||
0, (void(ss << "| " << std::forward<Args>(args) << "\n"), 0)...};
|
||||
|
||||
scr_printf(ss.str().c_str());
|
||||
}
|
||||
};
|
||||
|
||||
#endif // NDEBUG
|
||||
@@ -21,7 +21,7 @@ class Version {
|
||||
~Version() {}
|
||||
|
||||
static const u8 major = 2;
|
||||
static const u8 minor = 1;
|
||||
static const u8 minor = 2;
|
||||
static const u8 patch = 0;
|
||||
|
||||
static std::string toString() {
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include "debug/debug.hpp"
|
||||
#include "renderer/core/2d/sprite/sprite.hpp"
|
||||
#include "renderer/core/texture/renderer_core_texture_buffers.hpp"
|
||||
#include "renderer/3d/pipeline/shared/pipeline_texture_mapping_type.hpp"
|
||||
#include "renderer/core/texture/models/texture.hpp"
|
||||
#include "renderer/renderer_settings.hpp"
|
||||
#include <packet2_utils.h>
|
||||
@@ -30,6 +31,9 @@ class RendererCore2D {
|
||||
void render(const Sprite& sprite,
|
||||
const RendererCoreTextureBuffers& texBuffers, Texture* texture);
|
||||
|
||||
void setTextureMappingType(
|
||||
const PipelineTextureMappingType textureMappingType);
|
||||
|
||||
private:
|
||||
void setPrim();
|
||||
void setLod();
|
||||
|
||||
@@ -24,7 +24,7 @@ class Sprite {
|
||||
~Sprite();
|
||||
|
||||
u32 id;
|
||||
Vec2 position, size;
|
||||
Vec2 position, size, offset;
|
||||
float scale;
|
||||
Color color;
|
||||
SpriteMode mode;
|
||||
|
||||
@@ -10,16 +10,11 @@
|
||||
|
||||
#include "debug/debug.hpp"
|
||||
|
||||
std::unique_ptr<std::ofstream> TyraDebug::logFile;
|
||||
|
||||
std::ofstream* TyraDebug::getLogFile() {
|
||||
if (logFile) {
|
||||
return logFile.get();
|
||||
} else {
|
||||
logFile = std::make_unique<std::ofstream>();
|
||||
logFile->open(Tyra::FileUtils::fromCwd("log.txt"),
|
||||
std::ofstream::out | std::ofstream::app);
|
||||
return logFile.get();
|
||||
}
|
||||
|
||||
} // namespace Tyra
|
||||
void TyraDebug::writeInLogFile(std::stringstream* ss) {
|
||||
std::ofstream logFile;
|
||||
logFile.open(Tyra::FileUtils::fromCwd("log.txt"),
|
||||
std::ofstream::out | std::ofstream::app);
|
||||
logFile << ss->str();
|
||||
logFile.flush();
|
||||
// logFile.close();
|
||||
}
|
||||
|
||||
@@ -20,36 +20,20 @@
|
||||
#include "file/file_utils.hpp"
|
||||
|
||||
// external IRX modules
|
||||
#define EXTERN_IRX(_irx) \
|
||||
extern u8 _irx[]; \
|
||||
extern int size_##_irx
|
||||
|
||||
extern u8 sio2man_irx[];
|
||||
extern int size_sio2man_irx;
|
||||
|
||||
extern u8 padman_irx[];
|
||||
extern int size_padman_irx;
|
||||
|
||||
extern u8 audsrv_irx[];
|
||||
extern int size_audsrv_irx;
|
||||
|
||||
extern u8 libsd_irx[];
|
||||
extern int size_libsd_irx;
|
||||
|
||||
extern u8 fileXio_irx[];
|
||||
extern int size_fileXio_irx;
|
||||
|
||||
extern u8 iomanX_irx[];
|
||||
extern int size_iomanX_irx;
|
||||
|
||||
extern u8 bdm_irx[];
|
||||
extern int size_bdm_irx;
|
||||
|
||||
extern u8 bdmfs_fatfs_irx[];
|
||||
extern int size_bdmfs_fatfs_irx;
|
||||
|
||||
extern u8 usbd_irx[];
|
||||
extern int size_usbd_irx;
|
||||
|
||||
extern u8 usbmass_bd_irx[];
|
||||
extern int size_usbmass_bd_irx;
|
||||
EXTERN_IRX(sio2man_irx);
|
||||
EXTERN_IRX(padman_irx);
|
||||
EXTERN_IRX(audsrv_irx);
|
||||
EXTERN_IRX(libsd_irx);
|
||||
EXTERN_IRX(fileXio_irx);
|
||||
EXTERN_IRX(iomanX_irx);
|
||||
EXTERN_IRX(bdm_irx);
|
||||
EXTERN_IRX(bdmfs_fatfs_irx);
|
||||
EXTERN_IRX(usbd_irx);
|
||||
EXTERN_IRX(usbmass_bd_irx);
|
||||
|
||||
namespace Tyra {
|
||||
|
||||
|
||||
@@ -84,10 +84,12 @@ void RendererCore2D::render(const Sprite& sprite,
|
||||
else if (sizeY > sizeX)
|
||||
texS = texMax / (sizeY / sizeX);
|
||||
|
||||
rect->t0.s = sprite.flipHorizontal ? texS : 0.0F;
|
||||
rect->t0.t = sprite.flipVertical ? texT : 0.0F;
|
||||
rect->t1.s = sprite.flipHorizontal ? 0.0F : texS;
|
||||
rect->t1.t = sprite.flipVertical ? 0.0F : texT;
|
||||
rect->t0.s =
|
||||
sprite.flipHorizontal ? (texS + sprite.offset.x) : sprite.offset.x;
|
||||
rect->t0.t = sprite.flipVertical ? (texT + sprite.offset.y) : sprite.offset.y;
|
||||
rect->t1.s =
|
||||
sprite.flipHorizontal ? sprite.offset.x : (texS + sprite.offset.x);
|
||||
rect->t1.t = sprite.flipVertical ? sprite.offset.y : (texT + sprite.offset.y);
|
||||
|
||||
rect->color.r = sprite.color.r;
|
||||
rect->color.g = sprite.color.g;
|
||||
@@ -131,4 +133,10 @@ void RendererCore2D::render(const Sprite& sprite,
|
||||
context = !context;
|
||||
}
|
||||
|
||||
void RendererCore2D::setTextureMappingType(
|
||||
const PipelineTextureMappingType textureMappingType) {
|
||||
lod.mag_filter = textureMappingType;
|
||||
lod.min_filter = textureMappingType;
|
||||
}
|
||||
|
||||
} // namespace Tyra
|
||||
|
||||
@@ -18,6 +18,7 @@ Sprite::Sprite() {
|
||||
flipVertical = false;
|
||||
size.set(32.0F, 32.0F);
|
||||
position.set(100.0F, 100.0F);
|
||||
offset.set(0.0F, 0.0F);
|
||||
scale = 1.0F;
|
||||
mode = MODE_REPEAT;
|
||||
setDefaultColor();
|
||||
|
||||
Reference in New Issue
Block a user