15 changed files with 122 additions and 4291 deletions
@ -0,0 +1,11 @@
|
||||
#pragma once |
||||
|
||||
namespace dvl { |
||||
extern "C" { |
||||
|
||||
extern DWORD nLastError; |
||||
|
||||
void TranslateFileName(char *dst, int dstLen, const char *src); |
||||
|
||||
} |
||||
} // namespace dvl
|
||||
@ -1,4 +1,4 @@
|
||||
#include "miniwin_dsound.h" |
||||
#include "miniwin/dsound.h" |
||||
|
||||
#include <SDL.h> |
||||
|
||||
@ -0,0 +1,45 @@
|
||||
#include <SDL.h> |
||||
|
||||
#include "devilution.h" |
||||
#include "dx.h" |
||||
#include "stubs.h" |
||||
|
||||
namespace dvl { |
||||
|
||||
WINBOOL SetCursorPos(int X, int Y) |
||||
{ |
||||
assert(renderer); |
||||
assert(window); |
||||
|
||||
SDL_Rect view; |
||||
SDL_RenderGetViewport(renderer, &view); |
||||
X += view.x; |
||||
Y += view.y; |
||||
|
||||
float scaleX; |
||||
SDL_RenderGetScale(renderer, &scaleX, NULL); |
||||
X *= scaleX; |
||||
Y *= scaleX; |
||||
|
||||
SDL_WarpMouseInWindow(window, X, Y); |
||||
return true; |
||||
} |
||||
|
||||
int ShowCursor(WINBOOL bShow) |
||||
{ |
||||
SDL_ShowCursor(bShow ? SDL_ENABLE : SDL_DISABLE); |
||||
|
||||
return bShow; |
||||
} |
||||
|
||||
WINBOOL TextOutA(HDC hdc, int x, int y, LPCSTR lpString, int c) |
||||
{ |
||||
DUMMY_ONCE(); |
||||
|
||||
assert(window); |
||||
SDL_SetWindowTitle(window, lpString); |
||||
|
||||
return true; |
||||
} |
||||
|
||||
} // namespace dvl
|
||||
@ -0,0 +1,38 @@
|
||||
#include <SDL.h> |
||||
|
||||
#include "devilution.h" |
||||
#include "dx.h" |
||||
#include "stubs.h" |
||||
|
||||
namespace dvl { |
||||
|
||||
BOOL SDrawUpdatePalette(unsigned int firstentry, unsigned int numentries, PALETTEENTRY *pPalEntries, int a4) |
||||
{ |
||||
assert(firstentry == 0); |
||||
assert(numentries == 256); |
||||
|
||||
SDL_Color colors[256]; |
||||
for (unsigned int i = firstentry; i < numentries; i++) { |
||||
SDL_Color *c = &colors[i]; |
||||
PALETTEENTRY *p = &pPalEntries[i]; |
||||
c->r = p->peRed; |
||||
c->g = p->peGreen; |
||||
c->b = p->peBlue; |
||||
c->a = SDL_ALPHA_OPAQUE; |
||||
} |
||||
|
||||
assert(palette); |
||||
if (SDL_SetPaletteColors(palette, colors, firstentry, numentries) != 0) { |
||||
SDL_Log("SDL_SetPaletteColors: %s\n", SDL_GetError()); |
||||
return false; |
||||
} |
||||
|
||||
if (pal_surface) { |
||||
sdl_update_entire_surface(); |
||||
sdl_present_surface(); |
||||
} |
||||
|
||||
return true; |
||||
} |
||||
|
||||
} // namespace dvl
|
||||
Loading…
Reference in new issue