1
0
mirror of https://github.com/Interlisp/maiko.git synced 2026-02-04 07:33:07 +00:00

Merge pull request #467 from Interlisp/sdl

Bring SDL into master branch
This commit is contained in:
Nick Briggs
2023-05-31 14:44:04 -07:00
committed by GitHub
30 changed files with 1266 additions and 143 deletions

View File

@@ -18,9 +18,11 @@
#include "lispemul.h" // for LispPTR, DLword, ATOM_T, NIL
#include "lispmap.h" // for S_POSITIVE
#include "lsptypes.h" // for GETWORD
#ifdef XWINDOW
#if defined(XWINDOW)
#include "xcursordefs.h" // for Set_XCursor
#include "xlspwindefs.h" // for lisp_Xvideocolor, set_Xmouseposition
#elif defined(SDL)
#include "sdldefs.h"
#endif
extern int DebugDSP;
@@ -69,6 +71,13 @@ LispPTR DSP_VideoColor(LispPTR *args) /* args[0] : black flag */
return ATOM_T;
else
return NIL;
#elif defined(SDL)
invert = args[0] & 0xFFFF;
sdl_set_invert(invert);
if (invert)
return ATOM_T;
else
return NIL;
#else
return NIL;
#endif
@@ -92,9 +101,11 @@ void DSP_Cursor(LispPTR *args, int argnum)
extern int LastCursorX, LastCursorY;
#ifdef XWINDOW
#if defined(XWINDOW)
/* For X-Windows, set the cursor to the given location. */
Set_XCursor((int)(args[0] & 0xFFFF), (int)(args[1] & 0xFFFF));
#elif defined(SDL)
sdl_setCursor((int)(args[0] & 0xFFFF), (int)(args[1] & 0xFFFF));
#endif /* XWINDOW */
}
@@ -114,6 +125,11 @@ void DSP_SetMousePos(LispPTR *args)
if (Mouse_Included)
set_Xmouseposition((int)(GetSmalldata(args[0])), (int)(GetSmalldata(args[1])));
#endif /* XWINDOW */
#ifdef SDL
int x = (int)(GetSmalldata(args[0]));
int y = (int)(GetSmalldata(args[1]));
sdl_setMousePosition(x, y);
#endif /* SDL */
}
/****************************************************
@@ -174,8 +190,10 @@ void flip_cursor(void) {
#endif
#ifdef XWINDOW
#if defined(XWINDOW)
/* JDS 011213: 15- cur y, as function does same! */
Set_XCursor(Current_Hot_X, 15 - Current_Hot_Y);
#elif defined(SDL)
sdl_setCursor(0, 0); // TODO: keep track of the current hot_x and hot_y
#endif /* XWINDOW */
}