alias Integer = Int
alias ListOf<T> = List<T>
/* | |
id : String - l'identifiant d'un élément HTML (un div ou un span par exemple) | |
seconds : Int - Nombre de secondes | |
*/ | |
function Stopwatch(id, seconds) { | |
var self = this; | |
this.seconds = seconds; | |
this.el = document.getElementById(id); | |
this.h = this.m = this.s = 0; |
pack state | |
use entity.Hero | |
use hx.HxState | |
class Fight < HxState { | |
public static This inst | |
Hero hero |
Idées d'améliorations du langage Haxe : sans ordre d'importance
public function ma_methode(a:Int, b:Int):Int { }
public function ma_methode(a:String, b:String):Int { }
var
et function
sont inutiles dans les déclarations de méthodes :Import mojo.graphics | |
Import monster | |
Class Face Abstract | |
Const EXPOSED := 0 | |
Const COVERED := 1 | |
End | |
Class Position Abstract | |
Const ATTACK := 0 |
package pifybird; | |
import flash.display.Sprite; | |
import flash.display.BitmapData; | |
import flash.geom.Rectangle; | |
import openfl.display.Tilesheet; | |
import openfl.Assets; | |
class Bird extends Sprite { | |
private var bitmap:BitmapData; |
package; | |
// enum Direction { | |
// RIGHT; // 0 | |
// LEFT; // 1 | |
// UP; // 2 | |
// DOWN; // 3 | |
// } | |
class Befunge { |
package; | |
class Brainfuck { | |
public static function main() { | |
var args = Sys.args(); | |
// On test si un fichier a été spécifié en argument | |
if (args.length != 1) { | |
Sys.println('Utilisation : ${Sys.executablePath()} file.bf'); | |
Sys.exit(1); |
use stdio as io | |
use math | |
Num main(List<Str> args) { | |
Num nb_rand = math.rand(0, 100) | |
Num saisie = -1 | |
Num nb_essais = 0 | |
do { | |
saisie = io.ask("Essai n#{nb_essais + 1} = ").to_num() |
#include <stdlib.h> | |
#include <stdio.h> | |
#include <time.h> | |
int main (int argc, char *argv[]) { | |
srand(time(NULL)); | |
int nb_rand = rand() % 100; | |
int saisie = -1; | |
int nb_essais = 0; |