forked from jaildesigner-jailgames/jaildoctors_dilemma
Corregits mil warnings de int a float
Corregit getDisplayInfo per al calcul del zoomMax
This commit is contained in:
@@ -251,6 +251,7 @@ struct OptionsVideo {
|
||||
bool keep_aspect; // Indica si se ha de mantener la relación de aspecto al poner el modo a pantalla completa
|
||||
Border border; // Borde de la pantalla
|
||||
std::string palette; // Paleta de colores a usar en el juego
|
||||
std::string info; // Información sobre el modo de vídeo
|
||||
|
||||
// Constructor por defecto
|
||||
OptionsVideo()
|
||||
|
||||
@@ -42,8 +42,7 @@ Screen::Screen(SDL_Window* window, SDL_Renderer* renderer)
|
||||
renderer_(renderer),
|
||||
palettes_(Asset::get()->getListByType(AssetType::PALETTE)) {
|
||||
// Inicializa variables
|
||||
auto display_mode = SDL_GetCurrentDisplayMode(0);
|
||||
info_resolution_ = std::to_string(display_mode->w) + " X " + std::to_string(display_mode->h) + " AT " + std::to_string(display_mode->refresh_rate) + " HZ";
|
||||
getDisplayInfo();
|
||||
|
||||
// Ajusta los tamaños
|
||||
game_surface_dstrect_ = {options.video.border.width, options.video.border.height, options.game.width, options.game.height};
|
||||
@@ -225,7 +224,6 @@ void Screen::adjustWindowSize() {
|
||||
window_width_ = options.game.width + (options.video.border.enabled ? options.video.border.width * 2 : 0);
|
||||
window_height_ = options.game.height + (options.video.border.enabled ? options.video.border.height * 2 : 0);
|
||||
|
||||
options.window.max_zoom = getMaxZoom();
|
||||
|
||||
// Establece el nuevo tamaño
|
||||
if (options.video.fullscreen == 0) {
|
||||
@@ -239,7 +237,7 @@ void Screen::adjustWindowSize() {
|
||||
const int NEW_POS_Y = old_pos_y + (old_height - (window_height_ * options.window.zoom)) / 2;
|
||||
|
||||
SDL_SetWindowSize(window_, window_width_ * options.window.zoom, window_height_ * options.window.zoom);
|
||||
SDL_SetWindowPosition(window_, std::max(NEW_POS_X, WINDOWS_DECORATIONS_), std::max(NEW_POS_Y, 0));
|
||||
SDL_SetWindowPosition(window_, std::max(NEW_POS_X, WINDOWS_DECORATIONS), std::max(NEW_POS_Y, 0));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -248,20 +246,6 @@ void Screen::adjustRenderLogicalSize() {
|
||||
SDL_SetRenderLogicalPresentation(renderer_, window_width_, window_height_, options.video.integer_scale ? SDL_LOGICAL_PRESENTATION_INTEGER_SCALE : SDL_LOGICAL_PRESENTATION_LETTERBOX);
|
||||
}
|
||||
|
||||
// Obtiene el tamaño máximo de zoom posible para la ventana
|
||||
int Screen::getMaxZoom() {
|
||||
// Obtiene información sobre la pantalla
|
||||
auto display_mode = SDL_GetCurrentDisplayMode(0);
|
||||
|
||||
// Calcula el máximo factor de zoom que se puede aplicar a la pantalla
|
||||
const int MAX_ZOOM = std::min(display_mode->w / window_width_, (display_mode->h - WINDOWS_DECORATIONS_) / window_height_);
|
||||
|
||||
// Normaliza los valores de zoom
|
||||
options.window.zoom = std::min(options.window.zoom, MAX_ZOOM);
|
||||
|
||||
return MAX_ZOOM;
|
||||
}
|
||||
|
||||
// Establece el renderizador para las surfaces
|
||||
void Screen::setRendererSurface(std::shared_ptr<Surface> surface) {
|
||||
(surface) ? renderer_surface_ = std::make_shared<std::shared_ptr<Surface>>(surface) : renderer_surface_ = std::make_shared<std::shared_ptr<Surface>>(game_surface_);
|
||||
@@ -457,10 +441,10 @@ void Screen::loadShaders() {
|
||||
VERTEX_FILE = "crtpi_vertex.glsl";
|
||||
data = loadData(Asset::get()->get(VERTEX_FILE));
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"Usando shaders OpenGL Desktop 3.3");
|
||||
"Usando shaders OpenGL Desktop 3.3");
|
||||
} else {
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"Usando shaders OpenGL ES 3.0 (Raspberry Pi)");
|
||||
"Usando shaders OpenGL ES 3.0 (Raspberry Pi)");
|
||||
}
|
||||
|
||||
if (!data.empty()) {
|
||||
@@ -498,6 +482,51 @@ void Screen::initShaders() {
|
||||
// En macOS, OpenGL está deprecated y rinde mal
|
||||
// TODO: Implementar backend de Metal para shaders en macOS
|
||||
SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"Shaders no disponibles en macOS (OpenGL deprecated). Usa Metal backend.");
|
||||
"Shaders no disponibles en macOS (OpenGL deprecated). Usa Metal backend.");
|
||||
#endif
|
||||
}
|
||||
|
||||
// Obtiene información sobre la pantalla
|
||||
void Screen::getDisplayInfo() {
|
||||
int i;
|
||||
int num_displays = 0;
|
||||
SDL_DisplayID *displays = SDL_GetDisplays(&num_displays);
|
||||
if (displays != nullptr) {
|
||||
for (i = 0; i < num_displays; ++i) {
|
||||
SDL_DisplayID instance_id = displays[i];
|
||||
const char *name = SDL_GetDisplayName(instance_id);
|
||||
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "Display %" SDL_PRIu32 ": %s", instance_id, (name != nullptr) ? name : "Unknown");
|
||||
}
|
||||
|
||||
const auto *dm = SDL_GetCurrentDisplayMode(displays[0]);
|
||||
|
||||
// Guarda información del monitor en display_monitor_
|
||||
const char *first_display_name = SDL_GetDisplayName(displays[0]);
|
||||
display_monitor_.name = (first_display_name != nullptr) ? first_display_name : "Unknown";
|
||||
display_monitor_.width = static_cast<int>(dm->w);
|
||||
display_monitor_.height = static_cast<int>(dm->h);
|
||||
display_monitor_.refresh_rate = static_cast<int>(dm->refresh_rate);
|
||||
|
||||
// Calcula el máximo factor de zoom que se puede aplicar a la pantalla
|
||||
options.window.max_zoom = std::min(dm->w / options.game.width, dm->h / options.game.height);
|
||||
options.window.zoom = std::min(options.window.zoom, options.window.max_zoom);
|
||||
|
||||
// Muestra información sobre el tamaño de la pantalla y de la ventana de juego
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "Current display mode: %dx%d @ %dHz", static_cast<int>(dm->w), static_cast<int>(dm->h), static_cast<int>(dm->refresh_rate));
|
||||
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "Window resolution: %dx%d x%d", static_cast<int>(options.game.width), static_cast<int>(options.game.height), options.window.zoom);
|
||||
|
||||
options.video.info = std::to_string(static_cast<int>(dm->w)) + "x" +
|
||||
std::to_string(static_cast<int>(dm->h)) + " @ " +
|
||||
std::to_string(static_cast<int>(dm->refresh_rate)) + " Hz";
|
||||
|
||||
// Calcula el máximo factor de zoom que se puede aplicar a la pantalla
|
||||
const int MAX_ZOOM = std::min(dm->w / options.game.width, (dm->h - WINDOWS_DECORATIONS) / options.game.height);
|
||||
|
||||
// Normaliza los valores de zoom
|
||||
options.window.zoom = std::min(options.window.zoom, MAX_ZOOM);
|
||||
|
||||
SDL_free(displays);
|
||||
}
|
||||
}
|
||||
@@ -22,9 +22,16 @@ enum class ScreenFilter : Uint32 {
|
||||
class Screen {
|
||||
private:
|
||||
// Constantes
|
||||
static constexpr int WINDOWS_DECORATIONS_ = 35;
|
||||
static constexpr int WINDOWS_DECORATIONS = 35; // Decoraciones de la ventana
|
||||
|
||||
|
||||
struct DisplayMonitor {
|
||||
std::string name;
|
||||
int width;
|
||||
int height;
|
||||
int refresh_rate;
|
||||
};
|
||||
|
||||
// Estructuras
|
||||
struct FPS {
|
||||
Uint32 ticks; // Tiempo en milisegundos desde que se comenzó a contar.
|
||||
int frameCount; // Número acumulado de frames en el intervalo.
|
||||
@@ -79,6 +86,7 @@ class Screen {
|
||||
std::string info_resolution_; // Texto con la informacion de la pantalla
|
||||
std::string vertex_shader_source_; // Almacena el vertex shader
|
||||
std::string fragment_shader_source_; // Almacena el fragment shader
|
||||
DisplayMonitor display_monitor_; // Informacion de la pantalla
|
||||
|
||||
#ifdef DEBUG
|
||||
bool show_debug_info_ = false; // Indica si ha de mostrar/ocultar la información de la pantalla
|
||||
@@ -119,6 +127,9 @@ class Screen {
|
||||
// Muestra información por pantalla
|
||||
void renderInfo();
|
||||
|
||||
// Obtiene información sobre la pantalla
|
||||
void getDisplayInfo();
|
||||
|
||||
// Constructor
|
||||
Screen(SDL_Window* window, SDL_Renderer* renderer);
|
||||
|
||||
|
||||
@@ -236,7 +236,7 @@ void Credits::render() {
|
||||
|
||||
// Dibuja la textura que cubre el texto
|
||||
const int offset = std::min(counter_ / 8, 192 / 2);
|
||||
SDL_FRect srcRect = {0, 0, 256, 192 - (offset * 2)};
|
||||
SDL_FRect srcRect = {0.0F, 0.0F, 256.0F, 192.0F - (offset * 2.0F)};
|
||||
cover_surface_->render(0, offset * 2, &srcRect);
|
||||
|
||||
// Dibuja el sprite con el brillo
|
||||
|
||||
@@ -152,8 +152,8 @@ void Ending::iniTexts() {
|
||||
for (const auto& txt : texts) {
|
||||
auto text = Resource::get()->getText("smb2");
|
||||
|
||||
const int WIDTH = text->lenght(txt.caption, 1) + 2 + 2;
|
||||
const int HEIGHT = text->getCharacterSize() + 2 + 2;
|
||||
const float WIDTH = text->lenght(txt.caption, 1) + 2 + 2;
|
||||
const float HEIGHT = text->getCharacterSize() + 2 + 2;
|
||||
auto text_color = static_cast<Uint8>(PaletteColor::WHITE);
|
||||
auto shadow_color = static_cast<Uint8>(PaletteColor::BLACK);
|
||||
|
||||
@@ -227,8 +227,8 @@ void Ending::iniPics() {
|
||||
// Crea la texture
|
||||
sp.image_surface = Resource::get()->getSurface(pic.caption);
|
||||
sp.image_surface->setTransparentColor();
|
||||
const int WIDTH = sp.image_surface->getWidth();
|
||||
const int HEIGHT = sp.image_surface->getHeight();
|
||||
const float WIDTH = sp.image_surface->getWidth();
|
||||
const float HEIGHT = sp.image_surface->getHeight();
|
||||
|
||||
// Crea el sprite
|
||||
sp.image_sprite = std::make_shared<SSprite>(sp.image_surface, 0, 0, WIDTH, HEIGHT);
|
||||
@@ -256,7 +256,7 @@ void Ending::iniPics() {
|
||||
}
|
||||
|
||||
// El resto se rellena de color sólido
|
||||
SDL_FRect rect = {0, 8, WIDTH, HEIGHT};
|
||||
SDL_FRect rect = {0.0F, 8.0F, WIDTH, HEIGHT};
|
||||
surface->fillRect(&rect, color);
|
||||
|
||||
// Crea el sprite
|
||||
@@ -464,8 +464,8 @@ void Ending::renderCoverTexture() {
|
||||
if (cover_counter_ > 0) {
|
||||
// Dibuja la textura que cubre el texto
|
||||
const int OFFSET = std::min(cover_counter_, 100);
|
||||
SDL_FRect srcRect = {0, 200 - (cover_counter_ * 2), 256, OFFSET * 2};
|
||||
SDL_FRect dstRect = {0, 0, 256, OFFSET * 2};
|
||||
SDL_FRect srcRect = {0.0F, 200.0F - (cover_counter_ * 2.0F), 256.0F, OFFSET * 2.0F};
|
||||
SDL_FRect dstRect = {0.0F, 0.0F, 256.0F, OFFSET * 2.0F};
|
||||
cover_surface_->render(&srcRect, &dstRect);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -136,8 +136,8 @@ void SAnimatedSprite::resetAnimation() {
|
||||
|
||||
// Carga la animación desde un vector de cadenas
|
||||
void SAnimatedSprite::setAnimations(const Animations& animations) {
|
||||
int frame_width = 1;
|
||||
int frame_height = 1;
|
||||
float frame_width = 1.0F;
|
||||
float frame_height = 1.0F;
|
||||
int frames_per_row = 1;
|
||||
int max_tiles = 1;
|
||||
|
||||
@@ -190,7 +190,7 @@ void SAnimatedSprite::setAnimations(const Animations& animations) {
|
||||
// Se introducen los valores separados por comas en un vector
|
||||
std::stringstream ss(value);
|
||||
std::string tmp;
|
||||
SDL_FRect rect = {0, 0, frame_width, frame_height};
|
||||
SDL_FRect rect = {0.0F, 0.0F, frame_width, frame_height};
|
||||
while (getline(ss, tmp, ',')) {
|
||||
// Comprueba que el tile no sea mayor que el maximo indice permitido
|
||||
const int num_tile = std::stoi(tmp);
|
||||
|
||||
@@ -439,7 +439,7 @@ void Surface::copyToTexture(SDL_Renderer* renderer, SDL_Texture* texture) {
|
||||
int pitch = 0;
|
||||
|
||||
// Bloquea la textura para modificar los píxeles directamente
|
||||
if (SDL_LockTexture(texture, nullptr, reinterpret_cast<void**>(&pixels), &pitch) != 0) {
|
||||
if (!SDL_LockTexture(texture, nullptr, reinterpret_cast<void**>(&pixels), &pitch)) {
|
||||
throw std::runtime_error("Failed to lock texture: " + std::string(SDL_GetError()));
|
||||
}
|
||||
|
||||
@@ -459,7 +459,7 @@ void Surface::copyToTexture(SDL_Renderer* renderer, SDL_Texture* texture) {
|
||||
SDL_UnlockTexture(texture); // Desbloquea la textura
|
||||
|
||||
// Renderiza la textura en la pantalla completa
|
||||
if (SDL_RenderTexture(renderer, texture, nullptr, nullptr) != 0) {
|
||||
if (!SDL_RenderTexture(renderer, texture, nullptr, nullptr)) {
|
||||
throw std::runtime_error("Failed to copy texture to renderer: " + std::string(SDL_GetError()));
|
||||
}
|
||||
}
|
||||
@@ -486,7 +486,7 @@ void Surface::copyToTexture(SDL_Renderer* renderer, SDL_Texture* texture, SDL_FR
|
||||
}
|
||||
|
||||
// Usa lockRect solo si destRect no es nulo
|
||||
if (SDL_LockTexture(texture, destRect ? &lockRect : nullptr, reinterpret_cast<void**>(&pixels), &pitch) != 0) {
|
||||
if (!SDL_LockTexture(texture, destRect ? &lockRect : nullptr, reinterpret_cast<void**>(&pixels), &pitch)) {
|
||||
throw std::runtime_error("Failed to lock texture: " + std::string(SDL_GetError()));
|
||||
}
|
||||
|
||||
@@ -504,7 +504,7 @@ void Surface::copyToTexture(SDL_Renderer* renderer, SDL_Texture* texture, SDL_FR
|
||||
SDL_UnlockTexture(texture);
|
||||
|
||||
// Renderiza la textura con los rectángulos especificados
|
||||
if (SDL_RenderTexture(renderer, texture, srcRect, destRect) != 0) {
|
||||
if (!SDL_RenderTexture(renderer, texture, srcRect, destRect)) {
|
||||
throw std::runtime_error("Failed to copy texture to renderer: " + std::string(SDL_GetError()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -88,7 +88,7 @@ Text::Text(std::shared_ptr<Surface> surface, const std::string& text_file) {
|
||||
}
|
||||
|
||||
// Crea los objetos
|
||||
sprite_ = std::make_unique<SSprite>(surface, (SDL_FRect){0, 0, box_width_, box_height_});
|
||||
sprite_ = std::make_unique<SSprite>(surface, (SDL_FRect){0.0F, 0.0F, static_cast<float>(box_width_), static_cast<float>(box_height_)});
|
||||
|
||||
// Inicializa variables
|
||||
fixed_width_ = false;
|
||||
@@ -106,7 +106,7 @@ Text::Text(std::shared_ptr<Surface> surface, std::shared_ptr<TextFile> text_file
|
||||
}
|
||||
|
||||
// Crea los objetos
|
||||
sprite_ = std::make_unique<SSprite>(surface, (SDL_FRect){0, 0, box_width_, box_height_});
|
||||
sprite_ = std::make_unique<SSprite>(surface, (SDL_FRect){0.0F, 0.0F, static_cast<float>(box_width_), static_cast<float>(box_height_)});
|
||||
|
||||
// Inicializa variables
|
||||
fixed_width_ = false;
|
||||
|
||||
@@ -51,10 +51,9 @@ bool Texture::loadFromFile(const std::string& file_path) {
|
||||
printWithDots("Image : ", getFileName(file_path), "[ LOADED ]");
|
||||
}
|
||||
|
||||
int depth, pitch;
|
||||
int pitch;
|
||||
SDL_PixelFormat pixel_format;
|
||||
// STBI_rgb_alpha (RGBA)
|
||||
depth = 32;
|
||||
pitch = 4 * width;
|
||||
pixel_format = SDL_PIXELFORMAT_RGBA32;
|
||||
|
||||
@@ -125,7 +124,7 @@ void Texture::setBlendMode(SDL_BlendMode blending) { SDL_SetTextureBlendMode(tex
|
||||
void Texture::setAlpha(Uint8 alpha) { SDL_SetTextureAlphaMod(texture_, alpha); }
|
||||
|
||||
// Renderiza la textura en un punto específico
|
||||
void Texture::render(int x, int y, SDL_FRect* clip, float zoomW, float zoomH, double angle, SDL_FPoint* center, SDL_FlipMode flip) {
|
||||
void Texture::render(float x, float y, SDL_FRect* clip, float zoomW, float zoomH, double angle, SDL_FPoint* center, SDL_FlipMode flip) {
|
||||
// Establece el destino de renderizado en la pantalla
|
||||
SDL_FRect render_quad = {x, y, width_, height_};
|
||||
|
||||
|
||||
@@ -14,8 +14,8 @@ class Texture {
|
||||
|
||||
// Variables
|
||||
std::string path_; // Ruta de la imagen de la textura
|
||||
int width_ = 0; // Ancho de la imagen
|
||||
int height_ = 0; // Alto de la imagen
|
||||
float width_ = 0.0F; // Ancho de la imagen
|
||||
float height_ = 0.0F; // Alto de la imagen
|
||||
std::vector<std::vector<Uint32>> palettes_; // Vector con las diferentes paletas
|
||||
|
||||
// Libera la memoria de la textura
|
||||
@@ -45,7 +45,7 @@ class Texture {
|
||||
void setAlpha(Uint8 alpha);
|
||||
|
||||
// Renderiza la textura en un punto específico
|
||||
void render(int x, int y, SDL_FRect* clip = nullptr, float zoomW = 1, float zoomH = 1, double angle = 0.0, SDL_FPoint* center = nullptr, SDL_FlipMode flip = SDL_FLIP_NONE);
|
||||
void render(float x, float y, SDL_FRect* clip = nullptr, float zoomW = 1, float zoomH = 1, double angle = 0.0, SDL_FPoint* center = nullptr, SDL_FlipMode flip = SDL_FLIP_NONE);
|
||||
|
||||
// Establece la textura como objetivo de renderizado
|
||||
void setAsRenderTarget(SDL_Renderer* renderer);
|
||||
|
||||
@@ -140,12 +140,12 @@ void Notifier::show(std::vector<std::string> texts, NotificationText text_is, Ui
|
||||
const auto PADDING_IN_V = text_size / 2;
|
||||
const int ICON_SPACE = icon >= 0 ? ICON_SIZE_ + PADDING_IN_H : 0;
|
||||
text_is = ICON_SPACE > 0 ? NotificationText::LEFT : text_is;
|
||||
const int WIDTH = options.game.width - (PADDING_OUT_ * 2);
|
||||
const int HEIGHT = (text_size * texts.size()) + (PADDING_IN_V * 2);
|
||||
const float WIDTH = options.game.width - (PADDING_OUT_ * 2);
|
||||
const float HEIGHT = (text_size * texts.size()) + (PADDING_IN_V * 2);
|
||||
const auto SHAPE = NotificationShape::SQUARED;
|
||||
|
||||
// Posición horizontal
|
||||
int desp_h = 0;
|
||||
float desp_h = 0;
|
||||
switch (options.notifications.getHorizontalPosition()) {
|
||||
case NotificationPosition::LEFT:
|
||||
desp_h = PADDING_OUT_;
|
||||
@@ -183,7 +183,7 @@ void Notifier::show(std::vector<std::string> texts, NotificationText text_is, Ui
|
||||
n.texts = texts;
|
||||
n.shape = SHAPE;
|
||||
n.display_duration = display_duration;
|
||||
const int Y_POS = OFFSET + ((options.notifications.getVerticalPosition() == NotificationPosition::TOP) ? -TRAVEL_DIST : TRAVEL_DIST);
|
||||
const float Y_POS = OFFSET + ((options.notifications.getVerticalPosition() == NotificationPosition::TOP) ? -TRAVEL_DIST : TRAVEL_DIST);
|
||||
n.rect = {desp_h, Y_POS, WIDTH, HEIGHT};
|
||||
|
||||
// Crea la textura
|
||||
@@ -219,7 +219,7 @@ void Notifier::show(std::vector<std::string> texts, NotificationText text_is, Ui
|
||||
if (has_icons_ && icon >= 0 && texts.size() >= 2) {
|
||||
auto sp = std::make_unique<SSprite>(icon_surface_, (SDL_FRect){0, 0, ICON_SIZE_, ICON_SIZE_});
|
||||
sp->setPosition({PADDING_IN_H, PADDING_IN_V, ICON_SIZE_, ICON_SIZE_});
|
||||
sp->setClip({ICON_SIZE_ * (icon % 10), ICON_SIZE_ * (icon / 10), ICON_SIZE_, ICON_SIZE_});
|
||||
sp->setClip((SDL_FRect){ICON_SIZE_ * (icon % 10), ICON_SIZE_ * (icon / 10), ICON_SIZE_, ICON_SIZE_});
|
||||
sp->render();
|
||||
}
|
||||
|
||||
|
||||
@@ -22,8 +22,8 @@ enum class NotificationText {
|
||||
class Notifier {
|
||||
private:
|
||||
// Constantes
|
||||
static constexpr int ICON_SIZE_ = 16;
|
||||
static constexpr int PADDING_OUT_ = 0;
|
||||
static constexpr float ICON_SIZE_ = 16.0F;
|
||||
static constexpr float PADDING_OUT_ = 0.0F;
|
||||
|
||||
// [SINGLETON] Objeto notifier
|
||||
static Notifier* notifier_;
|
||||
|
||||
@@ -232,7 +232,7 @@ SDL_FPoint checkCollision(const Line& l1, const Line& l2) {
|
||||
const float x = x1 + (uA * (x2 - x1));
|
||||
const float y = y1 + (uA * (y2 - y1));
|
||||
|
||||
return {(int)round(x), (int)round(y)};
|
||||
return {(float)round(x), (float)round(y)};
|
||||
}
|
||||
return {-1, -1};
|
||||
}
|
||||
@@ -259,7 +259,7 @@ SDL_FPoint checkCollision(const LineDiagonal& l1, const LineVertical& l2) {
|
||||
const float x = x1 + (uA * (x2 - x1));
|
||||
const float y = y1 + (uA * (y2 - y1));
|
||||
|
||||
return {(int)x, (int)y};
|
||||
return {(float)x, (float)y};
|
||||
}
|
||||
return {-1, -1};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user