implement humble_get_player_size
| | |
| | | */ |
| | | void humble_fetch_asset_data(const char* url, void *arg, em_async_wget_onload_func onload, em_arg_callback_func onerror); |
| | | |
| | | /** |
| | | * Gets the allowable player size of the humble player. Use this to restrict the size of the game in windowed mode. |
| | | * returns 1 if the restriction should be enforced.. 0 otherwise |
| | | */ |
| | | int humble_get_player_size(int& width, int& height); |
| | | |
| | | #ifdef __cplusplus |
| | | }; |
| | | #endif |
| | |
| | | locateAsset: null, // function(path) { return path; } |
| | | // takes a string key and returns a modified key. return null to NOT cache the specific resource |
| | | buildCacheKey: null, // function(path) { return path; } |
| | | // function returning a hash like {width: 800, height: 600, locked: true} |
| | | // locked specifies whether the game should ONLY use that width/height |
| | | playerSize: null // function() { return { width: 800, height: 600, locked: true } } |
| | | }, |
| | | |
| | | configure: function(options) { |
| | |
| | | if (onerror) Runtime.dynCall('vi', onerror, [arg]); |
| | | }, true /* NO run dependency */); |
| | | }); |
| | | }, |
| | | humble_get_player_size__deps: ['$HUMBLE_API'], |
| | | humble_get_player_size: function(w, h) { |
| | | var ret = {width: 0, height: 0, locked: false}; |
| | | if (HUMBLE_API.options.playerSize) { |
| | | ret = HUMBLE_API.options.playerSize(); |
| | | } |
| | | if (w) {{{ makeSetValue('w', '0', 'ret.width', 'i32') }}}; |
| | | if (h) {{{ makeSetValue('h', '0', 'ret.height', 'i32') }}}; |
| | | return ret.locked ? 1 : 0; |
| | | } |
| | | }; |
| | | |
| | |
| | | // call dummy function to init cloud |
| | | humble_init(); |
| | | |
| | | int w, h; |
| | | int ret = humble_get_player_size(w, h); |
| | | |
| | | std::cout << "HumblePlayerSize Enabled: " << ret << " @ ( " << w << ", " << h << " )\n"; |
| | | |
| | | return 0; |
| | | } |
| | |
| | | }; |
| | | }; |
| | | Module['preRun'].push(function() { |
| | | // configure HUMBLE_API |
| | | HUMBLE_API.configure({ |
| | | applicationtoken: 'deadbeef', |
| | | playerSize: function() { |
| | | return { |
| | | width: 800, height: 600, locked: true |
| | | } |
| | | } |
| | | }); |
| | | }); |
| | | Module['preRun'].push(function() { |
| | | var provider_name = '@TEST_CLOUD_PROVIDER@'; |
| | | addRunDependency('CLOUDFS_setup'); |
| | | |