-
-
Notifications
You must be signed in to change notification settings - Fork 196
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(sdl2): add missing stubs #928
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -612,3 +612,60 @@ function resdl_SDL_WaitTimeoutEvent() { | |
function resdl_SDL_GL_SwapWindow() { | ||
// no op | ||
} | ||
|
||
// Provides: resdl_SDL_GetNumVideoDisplays | ||
function resdl_SDL_GetNumVideoDisplays() { | ||
return 1; | ||
} | ||
|
||
// Provides: resdl_SDL_GL_GetString | ||
function resdl_SDL_GL_GetString(value) { | ||
if (value) { | ||
return value.toString(); | ||
} else { | ||
return "" | ||
} | ||
} | ||
|
||
// Provides: resdl_SDL_GetWindowPixelFormat | ||
function resdl_SDL_GetWindowPixelFormat(_win) { | ||
return "SDL_PIXELFORMAT_ARGB8888"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure what we'd like to return here? Some sort of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wouldn't worry too much about getting this exactly right as I think the dummy stubs approach is fundamentally broken. There ought to be separate platform APIs for desktop, JS and mobile. More on that soon, but for now I'd suggest just going with whatever works short-term. |
||
} | ||
|
||
// Provides: resdl_SDL_GetPixelFormatName | ||
function resdl_SDL_GetPixelFormatName(value) { | ||
return "resdl_SDL_GetPixelFormatName: Not implemented"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here. |
||
} | ||
|
||
|
||
// Provides: resdl_SDL_GetLinkedVersion | ||
function resdl_SDL_GetLinkedVersion() { | ||
return 1; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here. |
||
} | ||
|
||
// Provides: resdl_SDL_GetScancodeFromName | ||
function resdl_SDL_GetScancodeFromName() { | ||
return "scancodeFromName"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Both this and There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
} | ||
|
||
// Provides: resdl_SDL_GetKeyFromName | ||
function resdl_SDL_GetKeyFromName() { | ||
return "keyFromname"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
} | ||
|
||
// Provides: resdl_SDL_GetCompiledVersion | ||
function resdl_SDL_GetCompiledVersion() { | ||
return "resdl_SDL_GetCompiledVersion: Not implemented"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🤷 |
||
} | ||
|
||
// Provides: resdl_SDL_GetDisplayBounds | ||
function resdl_SDL_GetDisplayBounds(display) { | ||
console.log("resdl_SDL_GetDisplayBounds, display:", display); | ||
|
||
return { | ||
x: 0, | ||
y: 0, | ||
height: joo_global_object.window.availHeight, | ||
width: joo_global_object.window.availWidth | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if we can get the the number of displays via the web api. Are we OK with simply returning 1 here?