-
Notifications
You must be signed in to change notification settings - Fork 232
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add shreder95ua/resolution extension (#836)
- Loading branch information
1 parent
a23d7ea
commit 73ef564
Showing
3 changed files
with
41 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// Name: Screen Resolution | ||
// ID: shreder95resolution | ||
// Description: Get the resolution of the primary screen. | ||
// By: shreder95ua <https://scratch.mit.edu/users/shreder95ua/> | ||
|
||
(function (Scratch) { | ||
"use strict"; | ||
|
||
class Resolution { | ||
getInfo() { | ||
return { | ||
id: "shreder95resolution", | ||
name: "Screen resolution", | ||
color1: "#FFAB19", | ||
color2: "#EC9C13", | ||
color3: "#CF8B17", | ||
blocks: [ | ||
{ | ||
opcode: "getWidth", | ||
text: "primary screen width", | ||
blockType: Scratch.BlockType.REPORTER, | ||
}, | ||
{ | ||
opcode: "getHeight", | ||
text: "primary screen height", | ||
blockType: Scratch.BlockType.REPORTER, | ||
}, | ||
], | ||
}; | ||
} | ||
getWidth() { | ||
return window.screen.width; | ||
} | ||
getHeight() { | ||
return window.screen.height; | ||
} | ||
} | ||
Scratch.extensions.register(new Resolution()); | ||
})(Scratch); |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.