All Projects → Rabios → Pancake

Rabios / Pancake

Licence: MIT License
Lightweight, Fast, Easy-to-use HTML5 2D game framework!

Programming Languages

javascript
184084 projects - #8 most used programming language
HTML
75241 projects
python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Pancake

Canvas2dtowebgl
Ports (almost) all Canvas2D functions to the GPU so it can be mixed with a WebGL canvas.
Stars: ✭ 206 (+160.76%)
Mutual labels:  webgl, canvas, canvas2d
Melonjs
a fresh & lightweight javascript game engine
Stars: ✭ 3,721 (+4610.13%)
Mutual labels:  webgl, canvas, canvas2d
Inputsystem
An efficient and versatile input system for Unity.
Stars: ✭ 1,013 (+1182.28%)
Mutual labels:  keyboard, touch, mouse
Pixi.js
The HTML5 Creation Engine: Create beautiful digital content with the fastest, most flexible 2D WebGL renderer.
Stars: ✭ 34,982 (+44181.01%)
Mutual labels:  webgl, canvas, canvas2d
React Event Components
🛰 A set of React components designed to handle global events (interval, keyboard, touch, mouse, etc)
Stars: ✭ 271 (+243.04%)
Mutual labels:  keyboard, touch, mouse
Gopher360
Gopher360 is a free zero-config app that instantly turns your Xbox 360, Xbox One, or even DualShock controller into a mouse and keyboard. Just download, run, and relax.
Stars: ✭ 566 (+616.46%)
Mutual labels:  keyboard, xbox, mouse
Xboxkeyboardmouse
Keyboard and mouse for Xbox One streaming on Windows 10
Stars: ✭ 235 (+197.47%)
Mutual labels:  keyboard, xbox, mouse
gotomation
No description or website provided.
Stars: ✭ 18 (-77.22%)
Mutual labels:  keyboard, mouse
SteamAchievementNotifier
Steam Achievement Notifier is an Electron application that shows a customisable notification when you unlock any Steam Achievement! It uses the Steam Web API to track achievement stats in real time, and displays an achievement summary within the notification.
Stars: ✭ 77 (-2.53%)
Mutual labels:  xbox, playstation
KeyLy
A powerfull and awesome Keylogger(Your keyboard and your mouse) realy helpfull for hackers! :-P (C/C++)
Stars: ✭ 17 (-78.48%)
Mutual labels:  keyboard, mouse
openinput
Open source firmware for input devices
Stars: ✭ 43 (-45.57%)
Mutual labels:  keyboard, mouse
Ayase
🥥 Control everything by keyboard. Built for hackers and the blind.
Stars: ✭ 53 (-32.91%)
Mutual labels:  keyboard, mouse
xcloud-keyboard-mouse
Chrome extension for controlling Xbox Cloud Gaming (Project xCloud) using a keyboard and mouse
Stars: ✭ 78 (-1.27%)
Mutual labels:  keyboard, xbox
hotscript
HotScript - Revolutionizing how Windows works.
Stars: ✭ 29 (-63.29%)
Mutual labels:  keyboard, mouse
Fairtris
Clone of the official classic Tetris® game for the NES console, intended for Windows and Linux systems. It implements the original mechanics and includes many regional versions and several RNGs (all in one executable).
Stars: ✭ 30 (-62.03%)
Mutual labels:  keyboard, desktop
YetAnotherKeyDisplayer
The application for displaying pressed keys of the keyboard
Stars: ✭ 88 (+11.39%)
Mutual labels:  keyboard, mouse
rasp vusb
This repo explains how to turn your Raspberry Pi Zero into USB Keyboard and Mouse. Also provides sample code and binaries to control them.
Stars: ✭ 85 (+7.59%)
Mutual labels:  keyboard, mouse
creviceapp
Multi purpose utility which supports gestures with mouse and keyboard.
Stars: ✭ 22 (-72.15%)
Mutual labels:  keyboard, mouse
input-event
🎹 Read and parse input device(like mouse, keyboard, joystick and IR-Remote)'s event data.
Stars: ✭ 45 (-43.04%)
Mutual labels:  keyboard, mouse
fabricjs-image-editor-origin
fabric.js javascript image editor
Stars: ✭ 52 (-34.18%)
Mutual labels:  canvas, canvas2d

Pancake


Lightweight, Fast, Easy-to-use HTML5 2D game framework!



Pancake is successor of Cake game engine, Which can be found here, But no longer maintained!

Pancake inspired by LOVE, Pygame, And even AppGameKit and it shares some of their concepts...

Features

  • Shares concepts of most lovable frameworks like LOVE, Pygame, And AppGameKit!
  • Easy and simple to setup!
  • Free, Moddable, Open-Source, Cross-Platform!
  • Fast, Very lightweight, And very thin in one file!
  • Every part needed is written without dependencies! From OS detection to gamepad support...
  • You can use CanvasRenderingContext2D or WebGLRenderingContext as graphics renderer!
  • Collision detection physics!
  • Audio based on HTMLAudio API!
  • Video rendering support!
  • Replay rewind support!
  • Spritefonts and Sprites support!
  • Have plugins can be used like WASM, FBInstant, And more...
  • Written in plain JavaScript (Vanilla JavaScript) to support browsers that can't run modern JavaScript! (Internet Explorer for example)
  • Supports Haxe via Pancake.hx
  • Using indexes (Slots), Which can be good for ordering sometimes, And gives easy control of game content!
  • Optimized for js13kGames game jam!

