All Projects → Rabios → Pancake.hx

Rabios / Pancake.hx

Licence: MIT license
Haxe port of awesome HTML5 game framework Pancake!

Programming Languages

haxe
709 projects
HTML
75241 projects

Projects that are alternatives of or similar to Pancake.hx

skyengine
HTML5 2D Game Engine
Stars: ✭ 43 (+168.75%)
Mutual labels:  game-framework, html5-game-development
StbSharp
C# port of the famous C framework
Stars: ✭ 62 (+287.5%)
Mutual labels:  port
allegro flare
Application toolkit for Allegro 5
Stars: ✭ 30 (+87.5%)
Mutual labels:  game-framework
phaser-3-vsc-typescript-nodejs
Template for a new Phaser 3 project with Visual Studio Code, TypeScript, and Node.js.
Stars: ✭ 18 (+12.5%)
Mutual labels:  html5-game-development
badassquest
RPG / GTA-style game engine built on top of Google Maps Javascript APIs
Stars: ✭ 26 (+62.5%)
Mutual labels:  html5-game-development
MinecraftC
A Raytraced Minecraft Classic 0.0.30a port to C
Stars: ✭ 250 (+1462.5%)
Mutual labels:  port
HelenaFramework
Modern framework on C++20 for backend/frontend development.
Stars: ✭ 53 (+231.25%)
Mutual labels:  game-framework
p2p-forwarder
P2P Forwarder - a tool for farwarding tcp/udp ports. Made using libp2p.
Stars: ✭ 31 (+93.75%)
Mutual labels:  port
GroundEngine
Ground Engine is an easy to use Game Engine for 3D Game Development written in C++
Stars: ✭ 61 (+281.25%)
Mutual labels:  game-framework
tes3mp-android
tes3mp ported to Android devices (using CrabNet). Forked from xyzz/openmw-android.
Stars: ✭ 47 (+193.75%)
Mutual labels:  port
FazPort
FazPort is an advanced Perl Port Scanner. Scan and Detect open port in every website(s) you want.
Stars: ✭ 16 (+0%)
Mutual labels:  port
porthog
Identify which process is using a specific port.
Stars: ✭ 27 (+68.75%)
Mutual labels:  port
html5-game-development-gulp-workflow
🎮 A gulp workflow that is optimised for HTML5 Game Developement.
Stars: ✭ 13 (-18.75%)
Mutual labels:  html5-game-development
Webview-unity-3d-2017.3-or-higher-
Webview unity 3d 2017.3 or higher - can be open website url on unity3d or open Html5, html and js on unity offline
Stars: ✭ 18 (+12.5%)
Mutual labels:  html5-game-development
ShortcutBadger
Xamarin.Android library supports badge notification like iOS in Samsung, LG, Sony and HTC launchers. Port of
Stars: ✭ 24 (+50%)
Mutual labels:  port
bare bones
Ada Bare Bones OS development tutorial source code
Stars: ✭ 74 (+362.5%)
Mutual labels:  port
SlimTracin
Software ray tracer written from scratch in C that can run on CPU or GPU with emphasis on ease of use and trivial setup
Stars: ✭ 49 (+206.25%)
Mutual labels:  game-framework
xash3d-switch
Check out https://github.com/fgsfdsfgs/xash3d-fwgs for an updated version
Stars: ✭ 60 (+275%)
Mutual labels:  port
freeserf.net
Settlers 1 clone written in C#
Stars: ✭ 97 (+506.25%)
Mutual labels:  port
FWK
💎 3D game framework in C, with Luajit bindings now.
Stars: ✭ 423 (+2543.75%)
Mutual labels:  game-framework

Pancake.hx



Haxe port for Pancake, HTML5 game programming library that makes game development much easier...

Currently it supports only JS target, But i have plan to rewrite port to use Lime or something else for better support!

Getting Started

Install Pancake.hx with haxelib by following way:

haxelib install Pancake

Create new project anywhere, In your build.hxml you can include Pancake with modules needed by following way:

--define PANCAKE_CANVAS2D
--define PANCAKE_GRAPHICS
--define PANCAKE_GAME
--define PANCAKE_TIMERS

