mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-27 20:20:40 +00:00
- Backend update from GZDoom.
This commit is contained in:
parent
389340f97c
commit
56fcf904b5
13 changed files with 79 additions and 94 deletions
|
@ -787,7 +787,7 @@ void F2DDrawer::AddPoly(FGameTexture* img, FVector4* vt, size_t vtcount, const u
|
||||||
mIndices.Reserve(vtcount);
|
mIndices.Reserve(vtcount);
|
||||||
for (size_t i = 0; i < vtcount; i++)
|
for (size_t i = 0; i < vtcount; i++)
|
||||||
{
|
{
|
||||||
mIndices[dg.mIndexIndex + i] = i + dg.mVertIndex;
|
mIndices[dg.mIndexIndex + i] = int(i + dg.mVertIndex);
|
||||||
}
|
}
|
||||||
dg.mIndexCount = (int)vtcount;
|
dg.mIndexCount = (int)vtcount;
|
||||||
|
|
||||||
|
|
|
@ -50,7 +50,7 @@ CVAR(Bool, ui_screenborder_classic_scaling, true, CVAR_ARCHIVE)
|
||||||
// nonsense that graphics should not be able to actually use that extra screen space.
|
// nonsense that graphics should not be able to actually use that extra screen space.
|
||||||
|
|
||||||
extern bool setsizeneeded;
|
extern bool setsizeneeded;
|
||||||
CUSTOM_CVAR(Bool, vid_allowtrueultrawide, true, CVAR_GLOBALCONFIG|CVAR_ARCHIVE|CVAR_NOINITCALL)
|
CUSTOM_CVAR(Int, vid_allowtrueultrawide, 1, CVAR_ARCHIVE|CVAR_NOINITCALL)
|
||||||
{
|
{
|
||||||
setsizeneeded = true;
|
setsizeneeded = true;
|
||||||
}
|
}
|
||||||
|
@ -335,7 +335,7 @@ DEFINE_ACTION_FUNCTION(_Screen, SetScreenFade)
|
||||||
{
|
{
|
||||||
PARAM_PROLOGUE;
|
PARAM_PROLOGUE;
|
||||||
PARAM_FLOAT(x);
|
PARAM_FLOAT(x);
|
||||||
twod->SetScreenFade(x);
|
twod->SetScreenFade(float(x));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1279,11 +1279,20 @@ static void VirtualToRealCoords(F2DDrawer *drawer, double Width, double Height,
|
||||||
{
|
{
|
||||||
float myratio = float(handleaspect ? ActiveRatio (Width, Height) : (4.0 / 3.0));
|
float myratio = float(handleaspect ? ActiveRatio (Width, Height) : (4.0 / 3.0));
|
||||||
|
|
||||||
// if 21:9 AR, map to 16:9 for all callers.
|
// if 21:9 AR, map to 16:9 for all callers.
|
||||||
// this allows for black bars and stops the stretching of fullscreen images
|
// this allows for black bars and stops the stretching of fullscreen images
|
||||||
if ((myratio > 1.7f) && !vid_allowtrueultrawide) {
|
|
||||||
myratio = 16.0f / 9.0f;
|
switch (vid_allowtrueultrawide)
|
||||||
}
|
{
|
||||||
|
case 1:
|
||||||
|
default:
|
||||||
|
myratio = MIN(64.0f / 27.0f, myratio);
|
||||||
|
break;
|
||||||
|
case 0:
|
||||||
|
myratio = MIN(16.0f / 9.0f, myratio);
|
||||||
|
case -1:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
double right = x + w;
|
double right = x + w;
|
||||||
double bottom = y + h;
|
double bottom = y + h;
|
||||||
|
|
|
@ -61,12 +61,9 @@
|
||||||
|
|
||||||
// MACROS ------------------------------------------------------------------
|
// MACROS ------------------------------------------------------------------
|
||||||
|
|
||||||
// Requires SDL 2.0.6 or newer
|
#if defined HAVE_VULKAN
|
||||||
//#define SDL2_STATIC_LIBRARY
|
|
||||||
|
|
||||||
#if defined SDL2_STATIC_LIBRARY && defined HAVE_VULKAN
|
|
||||||
#include <SDL_vulkan.h>
|
#include <SDL_vulkan.h>
|
||||||
#endif // SDL2_STATIC_LIBRARY && HAVE_VULKAN
|
#endif // HAVE_VULKAN
|
||||||
|
|
||||||
// TYPES -------------------------------------------------------------------
|
// TYPES -------------------------------------------------------------------
|
||||||
|
|
||||||
|
@ -118,30 +115,7 @@ CCMD(vid_list_sdl_render_drivers)
|
||||||
|
|
||||||
namespace Priv
|
namespace Priv
|
||||||
{
|
{
|
||||||
#ifdef SDL2_STATIC_LIBRARY
|
static const uint32_t VulkanWindowFlag = SDL_WINDOW_VULKAN;
|
||||||
|
|
||||||
#define SDL2_OPTIONAL_FUNCTION(RESULT, NAME, ...) \
|
|
||||||
RESULT(*NAME)(__VA_ARGS__) = SDL_ ## NAME
|
|
||||||
|
|
||||||
#else // !SDL2_STATIC_LIBRARY
|
|
||||||
|
|
||||||
FModule library("SDL2");
|
|
||||||
|
|
||||||
#define SDL2_OPTIONAL_FUNCTION(RESULT, NAME, ...) \
|
|
||||||
static TOptProc<library, RESULT(*)(__VA_ARGS__)> NAME("SDL_" #NAME)
|
|
||||||
|
|
||||||
#endif // SDL2_STATIC_LIBRARY
|
|
||||||
|
|
||||||
SDL2_OPTIONAL_FUNCTION(int, GetWindowBordersSize, SDL_Window *window, int *top, int *left, int *bottom, int *right);
|
|
||||||
#ifdef HAVE_VULKAN
|
|
||||||
SDL2_OPTIONAL_FUNCTION(void, Vulkan_GetDrawableSize, SDL_Window *window, int *width, int *height);
|
|
||||||
SDL2_OPTIONAL_FUNCTION(SDL_bool, Vulkan_GetInstanceExtensions, SDL_Window *window, unsigned int *count, const char **names);
|
|
||||||
SDL2_OPTIONAL_FUNCTION(SDL_bool, Vulkan_CreateSurface, SDL_Window *window, VkInstance instance, VkSurfaceKHR *surface);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#undef SDL2_OPTIONAL_FUNCTION
|
|
||||||
|
|
||||||
static const uint32_t VulkanWindowFlag = 0x1000'0000;
|
|
||||||
|
|
||||||
SDL_Window *window;
|
SDL_Window *window;
|
||||||
bool vulkanEnabled;
|
bool vulkanEnabled;
|
||||||
|
@ -240,22 +214,21 @@ void I_GetVulkanDrawableSize(int *width, int *height)
|
||||||
{
|
{
|
||||||
assert(Priv::vulkanEnabled);
|
assert(Priv::vulkanEnabled);
|
||||||
assert(Priv::window != nullptr);
|
assert(Priv::window != nullptr);
|
||||||
assert(Priv::Vulkan_GetDrawableSize);
|
SDL_Vulkan_GetDrawableSize(Priv::window, width, height);
|
||||||
Priv::Vulkan_GetDrawableSize(Priv::window, width, height);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool I_GetVulkanPlatformExtensions(unsigned int *count, const char **names)
|
bool I_GetVulkanPlatformExtensions(unsigned int *count, const char **names)
|
||||||
{
|
{
|
||||||
assert(Priv::vulkanEnabled);
|
assert(Priv::vulkanEnabled);
|
||||||
assert(Priv::window != nullptr);
|
assert(Priv::window != nullptr);
|
||||||
return Priv::Vulkan_GetInstanceExtensions(Priv::window, count, names) == SDL_TRUE;
|
return SDL_Vulkan_GetInstanceExtensions(Priv::window, count, names) == SDL_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool I_CreateVulkanSurface(VkInstance instance, VkSurfaceKHR *surface)
|
bool I_CreateVulkanSurface(VkInstance instance, VkSurfaceKHR *surface)
|
||||||
{
|
{
|
||||||
assert(Priv::vulkanEnabled);
|
assert(Priv::vulkanEnabled);
|
||||||
assert(Priv::window != nullptr);
|
assert(Priv::window != nullptr);
|
||||||
return Priv::Vulkan_CreateSurface(Priv::window, instance, surface) == SDL_TRUE;
|
return SDL_Vulkan_CreateSurface(Priv::window, instance, surface) == SDL_TRUE;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -419,20 +392,19 @@ SDLVideo::SDLVideo ()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef SDL2_STATIC_LIBRARY
|
// Fail gracefully if we somehow reach here after linking against a SDL2 library older than 2.0.6.
|
||||||
// Load optional SDL functions
|
SDL_version sdlver;
|
||||||
if (!Priv::library.IsLoaded())
|
SDL_GetVersion(&sdlver);
|
||||||
|
if (!(sdlver.patch >= 6))
|
||||||
{
|
{
|
||||||
Priv::library.Load({ "libSDL2-2.0.so.0", "libSDL2-2.0.so", "libSDL2.so" });
|
I_FatalError("Only SDL 2.0.6 or later is supported.");
|
||||||
}
|
}
|
||||||
#endif // !SDL2_STATIC_LIBRARY
|
|
||||||
|
|
||||||
#ifdef HAVE_SOFTPOLY
|
#ifdef HAVE_SOFTPOLY
|
||||||
Priv::softpolyEnabled = vid_preferbackend == 2;
|
Priv::softpolyEnabled = vid_preferbackend == 2;
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_VULKAN
|
#ifdef HAVE_VULKAN
|
||||||
Priv::vulkanEnabled = vid_preferbackend == 1
|
Priv::vulkanEnabled = vid_preferbackend == 1;
|
||||||
&& Priv::Vulkan_GetDrawableSize && Priv::Vulkan_GetInstanceExtensions && Priv::Vulkan_CreateSurface;
|
|
||||||
|
|
||||||
if (Priv::vulkanEnabled)
|
if (Priv::vulkanEnabled)
|
||||||
{
|
{
|
||||||
|
@ -539,7 +511,7 @@ int SystemBaseFrameBuffer::GetClientWidth()
|
||||||
|
|
||||||
#ifdef HAVE_VULKAN
|
#ifdef HAVE_VULKAN
|
||||||
assert(Priv::vulkanEnabled);
|
assert(Priv::vulkanEnabled);
|
||||||
Priv::Vulkan_GetDrawableSize(Priv::window, &width, nullptr);
|
SDL_Vulkan_GetDrawableSize(Priv::window, &width, nullptr);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return width;
|
return width;
|
||||||
|
@ -562,7 +534,7 @@ int SystemBaseFrameBuffer::GetClientHeight()
|
||||||
|
|
||||||
#ifdef HAVE_VULKAN
|
#ifdef HAVE_VULKAN
|
||||||
assert(Priv::vulkanEnabled);
|
assert(Priv::vulkanEnabled);
|
||||||
Priv::Vulkan_GetDrawableSize(Priv::window, nullptr, &height);
|
SDL_Vulkan_GetDrawableSize(Priv::window, nullptr, &height);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return height;
|
return height;
|
||||||
|
@ -745,10 +717,10 @@ void ProcessSDLWindowEvent(const SDL_WindowEvent &event)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SDL_WINDOWEVENT_MOVED:
|
case SDL_WINDOWEVENT_MOVED:
|
||||||
if (!vid_fullscreen && Priv::GetWindowBordersSize)
|
if (!vid_fullscreen)
|
||||||
{
|
{
|
||||||
int top = 0, left = 0;
|
int top = 0, left = 0;
|
||||||
Priv::GetWindowBordersSize(Priv::window, &top, &left, nullptr, nullptr);
|
SDL_GetWindowBordersSize(Priv::window, &top, &left, nullptr, nullptr);
|
||||||
win_x = event.data1-left;
|
win_x = event.data1-left;
|
||||||
win_y = event.data2-top;
|
win_y = event.data2-top;
|
||||||
}
|
}
|
||||||
|
|
|
@ -81,10 +81,10 @@ DEFINE_ACTION_FUNCTION_NATIVE(DStatusBarCore, StatusbarToRealCoords, StatusbarTo
|
||||||
return MIN(4, numret);
|
return MIN(4, numret);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SBar_DrawTexture(DStatusBarCore* self, int texid, double x, double y, int flags, double alpha, double w, double h, double scaleX, double scaleY)
|
void SBar_DrawTexture(DStatusBarCore* self, int texid, double x, double y, int flags, double alpha, double w, double h, double scaleX, double scaleY, int style)
|
||||||
{
|
{
|
||||||
if (!twod->HasBegun2D()) ThrowAbortException(X_OTHER, "Attempt to draw to screen outside a draw function");
|
if (!twod->HasBegun2D()) ThrowAbortException(X_OTHER, "Attempt to draw to screen outside a draw function");
|
||||||
self->DrawGraphic(FSetTextureID(texid), x, y, flags, alpha, w, h, scaleX, scaleY);
|
self->DrawGraphic(FSetTextureID(texid), x, y, flags, alpha, w, h, scaleX, scaleY, ERenderStyle(style));
|
||||||
}
|
}
|
||||||
|
|
||||||
DEFINE_ACTION_FUNCTION_NATIVE(DStatusBarCore, DrawTexture, SBar_DrawTexture)
|
DEFINE_ACTION_FUNCTION_NATIVE(DStatusBarCore, DrawTexture, SBar_DrawTexture)
|
||||||
|
@ -99,14 +99,15 @@ DEFINE_ACTION_FUNCTION_NATIVE(DStatusBarCore, DrawTexture, SBar_DrawTexture)
|
||||||
PARAM_FLOAT(h);
|
PARAM_FLOAT(h);
|
||||||
PARAM_FLOAT(scaleX);
|
PARAM_FLOAT(scaleX);
|
||||||
PARAM_FLOAT(scaleY);
|
PARAM_FLOAT(scaleY);
|
||||||
SBar_DrawTexture(self, texid, x, y, flags, alpha, w, h, scaleX, scaleY);
|
PARAM_INT(style);
|
||||||
|
SBar_DrawTexture(self, texid, x, y, flags, alpha, w, h, scaleX, scaleY, style);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SBar_DrawImage(DStatusBarCore* self, const FString& texid, double x, double y, int flags, double alpha, double w, double h, double scaleX, double scaleY)
|
void SBar_DrawImage(DStatusBarCore* self, const FString& texid, double x, double y, int flags, double alpha, double w, double h, double scaleX, double scaleY, int style)
|
||||||
{
|
{
|
||||||
if (!twod->HasBegun2D()) ThrowAbortException(X_OTHER, "Attempt to draw to screen outside a draw function");
|
if (!twod->HasBegun2D()) ThrowAbortException(X_OTHER, "Attempt to draw to screen outside a draw function");
|
||||||
self->DrawGraphic(TexMan.CheckForTexture(texid, ETextureType::Any), x, y, flags, alpha, w, h, scaleX, scaleY);
|
self->DrawGraphic(TexMan.CheckForTexture(texid, ETextureType::Any), x, y, flags, alpha, w, h, scaleX, scaleY, ERenderStyle(style));
|
||||||
}
|
}
|
||||||
|
|
||||||
DEFINE_ACTION_FUNCTION_NATIVE(DStatusBarCore, DrawImage, SBar_DrawImage)
|
DEFINE_ACTION_FUNCTION_NATIVE(DStatusBarCore, DrawImage, SBar_DrawImage)
|
||||||
|
@ -121,11 +122,12 @@ DEFINE_ACTION_FUNCTION_NATIVE(DStatusBarCore, DrawImage, SBar_DrawImage)
|
||||||
PARAM_FLOAT(h);
|
PARAM_FLOAT(h);
|
||||||
PARAM_FLOAT(scaleX);
|
PARAM_FLOAT(scaleX);
|
||||||
PARAM_FLOAT(scaleY);
|
PARAM_FLOAT(scaleY);
|
||||||
SBar_DrawImage(self, texid, x, y, flags, alpha, w, h, scaleX, scaleY);
|
PARAM_INT(style);
|
||||||
|
SBar_DrawImage(self, texid, x, y, flags, alpha, w, h, scaleX, scaleY, style);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SBar_DrawString(DStatusBarCore* self, DHUDFont* font, const FString& string, double x, double y, int flags, int trans, double alpha, int wrapwidth, int linespacing, double scaleX, double scaleY, int translation);
|
void SBar_DrawString(DStatusBarCore* self, DHUDFont* font, const FString& string, double x, double y, int flags, int trans, double alpha, int wrapwidth, int linespacing, double scaleX, double scaleY, int translation, int style);
|
||||||
|
|
||||||
DEFINE_ACTION_FUNCTION_NATIVE(DStatusBarCore, DrawString, SBar_DrawString)
|
DEFINE_ACTION_FUNCTION_NATIVE(DStatusBarCore, DrawString, SBar_DrawString)
|
||||||
{
|
{
|
||||||
|
@ -142,7 +144,8 @@ DEFINE_ACTION_FUNCTION_NATIVE(DStatusBarCore, DrawString, SBar_DrawString)
|
||||||
PARAM_FLOAT(scaleX);
|
PARAM_FLOAT(scaleX);
|
||||||
PARAM_FLOAT(scaleY);
|
PARAM_FLOAT(scaleY);
|
||||||
PARAM_INT(pt);
|
PARAM_INT(pt);
|
||||||
SBar_DrawString(self, font, string, x, y, flags, trans, alpha, wrapwidth, linespacing, scaleX, scaleY, pt);
|
PARAM_INT(style);
|
||||||
|
SBar_DrawString(self, font, string, x, y, flags, trans, alpha, wrapwidth, linespacing, scaleX, scaleY, pt, style);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -452,16 +452,16 @@ void DStatusBarCore::StatusbarToRealCoords(double& x, double& y, double& w, doub
|
||||||
//
|
//
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
|
||||||
void DStatusBarCore::DrawGraphic(FTextureID texture, double x, double y, int flags, double Alpha, double boxwidth, double boxheight, double scaleX, double scaleY, PalEntry color, int translation, ERenderStyle style, double clipwidth)
|
void DStatusBarCore::DrawGraphic(FTextureID texture, double x, double y, int flags, double Alpha, double boxwidth, double boxheight, double scaleX, double scaleY, ERenderStyle style, PalEntry color, int translation, double clipwidth)
|
||||||
{
|
{
|
||||||
if (!texture.isValid())
|
if (!texture.isValid())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
FGameTexture* tex = TexMan.GetGameTexture(texture, !(flags & DI_DONTANIMATE));
|
FGameTexture* tex = TexMan.GetGameTexture(texture, !(flags & DI_DONTANIMATE));
|
||||||
DrawGraphic(tex, x, y, flags, Alpha, boxwidth, boxheight, scaleX, scaleY, color, translation, style);
|
DrawGraphic(tex, x, y, flags, Alpha, boxwidth, boxheight, scaleX, scaleY, style, color, translation);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DStatusBarCore::DrawGraphic(FGameTexture* tex, double x, double y, int flags, double Alpha, double boxwidth, double boxheight, double scaleX, double scaleY, PalEntry color, int translation, ERenderStyle style, double clipwidth)
|
void DStatusBarCore::DrawGraphic(FGameTexture* tex, double x, double y, int flags, double Alpha, double boxwidth, double boxheight, double scaleX, double scaleY, ERenderStyle style, PalEntry color, int translation, double clipwidth)
|
||||||
{
|
{
|
||||||
double texwidth = tex->GetDisplayWidth() * scaleX;
|
double texwidth = tex->GetDisplayWidth() * scaleX;
|
||||||
double texheight = tex->GetDisplayHeight() * scaleY;
|
double texheight = tex->GetDisplayHeight() * scaleY;
|
||||||
|
@ -695,7 +695,7 @@ void DStatusBarCore::DrawRotated(FGameTexture* tex, double x, double y, int flag
|
||||||
//
|
//
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
|
||||||
void DStatusBarCore::DrawString(FFont* font, const FString& cstring, double x, double y, int flags, double Alpha, int translation, int spacing, EMonospacing monospacing, int shadowX, int shadowY, double scaleX, double scaleY, int pt)
|
void DStatusBarCore::DrawString(FFont* font, const FString& cstring, double x, double y, int flags, double Alpha, int translation, int spacing, EMonospacing monospacing, int shadowX, int shadowY, double scaleX, double scaleY, int pt, int style)
|
||||||
{
|
{
|
||||||
bool monospaced = monospacing != EMonospacing::Off;
|
bool monospaced = monospacing != EMonospacing::Off;
|
||||||
double dx = 0;
|
double dx = 0;
|
||||||
|
@ -822,6 +822,7 @@ void DStatusBarCore::DrawString(FFont* font, const FString& cstring, double x, d
|
||||||
DTA_DestHeightF, rh,
|
DTA_DestHeightF, rh,
|
||||||
DTA_Alpha, Alpha,
|
DTA_Alpha, Alpha,
|
||||||
DTA_TranslationIndex, pt,
|
DTA_TranslationIndex, pt,
|
||||||
|
DTA_LegacyRenderStyle, ERenderStyle(style),
|
||||||
TAG_DONE);
|
TAG_DONE);
|
||||||
|
|
||||||
dx = monospaced
|
dx = monospaced
|
||||||
|
@ -833,7 +834,7 @@ void DStatusBarCore::DrawString(FFont* font, const FString& cstring, double x, d
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SBar_DrawString(DStatusBarCore* self, DHUDFont* font, const FString& string, double x, double y, int flags, int trans, double alpha, int wrapwidth, int linespacing, double scaleX, double scaleY, int pt)
|
void SBar_DrawString(DStatusBarCore* self, DHUDFont* font, const FString& string, double x, double y, int flags, int trans, double alpha, int wrapwidth, int linespacing, double scaleX, double scaleY, int pt, int style)
|
||||||
{
|
{
|
||||||
if (font == nullptr) ThrowAbortException(X_READ_NIL, nullptr);
|
if (font == nullptr) ThrowAbortException(X_READ_NIL, nullptr);
|
||||||
if (!twod->HasBegun2D()) ThrowAbortException(X_OTHER, "Attempt to draw to screen outside a draw function");
|
if (!twod->HasBegun2D()) ThrowAbortException(X_OTHER, "Attempt to draw to screen outside a draw function");
|
||||||
|
@ -852,13 +853,13 @@ void SBar_DrawString(DStatusBarCore* self, DHUDFont* font, const FString& string
|
||||||
auto brk = V_BreakLines(font->mFont, int(wrapwidth * scaleX), string, true);
|
auto brk = V_BreakLines(font->mFont, int(wrapwidth * scaleX), string, true);
|
||||||
for (auto& line : brk)
|
for (auto& line : brk)
|
||||||
{
|
{
|
||||||
self->DrawString(font->mFont, line.Text, x, y, flags, alpha, trans, font->mSpacing, font->mMonospacing, font->mShadowX, font->mShadowY, scaleX, scaleY, pt);
|
self->DrawString(font->mFont, line.Text, x, y, flags, alpha, trans, font->mSpacing, font->mMonospacing, font->mShadowX, font->mShadowY, scaleX, scaleY, pt, style);
|
||||||
y += (font->mFont->GetHeight() + linespacing) * scaleY;
|
y += (font->mFont->GetHeight() + linespacing) * scaleY;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
self->DrawString(font->mFont, string, x, y, flags, alpha, trans, font->mSpacing, font->mMonospacing, font->mShadowX, font->mShadowY, scaleX, scaleY, pt);
|
self->DrawString(font->mFont, string, x, y, flags, alpha, trans, font->mSpacing, font->mMonospacing, font->mShadowX, font->mShadowY, scaleX, scaleY, pt, style);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -184,11 +184,11 @@ public:
|
||||||
virtual void SetScale();
|
virtual void SetScale();
|
||||||
void ValidateResolution(int& hres, int& vres) const;
|
void ValidateResolution(int& hres, int& vres) const;
|
||||||
void StatusbarToRealCoords(double& x, double& y, double& w, double& h) const;
|
void StatusbarToRealCoords(double& x, double& y, double& w, double& h) const;
|
||||||
void DrawGraphic(FGameTexture* texture, double x, double y, int flags, double Alpha, double boxwidth, double boxheight, double scaleX, double scaleY, PalEntry color = 0xffffffff, int translation = 0, ERenderStyle style = STYLE_Translucent, double clipwidth = -1.0);
|
void DrawGraphic(FGameTexture* texture, double x, double y, int flags, double Alpha, double boxwidth, double boxheight, double scaleX, double scaleY, ERenderStyle style = STYLE_Translucent, PalEntry color = 0xffffffff, int translation = 0, double clipwidth = -1.0);
|
||||||
void DrawGraphic(FTextureID texture, double x, double y, int flags, double Alpha, double boxwidth, double boxheight, double scaleX, double scaleY, PalEntry color = 0xffffffff, int translation = 0, ERenderStyle style = STYLE_Translucent, double clipwidth = -1.0);
|
void DrawGraphic(FTextureID texture, double x, double y, int flags, double Alpha, double boxwidth, double boxheight, double scaleX, double scaleY, ERenderStyle style = STYLE_Translucent, PalEntry color = 0xffffffff, int translation = 0, double clipwidth = -1.0);
|
||||||
void DrawRotated(FTextureID texture, double x, double y, int flags, double angle, double Alpha, double scaleX, double scaleY, PalEntry color = 0xffffffff, int translation = 0, ERenderStyle style = STYLE_Translucent);
|
void DrawRotated(FTextureID texture, double x, double y, int flags, double angle, double Alpha, double scaleX, double scaleY, PalEntry color = 0xffffffff, int translation = 0, ERenderStyle style = STYLE_Translucent);
|
||||||
void DrawRotated(FGameTexture* tex, double x, double y, int flags, double angle, double Alpha, double scaleX, double scaleY, PalEntry color = 0xffffffff, int translation = 0, ERenderStyle style = STYLE_Translucent);
|
void DrawRotated(FGameTexture* tex, double x, double y, int flags, double angle, double Alpha, double scaleX, double scaleY, PalEntry color = 0xffffffff, int translation = 0, ERenderStyle style = STYLE_Translucent);
|
||||||
void DrawString(FFont* font, const FString& cstring, double x, double y, int flags, double Alpha, int translation, int spacing, EMonospacing monospacing, int shadowX, int shadowY, double scaleX, double scaleY, int pt);
|
void DrawString(FFont* font, const FString& cstring, double x, double y, int flags, double Alpha, int translation, int spacing, EMonospacing monospacing, int shadowX, int shadowY, double scaleX, double scaleY, int pt, int style);
|
||||||
void TransformRect(double& x, double& y, double& w, double& h, int flags = 0);
|
void TransformRect(double& x, double& y, double& w, double& h, int flags = 0);
|
||||||
void Fill(PalEntry color, double x, double y, double w, double h, int flags = 0);
|
void Fill(PalEntry color, double x, double y, double w, double h, int flags = 0);
|
||||||
void SetClipRect(double x, double y, double w, double h, int flags = 0);
|
void SetClipRect(double x, double y, double w, double h, int flags = 0);
|
||||||
|
|
|
@ -136,7 +136,7 @@ void ST_Clear();
|
||||||
extern FGameTexture *CrosshairImage;
|
extern FGameTexture *CrosshairImage;
|
||||||
|
|
||||||
|
|
||||||
void SBar_DrawString(DStatusBarCore* self, DHUDFont* font, const FString& string, double x, double y, int flags, int trans, double alpha, int wrapwidth, int linespacing, double scaleX, double scaleY, int pt = 0);
|
void SBar_DrawString(DStatusBarCore* self, DHUDFont* font, const FString& string, double x, double y, int flags, int trans, double alpha, int wrapwidth, int linespacing, double scaleX, double scaleY, int pt = 0, int style = STYLE_Translucent);
|
||||||
void setViewport(int viewSize);
|
void setViewport(int viewSize);
|
||||||
struct MapRecord;
|
struct MapRecord;
|
||||||
void setLevelStarted(MapRecord *);
|
void setLevelStarted(MapRecord *);
|
||||||
|
|
|
@ -130,7 +130,7 @@ private:
|
||||||
int flags = align | ((nStat & RS_CENTERBOTTOM)? DI_ITEM_CENTER_BOTTOM : (nStat & RS_TOPLEFT)? DI_ITEM_LEFT_TOP : DI_ITEM_RELCENTER);
|
int flags = align | ((nStat & RS_CENTERBOTTOM)? DI_ITEM_CENTER_BOTTOM : (nStat & RS_TOPLEFT)? DI_ITEM_LEFT_TOP : DI_ITEM_RELCENTER);
|
||||||
double alpha = 1.;
|
double alpha = 1.;
|
||||||
double scale = nScale / 65536.;
|
double scale = nScale / 65536.;
|
||||||
DrawGraphic(tileGetTexture(nTile, true), x, y, flags, alpha, -1, -1, scale, scale, shadeToLight(nShade), TRANSLATION(Translation_Remap, nPalette), style);
|
DrawGraphic(tileGetTexture(nTile, true), x, y, flags, alpha, -1, -1, scale, scale, STYLE_Translucent, shadeToLight(nShade), TRANSLATION(Translation_Remap, nPalette), style);
|
||||||
}
|
}
|
||||||
void DrawStatMaskedSprite(int nTile, double x, double y, int nShade = 0, int nPalette = 0, unsigned int nStat = 0, int nScale = 65536, int align = DI_SCREEN_AUTO)
|
void DrawStatMaskedSprite(int nTile, double x, double y, int nShade = 0, int nPalette = 0, unsigned int nStat = 0, int nScale = 65536, int align = DI_SCREEN_AUTO)
|
||||||
{
|
{
|
||||||
|
@ -197,7 +197,7 @@ private:
|
||||||
int bx = scale(MulScale(w, nScale, 16), nMult, nDiv) + x;
|
int bx = scale(MulScale(w, nScale, 16), nMult, nDiv) + x;
|
||||||
double scale = double(bx - x) / w;
|
double scale = double(bx - x) / w;
|
||||||
double sc = nScale / 65536.;
|
double sc = nScale / 65536.;
|
||||||
DrawGraphic(tileGetTexture(nTile, true), x, y, DI_ITEM_LEFT_TOP, 1., -1, -1, sc, sc, 0xffffffff, 0, STYLE_Translucent, scale);
|
DrawGraphic(tileGetTexture(nTile, true), x, y, DI_ITEM_LEFT_TOP, 1., -1, -1, sc, sc, STYLE_Translucent, 0xffffffff, 0, scale);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -243,9 +243,9 @@ public:
|
||||||
//
|
//
|
||||||
// keys
|
// keys
|
||||||
//
|
//
|
||||||
if (p->got_access & 1) DrawGraphic(tileGetTexture(ACCESSCARD), -12, -23.5, DI_ITEM_RIGHT, 1, -1, -1, 0.5, 0.5, 0xffffffff, TRANSLATION(Translation_Remap, 0));
|
if (p->got_access & 1) DrawGraphic(tileGetTexture(ACCESSCARD), -12, -23.5, DI_ITEM_RIGHT, 1, -1, -1, 0.5, 0.5, STYLE_Translucent, 0xffffffff, TRANSLATION(Translation_Remap, 0));
|
||||||
if (p->got_access & 4) DrawGraphic(tileGetTexture(ACCESSCARD), -7 , -21.5, DI_ITEM_RIGHT, 1, -1, -1, 0.5, 0.5, 0xffffffff, TRANSLATION(Translation_Remap, 23));
|
if (p->got_access & 4) DrawGraphic(tileGetTexture(ACCESSCARD), -7 , -21.5, DI_ITEM_RIGHT, 1, -1, -1, 0.5, 0.5, STYLE_Translucent, 0xffffffff, TRANSLATION(Translation_Remap, 23));
|
||||||
if (p->got_access & 2) DrawGraphic(tileGetTexture(ACCESSCARD), -2 , -19.5, DI_ITEM_RIGHT, 1, -1, -1, 0.5, 0.5, 0xffffffff, TRANSLATION(Translation_Remap, 21));
|
if (p->got_access & 2) DrawGraphic(tileGetTexture(ACCESSCARD), -2 , -19.5, DI_ITEM_RIGHT, 1, -1, -1, 0.5, 0.5, STYLE_Translucent, 0xffffffff, TRANSLATION(Translation_Remap, 21));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -355,15 +355,15 @@ public:
|
||||||
format.Format("%3d/%d", num1, num2);
|
format.Format("%3d/%d", num1, num2);
|
||||||
}
|
}
|
||||||
y--;
|
y--;
|
||||||
DrawGraphic(tileGetTexture(THREEBYFIVE + index), x - 7, y, DI_ITEM_LEFT|DI_ITEM_VCENTER, 1, 0, 0, 1, 1, LightForShade(shade - 10), TRANSLATION(Translation_Remap, 7));
|
DrawGraphic(tileGetTexture(THREEBYFIVE + index), x - 7, y, DI_ITEM_LEFT|DI_ITEM_VCENTER, 1, 0, 0, 1, 1, STYLE_Translucent, LightForShade(shade - 10), TRANSLATION(Translation_Remap, 7));
|
||||||
auto pe = LightForShade(shade);
|
auto pe = LightForShade(shade);
|
||||||
DrawGraphic(tileGetTexture(THREEBYFIVE + 10), x - 3, y, DI_ITEM_LEFT | DI_ITEM_VCENTER, 1, 0, 0, 1, 1, pe);
|
DrawGraphic(tileGetTexture(THREEBYFIVE + 10), x - 3, y, DI_ITEM_LEFT | DI_ITEM_VCENTER, 1, 0, 0, 1, 1, STYLE_Translucent, pe);
|
||||||
for (size_t i = 0; i < format.Len(); i++)
|
for (size_t i = 0; i < format.Len(); i++)
|
||||||
{
|
{
|
||||||
if (format[i] != ' ')
|
if (format[i] != ' ')
|
||||||
{
|
{
|
||||||
char c = format[i] == '/' ? 11 : format[i] - '0';
|
char c = format[i] == '/' ? 11 : format[i] - '0';
|
||||||
DrawGraphic(tileGetTexture(THREEBYFIVE + c), x + 4 * i + (parsedDivisor ? 1 : 0), y, DI_ITEM_LEFT | DI_ITEM_VCENTER, 1, 0, 0, 1, 1, pe);
|
DrawGraphic(tileGetTexture(THREEBYFIVE + c), x + 4 * i + (parsedDivisor ? 1 : 0), y, DI_ITEM_LEFT | DI_ITEM_VCENTER, 1, 0, 0, 1, 1, STYLE_Translucent, pe);
|
||||||
}
|
}
|
||||||
if (format[i] == '/')
|
if (format[i] == '/')
|
||||||
{
|
{
|
||||||
|
@ -431,9 +431,9 @@ public:
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
auto key = tileGetTexture(ACCESS_ICON);
|
auto key = tileGetTexture(ACCESS_ICON);
|
||||||
if (p->got_access & 4) DrawGraphic(key, 275.5, top + 16, DI_ITEM_OFFSETS, 1, -1, -1, 1, 1, 0xffffffff, TRANSLATION(Translation_Remap, 23));
|
if (p->got_access & 4) DrawGraphic(key, 275.5, top + 16, DI_ITEM_OFFSETS, 1, -1, -1, 1, 1, STYLE_Translucent, 0xffffffff, TRANSLATION(Translation_Remap, 23));
|
||||||
if (p->got_access & 2) DrawGraphic(key, 288.5, top + 16, DI_ITEM_OFFSETS, 1, -1, -1, 1, 1, 0xffffffff, TRANSLATION(Translation_Remap, 21));
|
if (p->got_access & 2) DrawGraphic(key, 288.5, top + 16, DI_ITEM_OFFSETS, 1, -1, -1, 1, 1, STYLE_Translucent, 0xffffffff, TRANSLATION(Translation_Remap, 21));
|
||||||
if (p->got_access & 1) DrawGraphic(key, 282, top + 23, DI_ITEM_OFFSETS, 1, -1, -1, 1, 1, 0xffffffff, TRANSLATION(Translation_Remap, 0));
|
if (p->got_access & 1) DrawGraphic(key, 282, top + 23, DI_ITEM_OFFSETS, 1, -1, -1, 1, 1, STYLE_Translucent, 0xffffffff, TRANSLATION(Translation_Remap, 0));
|
||||||
}
|
}
|
||||||
DrawWeaponAmounts(p, 96, top + 15.5);
|
DrawWeaponAmounts(p, 96, top + 15.5);
|
||||||
|
|
||||||
|
|
|
@ -212,9 +212,9 @@ public:
|
||||||
//
|
//
|
||||||
// keys
|
// keys
|
||||||
//
|
//
|
||||||
if (p->keys[1]) DrawGraphic(tileGetTexture(ACCESSCARD), -28.5, -32 , DI_ITEM_BOTTOM, 1, -1, -1, scale, scale, 0xffffffff, TRANSLATION(Translation_Remap, 0));
|
if (p->keys[1]) DrawGraphic(tileGetTexture(ACCESSCARD), -28.5, -32 , DI_ITEM_BOTTOM, 1, -1, -1, scale, scale, STYLE_Translucent, 0xffffffff, TRANSLATION(Translation_Remap, 0));
|
||||||
if (p->keys[3]) DrawGraphic(tileGetTexture(ACCESSCARD), -21.25, -28.375, DI_ITEM_BOTTOM, 1, -1, -1, scale, scale, 0xffffffff, TRANSLATION(Translation_Remap, 23));
|
if (p->keys[3]) DrawGraphic(tileGetTexture(ACCESSCARD), -21.25, -28.375, DI_ITEM_BOTTOM, 1, -1, -1, scale, scale, STYLE_Translucent, 0xffffffff, TRANSLATION(Translation_Remap, 23));
|
||||||
if (p->keys[2]) DrawGraphic(tileGetTexture(ACCESSCARD), -14, -24.75 , DI_ITEM_BOTTOM, 1, -1, -1, scale, scale, 0xffffffff, TRANSLATION(Translation_Remap, 21));
|
if (p->keys[2]) DrawGraphic(tileGetTexture(ACCESSCARD), -14, -24.75 , DI_ITEM_BOTTOM, 1, -1, -1, scale, scale, STYLE_Translucent, 0xffffffff, TRANSLATION(Translation_Remap, 21));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -374,9 +374,9 @@ public:
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
auto key = tileGetTexture(ACCESS_ICON);
|
auto key = tileGetTexture(ACCESS_ICON);
|
||||||
if (p->keys[3]) DrawGraphic(key, 138, top + 13, DI_ITEM_OFFSETS, 1, -1, -1, scale, scale, 0xffffffff, TRANSLATION(Translation_Remap, 23));
|
if (p->keys[3]) DrawGraphic(key, 138, top + 13, DI_ITEM_OFFSETS, 1, -1, -1, scale, scale, STYLE_Translucent, 0xffffffff, TRANSLATION(Translation_Remap, 23));
|
||||||
if (p->keys[2]) DrawGraphic(key, 152, top + 13, DI_ITEM_OFFSETS, 1, -1, -1, scale, scale, 0xffffffff, TRANSLATION(Translation_Remap, 21));
|
if (p->keys[2]) DrawGraphic(key, 152, top + 13, DI_ITEM_OFFSETS, 1, -1, -1, scale, scale, STYLE_Translucent, 0xffffffff, TRANSLATION(Translation_Remap, 21));
|
||||||
if (p->keys[1]) DrawGraphic(key, 145, top + 21, DI_ITEM_OFFSETS, 1, -1, -1, scale, scale, 0xffffffff, TRANSLATION(Translation_Remap, 0));
|
if (p->keys[1]) DrawGraphic(key, 145, top + 21, DI_ITEM_OFFSETS, 1, -1, -1, scale, scale, STYLE_Translucent, 0xffffffff, TRANSLATION(Translation_Remap, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
int num = (p->GetActor()->s->pal == 1 && p->last_extra < 2) ? 1 : p->last_extra;
|
int num = (p->GetActor()->s->pal == 1 && p->last_extra < 2) ? 1 : p->last_extra;
|
||||||
|
|
|
@ -216,7 +216,7 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
font_pic = font_base[color] + (ch - '0');
|
font_pic = font_base[color] + (ch - '0');
|
||||||
DrawGraphic(tileGetTexture(font_pic), x, ys, DI_ITEM_LEFT_TOP, 1, -1, -1, 1, 1, shadeToLight(shade));
|
DrawGraphic(tileGetTexture(font_pic), x, ys, DI_ITEM_LEFT_TOP, 1, -1, -1, 1, 1, STYLE_Translucent, shadeToLight(shade));
|
||||||
x += tileWidth(font_pic) + 1;
|
x += tileWidth(font_pic) + 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -651,7 +651,7 @@ private:
|
||||||
|
|
||||||
for (i = 0, x = COMPASS_X; i < 10; i++)
|
for (i = 0, x = COMPASS_X; i < 10; i++)
|
||||||
{
|
{
|
||||||
DrawGraphic(tileGetTexture(CompassPic[NORM_CANG(start_ang + i)]), x, COMPASS_Y, DI_ITEM_LEFT_TOP, 1, -1, -1, 1, 1, shadeToLight(CompassShade[i]));
|
DrawGraphic(tileGetTexture(CompassPic[NORM_CANG(start_ang + i)]), x, COMPASS_Y, DI_ITEM_LEFT_TOP, 1, -1, -1, 1, 1, STYLE_Translucent, shadeToLight(CompassShade[i]));
|
||||||
x += x_size;
|
x += x_size;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -722,7 +722,7 @@ class OptionMenuSliderBase : OptionMenuItem
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IsGrayed(void)
|
virtual bool IsGrayed(void)
|
||||||
{
|
{
|
||||||
return mGrayCheck != NULL && !mGrayCheck.GetInt();
|
return mGrayCheck != NULL && !mGrayCheck.GetInt();
|
||||||
}
|
}
|
||||||
|
|
|
@ -105,9 +105,9 @@ class StatusBarCore native ui
|
||||||
|
|
||||||
native static String FormatNumber(int number, int minsize = 0, int maxsize = 0, int format = 0, String prefix = "");
|
native static String FormatNumber(int number, int minsize = 0, int maxsize = 0, int format = 0, String prefix = "");
|
||||||
native double, double, double, double StatusbarToRealCoords(double x, double y=0, double w=0, double h=0);
|
native double, double, double, double StatusbarToRealCoords(double x, double y=0, double w=0, double h=0);
|
||||||
native void DrawTexture(TextureID texture, Vector2 pos, int flags = 0, double Alpha = 1., Vector2 box = (-1, -1), Vector2 scale = (1, 1));
|
native void DrawTexture(TextureID texture, Vector2 pos, int flags = 0, double Alpha = 1., Vector2 box = (-1, -1), Vector2 scale = (1, 1), ERenderStyle style = STYLE_Translucent);
|
||||||
native void DrawImage(String texture, Vector2 pos, int flags = 0, double Alpha = 1., Vector2 box = (-1, -1), Vector2 scale = (1, 1));
|
native void DrawImage(String texture, Vector2 pos, int flags = 0, double Alpha = 1., Vector2 box = (-1, -1), Vector2 scale = (1, 1), ERenderStyle style = STYLE_Translucent);
|
||||||
native void DrawString(HUDFont font, String string, Vector2 pos, int flags = 0, int translation = Font.CR_UNTRANSLATED, double Alpha = 1., int wrapwidth = -1, int linespacing = 4, Vector2 scale = (1, 1), int pt = 0);
|
native void DrawString(HUDFont font, String string, Vector2 pos, int flags = 0, int translation = Font.CR_UNTRANSLATED, double Alpha = 1., int wrapwidth = -1, int linespacing = 4, Vector2 scale = (1, 1), int pt = 0, ERenderStyle style = STYLE_Translucent);
|
||||||
native double, double, double, double TransformRect(double x, double y, double w, double h, int flags = 0);
|
native double, double, double, double TransformRect(double x, double y, double w, double h, int flags = 0);
|
||||||
native void Fill(Color col, double x, double y, double w, double h, int flags = 0);
|
native void Fill(Color col, double x, double y, double w, double h, int flags = 0);
|
||||||
native void SetClipRect(double x, double y, double w, double h, int flags = 0);
|
native void SetClipRect(double x, double y, double w, double h, int flags = 0);
|
||||||
|
|
Loading…
Reference in a new issue