Skip to content

Commit

Permalink
Beta 23
Browse files Browse the repository at this point in the history
  • Loading branch information
morgan3d committed Jan 17, 2020
1 parent 802a049 commit 399e771
Show file tree
Hide file tree
Showing 23 changed files with 5,128 additions and 161 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
__pycache__/
*.py[cod]
*~
#*
6 changes: 4 additions & 2 deletions console/quadplay-ide.js
Original file line number Diff line number Diff line change
Expand Up @@ -443,8 +443,10 @@ function onSlowButton() {
}

// Allows a framerate to be specified so that the slow button can re-use the logic.
//
// isLaunchGame = "has this been triggered by QRuntime.launchGame()"
function onPlayButton(slow, isLaunchGame) {
// args = array of arguments to pass to the new program
function onPlayButton(slow, isLaunchGame, args) {
if (isSafari && ! isMobile) { unlockAudio(); }

testPost();
Expand Down Expand Up @@ -2097,7 +2099,7 @@ function mainLoopStep() {
} else if (e.launchGame !== undefined) {
loadGameIntoIDE(e.launchGame, function () {
onResize();
onPlayButton(false, true);
onPlayButton(false, true, e.args);
});
} else {
// Runtime error
Expand Down
21 changes: 13 additions & 8 deletions console/quadplay-load.js
Original file line number Diff line number Diff line change
Expand Up @@ -455,11 +455,13 @@ function loadFont(name, json, jsonURL) {
const shadowSize = parseInt(json.shadowSize || 1);

packFont(font, borderSize, shadowSize, json.baseline, json.charSize, Object.freeze({x: json.letterSpacing.x, y: json.letterSpacing.y}), srcMask);

resourceStats.spritePixels += font._data.width * font._data.height;
++resourceStats.spritesheets;
resourceStats.maxSpritesheetWidth = Math.max(resourceStats.maxSpritesheetWidth, font._data.width);
resourceStats.maxSpritesheetHeight = Math.max(resourceStats.maxSpritesheetHeight, font._data.height);

if (name[0] !== '_') {
resourceStats.spritePixels += font._data.width * font._data.height;
++resourceStats.spritesheets;
resourceStats.maxSpritesheetWidth = Math.max(resourceStats.maxSpritesheetWidth, font._data.width);
resourceStats.maxSpritesheetHeight = Math.max(resourceStats.maxSpritesheetHeight, font._data.height);
}

Object.freeze(font);
}, loadFailureCallback, loadWarningCallback, forceReload);
Expand Down Expand Up @@ -586,7 +588,7 @@ function loadSpritesheet(name, json, jsonURL, callback, noForce) {
region.size.y = Math.min(image.height - region.pos.y, region.size.y);

const cacheName = json.url + JSON.stringify(region);
if (! alreadyCountedSpritePixels[cacheName]) {
if (! alreadyCountedSpritePixels[cacheName] && name[0] !== '_') {
alreadyCountedSpritePixels[cacheName] = true;
resourceStats.spritePixels += region.size.x * region.size.y;
++resourceStats.spritesheets;
Expand Down Expand Up @@ -808,7 +810,7 @@ function loadSpritesheet(name, json, jsonURL, callback, noForce) {
const soundCache = {};

function loadSound(name, json, jsonURL) {
++resourceStats.sounds;
if (name[0] !== '_') { ++resourceStats.sounds; }
const forceReload = computeForceReloadFlag(json.url);

let sound;
Expand Down Expand Up @@ -1055,7 +1057,10 @@ function addCodeToSourceStats(code, scriptURL) {
// Remove blank lines
code = code.replace(/\n\s*\n/g, '\n');

resourceStats.sourceStatements += Math.max(0, (code.split(';').length - 1) + (code.split('\n').length - 1) - 1);
// Ignore statements from system files
if (scriptURL.replace(/^.*\//, '')[0] !== '_') {
resourceStats.sourceStatements += Math.max(0, (code.split(';').length - 1) + (code.split('\n').length - 1) - 1);
}
}


Expand Down
4 changes: 4 additions & 0 deletions console/quadplay-runtime.js
Original file line number Diff line number Diff line change
Expand Up @@ -3930,6 +3930,10 @@ function drawText(font, str, P, color, shadow, outline, xAlign, yAlign, z, wrapW
font = font.font;
}

if (font === undefined) {
throw new Error('drawText() requires a font');
}

if (P === undefined) {
throw new Error('drawText() requires a pos');
}
Expand Down
3 changes: 0 additions & 3 deletions console/quadplay.css
Original file line number Diff line number Diff line change
Expand Up @@ -670,9 +670,6 @@ body.EmulatorUI .virtualController {
}

canvas#screen {
top: 0px;
left: 0px;
position: absolute;
background: #000;
z-index: 30;
}
Expand Down
Binary file added doc/joy-con.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 399e771

Please sign in to comment.