Skip to content

Instantly share code, notes, and snippets.

View JetLua's full-sized avatar
🍉

JetLu JetLua

🍉
View GitHub Profile
@JetLua
JetLua / Qt.pro
Last active April 9, 2017 15:53
Qt(vs)设置
INCLUDEPATH += "D:\portable\vs\vc\include" \
"D:\portable\vs\sdk\Include\shared" \
"D:\portable\vs\sdk\Include\ucrt" \
"D:\portable\vs\sdk\Include\um" \
"D:\portable\vs\sdk\Include\winrt"
LIBS += -L"D:\portable\vs\vc\lib\amd64" \
-L"D:\portable\vs\sdk\Lib\um\x64" \
-L"D:\portable\vs\sdk\Lib\ucrt\x64"
@JetLua
JetLua / orientation.js
Last active June 9, 2024 14:55
pixijs 屏幕自适应
const resize = () => {
let
w = window.innerWidth,
h = window.innerHeight,
l, t
// 横屏
if (window.innerWidth / window.innerHeight >= 1) {
view.style.transform = 'rotate(0)'
window.GAME_ROTATE = 0
if (window.innerWidth / window.innerHeight >= GAME_RATIO) {
PIXI.interaction.InteractionManager.prototype.mapPositionToPoint = function(point, x, y) {
let rect
// IE 11 fix
if (!this.interactionDOMElement.parentElement) {
rect = {x: 0, y: 0, width: 0, height: 0}
} else {
rect = this.interactionDOMElement.getBoundingClientRect()
}
@JetLua
JetLua / gulpfile.js
Created June 15, 2017 04:14
编译`bootstrap`用的。
const
gulp = require('gulp'),
autoprefixer = require('gulp-autoprefixer'),
sass = require('gulp-sass'),
minify = require('gulp-minify-css')
gulp.task('default', function() {
gulp.src('bootstrap.scss')
.pipe(sass())
.pipe(autoprefixer())
@JetLua
JetLua / phaser.pointer.js
Last active May 6, 2018 17:35
phaser 旋转画布后的点击事件映射
// game.rotation: 画布的旋转角度,可简化为landscape | portrait
Object.defineProperties(phaser.Input.Pointer.prototype, {
x: {
get() {
return config.landscape ? this.position.y / this.manager.bounds.width * this.manager.bounds.height : this.position.x
},
set(v) {
this.position.x = v
export default class Layout extends PIXI.Container {
static GRID = 2
static VERTICAL = 1
static HORIZONTAL = 0
#added = false
constructor(option = {}) {
const {
gap,
function sort<T>(list: Array<T>, cmp?: (a: T, b: T) => number) {
const {length} = list
if (length < 2) return list
cmp ??= (x, y) => (x as unknown as number) - (y as unknown as number)
let unit = 1
let results = [] as Array<T>
while (length > unit) {
@JetLua
JetLua / random.js
Last active February 18, 2019 15:31
let seed = 1
function seededRandom(max = 1, min = 0) {
seed = (seed * 9301 + 49297) % 233280;
let rnd = seed / 233280.0;
return min + rnd * (max - min);
/***
* ┌───┐ ┌───┬───┬───┬───┐ ┌───┬───┬───┬───┐ ┌───┬───┬───┬───┐ ┌───┬───┬───┐
* │Esc│ │ F1│ F2│ F3│ F4│ │ F5│ F6│ F7│ F8│ │ F9│F10│F11│F12│ │P/S│S L│P/B│ ┌┐ ┌┐ ┌┐
* └───┘ └───┴───┴───┴───┘ └───┴───┴───┴───┘ └───┴───┴───┴───┘ └───┴───┴───┘ └┘ └┘ └┘
* ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ ┌───┬───┬───┐ ┌───┬───┬───┬───┐
* │~ `│! 1│@ 2│# 3│$ 4│% 5│^ 6│& 7│* 8│( 9│) 0│_ -│+ =│ BacSp │ │Ins│Hom│PUp│ │N L│ / │ * │ - │
* ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ ├───┼───┼───┤ ├───┼───┼───┼───┤
* │ Tab │ Q │ W │ E │ R │ T │ Y │ U │ I │ O │ P │{ [│} ]│ | \ │ │Del│End│PDn│ │ 7 │ 8 │ 9 │ │
* ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴─────┤ └───┴───┴───┘ ├───┼───┼───┤ + │
* │ Caps │ A │ S │ D │ F │ G │ H │ J │ K │ L │: ;│" '│ Enter │ │ 4 │ 5 │ 6 │ │
#define NUM_OCTAVES 3
precision highp float;
varying vec2 vTextureCoord;
uniform sampler2D uSampler;
uniform vec4 inputSize;
uniform float t;