forked from tsuki/openroller
Initial public source release
Split reusable rendering and format support into vectorail-core and vectorail-gc.
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
#pragma once
|
||||
|
||||
namespace openroller::psp {
|
||||
|
||||
constexpr int kScreenWidth = 480;
|
||||
constexpr int kScreenHeight = 272;
|
||||
constexpr int kLogicalWidth = 720;
|
||||
constexpr int kLogicalHeight = 1280;
|
||||
constexpr float kLogicalScale = 3.0f / 8.0f;
|
||||
constexpr int kScaledWidth = 270;
|
||||
constexpr int kBorder = (kScreenHeight - kScaledWidth) / 2;
|
||||
|
||||
enum class TateSide {
|
||||
Clockwise,
|
||||
CounterClockwise,
|
||||
};
|
||||
|
||||
struct Point {
|
||||
float x;
|
||||
float y;
|
||||
};
|
||||
|
||||
inline Point toScreen(float logicalX, float logicalY, TateSide side) {
|
||||
if (side == TateSide::Clockwise) {
|
||||
return {
|
||||
static_cast<float>(kScreenWidth) - logicalY * kLogicalScale,
|
||||
static_cast<float>(kBorder) + logicalX * kLogicalScale,
|
||||
};
|
||||
}
|
||||
return {
|
||||
logicalY * kLogicalScale,
|
||||
static_cast<float>(kBorder + kScaledWidth) - logicalX * kLogicalScale,
|
||||
};
|
||||
}
|
||||
|
||||
inline Point screenDirectionToLogical(float screenX, float screenY, TateSide side) {
|
||||
if (side == TateSide::Clockwise) {
|
||||
return {screenY, -screenX};
|
||||
}
|
||||
return {-screenY, screenX};
|
||||
}
|
||||
|
||||
} // namespace openroller::psp
|
||||
Reference in New Issue
Block a user