Want to know a lot? See the documentation

Also check out our Discord server here

Examples

  • Creating a game canvas
// Create canvas with both width and height of 600, And set it's index to 0
pancake.canvas.create(600, 600, 0);

// Create context with index 0 and set to use canvas that has index 0
// And set graphics to use context with index 0
pancake.context.create(0, 0);
pancake.graphics.useContext(0);
  • Drawing text
// Create canvas with both width and height of 600, And set it's index to 0
pancake.canvas.create(600, 600, 0);

// Create context with index 0 and set to use canvas that has index 0
// And set graphics to use context with index 0
pancake.context.create(0, 0);
pancake.graphics.useContext(0);

// We can set font and it's size in pixels
pancake.graphics.setFont("Arial", 22);

// Draw text
pancake.graphics.text("Hello Pancake", 10, 10);
  • Drawing shapes
// Create canvas with both width and height of 600, And set it's index to 0
pancake.canvas.create(800, 800, 0);

// Create context with index 0 and set to use canvas that has index 0
// And set graphics to use context with index 0
pancake.context.create(0, 0);
pancake.graphics.useContext(0);

// Draw rectangle with red color
pancake.graphics.color(pancake.graphics.RGB(255, 0, 0));
pancake.graphics.rect(100, 100, 50, 50);

// Draw circle with radius of 50 and orange color
pancake.graphics.color(pancake.graphics.RGB(255, 165, 0));
pancake.graphics.circle(200, 200, 50);

// Draw line with width of 5 and yellow color
pancake.graphics.color(pancake.graphics.RGB(255, 255, 0));
pancake.graphics.line(100, 100, 200, 200, 5);

// Set drawing mode to stroke
pancake.graphics.mode = pancake.graphics.STROKE;

// Draw triangle with green color
pancake.graphics.color(pancake.graphics.RGB(0, 255, 0));
pancake.graphics.triangle(500, 50, 600, 50, 500, 150);

// Draw polygon with 6 sides and blue color
pancake.graphics.color(pancake.graphics.RGB(0, 0, 255));

pancake.graphics.polygon(100, 300, 50, 6);
  • Playing Audio
// When audio loaded, Play it directly
pancake.audio.play("game.mp3");

// Load audio file to index 0
pancake.audio.load("loaded.mp3", 0);

// Plays loaded.mp3
pancake.audio.playFromIndex(0);

// Pauses loaded.mp3
pancake.audio.pause(0);

// Resumes loaded.mp3
pancake.audio.playFromIndex(0);
  • Saving variables
// Save score to localStorage variable "score"
pancake.storage.save("score", Number(0));

// Load it,It gives score value which is 0
var score = Number(pancake.storage.load("score"));
  • Physics + Game Loop
var playercolor = pancake.graphics.RGB(0, 0, 255);

// Use a HTML <canvas> tags that has ID "canvas"
// And set index of the context that will use it to 0
pancake.context.use(document.getElementById("canvas"), 0);

// Create 2 rectangles objects
var rect1 = { x: 100, y: 100, w: 50, h: 50 };
var rect2 = { x: 125, y: 125, w: 50, h: 50 };

function game() {
    // Clear canvas
    pancake.graphics.clear();

    // Draw first rectangle
    pancake.graphics.color(playercolor);
    pancake.graphics.rect(rect1.x, rect1.y, rect1.w, rect1.h);
    
    // Draw second rectangle
    pancake.graphics.color(pancake.graphics.RGB(0, 255, 0));
    pancake.graphics.rect(rect2.x, rect2.y, rect2.w, rect2.h);

    // Check collision between both 2 rectangles
    // If true then change color of first rectangle
    // Else then reset it's color to the default color
    if (pancake.physics.checkCollisionRecs(rect1.x, rect1.y, rect1.w, rect1.h, rect2.x, rect2.y, rect2.w, rect2.h)) {
        playercolor = pancake.graphics.RGB(255, 0, 0);
    } else {
        playercolor = pancake.graphics.RGB(0, 0, 255);
    }   
}

var gameloop = pancake.timers.timer(game, 60); // Set frames per second to 60
  • Keyboard + Game Loop
function game() {
    // If key down
    if (pancake.input.keydown(pancake.input.key.X)) alert("Key down/press");

    // If key up
    if (pancake.input.keyup(pancake.input.key.C)) alert("Key up");

    // Needed to prevent input loop
    pancake.input.preventLoop();
}

var gameloop = pancake.timers.timer(game, 60); // Set frames per second to 60

NOTE: More examples can be found in the Examples folder

Build

Build using Python:

mkdir pancake
cd pancake
git clone https://github.com/Rabios/Pancake.git
python build.py

A folder named build will created (if not exist) in the repository folders, Containing pancake.js, Which is the full build.

For more info about building Pancake see here.

License

MIT License

Copyright (c) 2020 - 2022 Rabia Alhaffar

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].