-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmediacanvas.js
More file actions
28 lines (24 loc) · 807 Bytes
/
mediacanvas.js
File metadata and controls
28 lines (24 loc) · 807 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// Fullscreen canvas. Useful for games.
// USAGE: mediacanvas_fullscreen(document.getElementById("myCanvas"));
function mediacanvas_fullscreen(c) {
// Resize canvas to window size
c.width = window.innerWidth;
c.height = window.innerHeight;
// Remove HTML/BODY margin
document.body.style.margin = 0;
document.body.parentElement.style.margin = 0;
return true;
}
// Set canvas cursor. Useful for UI elements.
// USAGE: mediacanvas_setcursor(document.getElementById("myCanvas"),"pointer");
function mediacanvas_setcursor(c,cursor) {
c.style.cursor = cursor;
return true;
}
// Resize. Useful for resizing windows, perhaps.
// USAGE: mediacanvas_resize(document.getElementById("myCanvas"),640,480);
function mediacanvas_setcursor(c,w,h) {
c.width = w;
c.height = h;
return true;
}