Cleanup portability.md to only include cross-platform backends, add CC_BUILD_NOAUDIO instead of hardcoding no audio only to web client

This commit is contained in:
UnknownShadow200 2019-11-05 10:59:57 +11:00
parent 9b49b67aa6
commit f0fc77351b
4 changed files with 9 additions and 13 deletions

View File

@ -61,6 +61,7 @@ I don't really test these platforms at all, only when I suspect some changes to
Listed below are the requirements for implementing each platform-dependent file. Listed below are the requirements for implementing each platform-dependent file.
You should try to take advantage of existing backends when porting to other platforms. You should try to take advantage of existing backends when porting to other platforms.
Only cross platform backends are listed below.
### Platform ### Platform
General platform specific functionality. General platform specific functionality.
@ -76,7 +77,6 @@ General platform specific functionality.
- Encrypt/decrypt data, getting command line args - Encrypt/decrypt data, getting command line args
Define: Define:
- ```CC_BUILD_WIN``` - Use Win32 API (Windows)
- ```CC_BUILD_POSIX``` - Use posix API - ```CC_BUILD_POSIX``` - Use posix API
posix note: Some functions are not covered. (stopwatch, getting exe path, open url in browser) posix note: Some functions are not covered. (stopwatch, getting exe path, open url in browser)
@ -88,11 +88,8 @@ Create a window, show a dialog window, set window contents, keyboard/mouse input
Also monitor size, clipboard, cursor, raw relative mouse movement (optional) Also monitor size, clipboard, cursor, raw relative mouse movement (optional)
Define: Define:
- ```CC_BUILD_WINGUI``` - Use Win32 API (Windows) (WGL)
- ```CC_BUILD_CARBON``` - Use Carbon (Mac OSX) (AGL)
- ```CC_BUILD_X11``` - Use X11/XLib (unix-ish) (glX) - ```CC_BUILD_X11``` - Use X11/XLib (unix-ish) (glX)
- ```CC_BUILD_SDL``` - Use SDL library (SDL) - ```CC_BUILD_SDL``` - Use SDL library (SDL)
- ```CC_BUILD_WEBCANVAS``` - Use emscripten canvas (WebGL)
If using OpenGL, also OpenGL context management If using OpenGL, also OpenGL context management
@ -100,8 +97,7 @@ If using OpenGL, also OpenGL context management
Dump registers and backtrace, log unhandled errors (e.g. invalid memory read) Dump registers and backtrace, log unhandled errors (e.g. invalid memory read)
Define: Define:
- ```CC_BUILD_WIN``` - Use Win32 api - ```CC_BUILD_POSIX``` - use POSIX api
- ```CC_BUILD_POSIX``` - Use POSIX api
posix note: Register access is highly dependent on OS and architecture. posix note: Register access is highly dependent on OS and architecture.
@ -111,8 +107,8 @@ posix note: Register access is highly dependent on OS and architecture.
Play multiple audio streams with varying sample rates Play multiple audio streams with varying sample rates
Define: Define:
- ```CC_BUILD_WINMM``` - Use WinMM (Windows) - ```CC_BUILD_OPENAL``` - use OpenAL
- ```CC_BUILD_OpenAL``` - Use OpenAL - ```CC_BUILD_NOAUDIO``` - stub audio implementation (silent)
### 3D Graphics ### 3D Graphics
Texturing, depth buffer, alpha, etc (See Graphics.h for full list) Texturing, depth buffer, alpha, etc (See Graphics.h for full list)
@ -128,7 +124,6 @@ Define:
HTTP, HTTPS, and setting request/getting response headers HTTP, HTTPS, and setting request/getting response headers
Define: Define:
- ```CC_BUILD_WININET``` - use WinINet for http (Windows)
- ```CC_BUILD_CURL``` - use libcurl for http - ```CC_BUILD_CURL``` - use libcurl for http
Supporting connection reuse is highly recommended. (but not required) Supporting connection reuse is highly recommended. (but not required)

View File

@ -16,7 +16,7 @@
int Audio_SoundsVolume, Audio_MusicVolume; int Audio_SoundsVolume, Audio_MusicVolume;
/* TODO: Fix for android */ /* TODO: Fix for android */
#if defined CC_BUILD_WEB || defined CC_BUILD_ANDROID #if defined CC_BUILD_NOAUDIO
/* Can't use mojang's sounds or music assets, so just stub everything out */ /* Can't use mojang's sounds or music assets, so just stub everything out */
static void Audio_Init(void) { } static void Audio_Init(void) { }
static void Audio_Free(void) { } static void Audio_Free(void) { }

View File

@ -155,6 +155,7 @@ typedef struct TextureRec_ { float U1, V1, U2, V2; } TextureRec;
#define CC_BUILD_GLMODERN #define CC_BUILD_GLMODERN
#define CC_BUILD_GLES #define CC_BUILD_GLES
#define CC_BUILD_TOUCH #define CC_BUILD_TOUCH
#define CC_BUILD_NOAUDIO
#elif defined __linux__ #elif defined __linux__
#define CC_BUILD_LINUX #define CC_BUILD_LINUX
#define CC_BUILD_POSIX #define CC_BUILD_POSIX
@ -207,8 +208,8 @@ typedef struct TextureRec_ { float U1, V1, U2, V2; } TextureRec;
#define CC_BUILD_GL #define CC_BUILD_GL
#define CC_BUILD_GLMODERN #define CC_BUILD_GLMODERN
#define CC_BUILD_GLES #define CC_BUILD_GLES
#define CC_BUILD_WEBCANVAS
#define CC_BUILD_TOUCH #define CC_BUILD_TOUCH
#define CC_BUILD_NOAUDIO
#endif #endif
#endif #endif

View File

@ -21,7 +21,7 @@ cc_bool Window_Exists, Window_Focused;
const void* Window_Handle; const void* Window_Handle;
cc_bool Window_SoftKeyboard; cc_bool Window_SoftKeyboard;
#ifndef CC_BUILD_WEBCANVAS #ifndef CC_BUILD_WEB
void Clipboard_RequestText(RequestClipboardCallback callback, void* obj) { void Clipboard_RequestText(RequestClipboardCallback callback, void* obj) {
String text; char textBuffer[512]; String text; char textBuffer[512];
String_InitArray(text, textBuffer); String_InitArray(text, textBuffer);
@ -2786,7 +2786,7 @@ void GLContext_SetFpsLimit(cc_bool vsync, float minFrameMs) {
/*########################################################################################################################* /*########################################################################################################################*
*------------------------------------------------Emscripten canvas window-------------------------------------------------* *------------------------------------------------Emscripten canvas window-------------------------------------------------*
*#########################################################################################################################*/ *#########################################################################################################################*/
#ifdef CC_BUILD_WEBCANVAS #ifdef CC_BUILD_WEB
#include <emscripten/emscripten.h> #include <emscripten/emscripten.h>
#include <emscripten/html5.h> #include <emscripten/html5.h>
#include <emscripten/key_codes.h> #include <emscripten/key_codes.h>