local ____exports = {}
local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
local RenderMode = ____isaac_2Dtypescript_2Ddefinitions.RenderMode
local ____cachedClasses = require("core.cachedClasses")
local game = ____cachedClasses.game
--- Helper function to see if the current render callback is rendering a water reflection.
-- 
-- When the player is in a room with water, things will be rendered twice: once for the normal
-- rendering, and once for the reflecting rendering. Thus, any mod code in a render callback will
-- run twice per frame in these situations, which may be unexpected or cause bugs.
-- 
-- This function is typically used to early return from a render function if it returns true.
function ____exports.isReflectionRender(self)
    local room = game:GetRoom()
    local renderMode = room:GetRenderMode()
    return renderMode == RenderMode.WATER_REFLECT
end
function ____exports.renderScaledTextOnEntity(self, entity, text, scaleX, scaleY)
    if ____exports.isReflectionRender(nil) then
        return
    end
    local position = Isaac.WorldToScreen(entity.Position)
    Isaac.RenderScaledText(
        text,
        position.X,
        position.Y,
        scaleX,
        scaleY,
        1,
        1,
        1,
        1
    )
end
function ____exports.renderTextOnEntity(self, entity, text)
    if ____exports.isReflectionRender(nil) then
        return
    end
    local position = Isaac.WorldToScreen(entity.Position)
    Isaac.RenderText(
        text,
        position.X,
        position.Y,
        1,
        1,
        1,
        1
    )
end
return ____exports
