- deal with I_SetCursor

This commit is contained in:
Christoph Oelckers 2020-04-15 19:49:06 +02:00
parent c605359b0e
commit 397b1520bc
6 changed files with 13 additions and 13 deletions

View file

@ -235,15 +235,15 @@ CUSTOM_CVAR (String, vid_cursor, "None", CVAR_ARCHIVE | CVAR_NOINITCALL)
if (!stricmp(self, "None" ) && gameinfo.CursorPic.IsNotEmpty()) if (!stricmp(self, "None" ) && gameinfo.CursorPic.IsNotEmpty())
{ {
res = I_SetCursor(TexMan.GetTextureByName(gameinfo.CursorPic)); res = I_SetCursor(TexMan.GetGameTextureByName(gameinfo.CursorPic));
} }
else else
{ {
res = I_SetCursor(TexMan.GetTextureByName(self)); res = I_SetCursor(TexMan.GetGameTextureByName(self));
} }
if (!res) if (!res)
{ {
I_SetCursor(TexMan.GetTextureByName("cursor")); I_SetCursor(TexMan.GetGameTextureByName("cursor"));
} }
} }

View file

@ -798,7 +798,7 @@ CUSTOM_CVAR(Bool, vid_hidpi, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_NOINI
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
bool I_SetCursor(FTexture *cursorpic) bool I_SetCursor(FGameTexture *cursorpic)
{ {
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init]; NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
NSCursor* cursor = nil; NSCursor* cursor = nil;
@ -807,7 +807,7 @@ bool I_SetCursor(FTexture *cursorpic)
{ {
// Create bitmap image representation // Create bitmap image representation
auto sbuffer = cursorpic->CreateTexBuffer(0); auto sbuffer = cursorpic->GetTexture()->CreateTexBuffer(0);
const NSInteger imageWidth = sbuffer.mWidth; const NSInteger imageWidth = sbuffer.mWidth;
const NSInteger imageHeight = sbuffer.mHeight; const NSInteger imageHeight = sbuffer.mHeight;

View file

@ -97,8 +97,8 @@ TArray<FString> I_GetGogPaths();
// The ini could not be saved at exit // The ini could not be saved at exit
bool I_WriteIniFailed (); bool I_WriteIniFailed ();
class FTexture; class FGameTexture;
bool I_SetCursor(FTexture *); bool I_SetCursor(FGameTexture *);
static inline char *strlwr(char *str) static inline char *strlwr(char *str)

View file

@ -39,14 +39,14 @@
#include "v_palette.h" #include "v_palette.h"
#include "textures.h" #include "textures.h"
bool I_SetCursor(FTexture *cursorpic) bool I_SetCursor(FGameTexture *cursorpic)
{ {
static SDL_Cursor *cursor; static SDL_Cursor *cursor;
static SDL_Surface *cursorSurface; static SDL_Surface *cursorSurface;
if (cursorpic != NULL && cursorpic->isValid()) if (cursorpic != NULL && cursorpic->isValid())
{ {
auto src = cursorpic->GetBgraBitmap(nullptr); auto src = cursorpic->GetTexture()->GetBgraBitmap(nullptr);
// Must be no larger than 32x32. // Must be no larger than 32x32.
if (src.GetWidth() > 32 || src.GetHeight() > 32) if (src.GetWidth() > 32 || src.GetHeight() > 32)
{ {

View file

@ -638,13 +638,13 @@ int I_PickIWad(WadStuff *wads, int numwads, bool showwin, int defaultiwad)
// //
//========================================================================== //==========================================================================
bool I_SetCursor(FTexture *cursorpic) bool I_SetCursor(FGameTexture *cursorpic)
{ {
HCURSOR cursor; HCURSOR cursor;
if (cursorpic != NULL && cursorpic->isValid()) if (cursorpic != NULL && cursorpic->isValid())
{ {
auto image = cursorpic->GetBgraBitmap(nullptr); auto image = cursorpic->GetTexture()->GetBgraBitmap(nullptr);
// Must be no larger than 32x32. (is this still necessary? // Must be no larger than 32x32. (is this still necessary?
if (image.GetWidth() > 32 || image.GetHeight() > 32) if (image.GetWidth() > 32 || image.GetHeight() > 32)
{ {

View file

@ -79,8 +79,8 @@ void I_Quit (void);
// Set the mouse cursor. The texture must be 32x32. // Set the mouse cursor. The texture must be 32x32.
class FTexture; class FGameTexture;
bool I_SetCursor(FTexture *cursor); bool I_SetCursor(FGameTexture *cursor);
// Repaint the pre-game console // Repaint the pre-game console
void I_PaintConsole (void); void I_PaintConsole (void);