Skip to content

Commit

Permalink
Add shreder95ua/resolution extension (#836)
Browse files Browse the repository at this point in the history
  • Loading branch information
tehbarney86 committed Aug 26, 2023
1 parent a23d7ea commit 73ef564
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 0 deletions.
1 change: 1 addition & 0 deletions extensions/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"NexusKitten/moremotion",
"CubesterYT/WindowControls",
"veggiecan/browserfullscreen",
"shreder95ua/resolution",
"navigator",
"battery",
"TheShovel/CustomStyles",
Expand Down
39 changes: 39 additions & 0 deletions extensions/shreder95ua/resolution.js
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);
1 change: 1 addition & 0 deletions images/shreder95ua/resolution.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 73ef564

Please sign in to comment.