-L Pancake
--class-path src
--std full
--js bin/game.js
--main Main

Your Main.hx in src folder can be like this:

// Main.hx
package;

import pancake.*;    // Imports only included modules from build.hxml

/**
 * ...
 * @author Rabia Haffar
 */
class Main
{
    public static function main(): Void {    
        Pancake.game.title("GAME!");
        Pancake.canvas.create(800, 600, 0);
        Pancake.context.create(0, 0);
        Pancake.graphics.useContext(0);
        Pancake.canvases[0].style.border = "1px black solid";

        var logo_x: Int = 280;
        var logo_y: Int = 150;
        var timer: Int = 0;

        function game() {
            Pancake.graphics.clear();
            Pancake.graphics.color(Pancake.graphics.random.RGBA());
            Pancake.graphics.rect(0, 0, Pancake.canvases[0].width, Pancake.canvases[0].height);
        }

        var gameloop: Int = Pancake.timers.timer(game, 60);
    }
}

Then you can write HTML file, For example:

<!DOCTYPE html>
<html lang="en">
<head>
    <!-- Title will be changed by Pancake.game.title function -->
    <meta charset="utf-8">
</head>
<body>
    <!-- NOTE: You should put generated JavaScript inside body, That's to not throw errors... -->
    <script src="game.js"></script>
</body>
</html>

Modules

Modules are parts of Pancake that you can enable or disable them, Like Sound, Graphics, Input, etc...

You can include or remove parts of Pancake you don't need, You can also specify backend...

NOTE: In case you're building Pancake as library to use with Pancake JS code then don't use --dce full, Else if you're using Pancake with Haxe project...

# Modules, Comment one of them to disable them...

# [1] For including one of following modules below, You'll need to define PANCAKE_GRAPHICS with backend to include graphics
# PANCAKE_VIDEO
# PANCAKE_SPRITE
# PANCAKE_GIF
# PANCAKE_SPRITEFONT

# [2] For including replay module via defining PANCAKE_REPLAY, You'll need to define PANCAKE_INPUT to include input as replay module records input
# [3] Pancake's default graphics backend is CanvasRenderingContext2D, But you can change it to use WebGL via changing PANCAKE_CANVAS2D to PANCAKE_WEBGL
# [4] If you disabled graphics module, Some other modules that depends on graphics will be removed...

--define PANCAKE_CANVAS2D
--define PANCAKE_GRAPHICS
--define PANCAKE_VIDEO
--define PANCAKE_SPRITE
--define PANCAKE_GIF
--define PANCAKE_SPRITEFONT
--define PANCAKE_AUDIO
--define PANCAKE_INPUT
--define PANCAKE_DEVICE
--define PANCAKE_OS
--define PANCAKE_REPLAY
--define PANCAKE_UTIL
--define PANCAKE_PHYSICS
--define PANCAKE_STORAGE
--define PANCAKE_TIMERS
--define PANCAKE_SCRIPT
--define PANCAKE_BROWSER
--define PANCAKE_XHR
--define PANCAKE_GAME
--define PANCAKE_CONTENT

--class-path src
--dce std
pancake.Pancake
--js bin/Pancake.js

Differences of Pancake JavaScript

  1. You start with Pancake instead of pancake in Haxe code, If you're loading JavaScript file then nothing changes from Pancake's JavaScript version!
  2. Now you don't need Python anymore as Haxe build system replaces it...
  3. Graphics modes changed to be enums, From pancake.graphics.FILL for example to Mode.FILL.

Using JavaScript code of Pancake

As script module available, It can be used to write Pancake JS code out of box, Simply...

// Main.hx
package;

import pancake.*;

/**
 * ...
 * @author Rabia Haffar
 */
class Main
{
    public static function main(): Void {
        Pancake.script.load("game.js");
    }
}
// game.js
pancake.canvas.create(800, 600, 0);
pancake.context.create(0, 0);
pancake.graphic.useContext(0);
// ...

API

Can be found here, But make sure to follow differences happen in Haxe port!

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].