Include these two functions
function loadPixels() {
const imageData = ctx().getImageData(0, 0, W, H);
const pixels = imageData.data
pixels.parent = imageData
return pixels
/** | |
* Handle any browser error. Useful while developing. | |
* | |
* @author Luiz Bills <[email protected]> | |
* @licese MIT | |
* @version 1.1 | |
* | |
* @param {(message: string, event: Event) => void} callback A function called when an error happens | |
* @returns {function} A function to remove the event listeners | |
*/ |
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>JS Bin</title> | |
<link | |
rel="stylesheet" | |
href="https://cdn.jsdelivr.net/npm/@picocss/pico@2/css/pico.min.css" | |
> |
let str = "" | |
litecanvas() | |
// create a invisible input | |
const input = document.createElement("input") | |
document.body.append(input) | |
input.style.cssText = "position:absolute;transform:translate(-99999px,-99999px)" | |
function tapped(tapx, tapy) { |
const date = () => { | |
const offset = (new Date()).getTimezoneOffset() | |
return new Date(Date.now() - (offset*60*1000)).toISOString().split('T')[0] | |
} |
// Rot.js' Roguelike tutorial with Litecanvas: https://roguebasin.com/index.php/Rot.js_tutorial | |
// Copy and paste this code in https://litecanvas.js.org/ | |
litecanvas({ | |
width: 640, | |
loop: { init, update, draw }, | |
}) | |
let mapSize = { w: 40, h: 30 }, | |
map = {}, |
litecanvas(); | |
use(pluginDoubleTap) | |
const actor = {} | |
function init() { | |
actor.x = W/2 | |
actor.y = H/2 |
litecanvas(); | |
const taps = new Map() | |
const actor = {} | |
function init() { | |
actor.x = W/2 | |
actor.y = H/2 | |
// on "swipe" move our actor |
litecanvas() | |
const DURATION = 2 // cooldown duration in seconds | |
let cooldown = 0 // current cooldown (0 = off) | |
let buttonSize | |
function init() { | |
buttonSize = W/8 | |
} |
<?php | |
/** | |
* Multiple administrator emails | |
* @author Luiz Bills | |
*/ | |
add_filter( 'option_admin_email', function ( $value ) { | |
global $pagenow; | |
$ignored_pages = [ 'options-general.php' ]; | |
if ( in_array( $pagenow, $ignored_pages, true ) ) { |