This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Streaming Video Test | |
* | |
* References: | |
* ----------- | |
* http://serverfault.com/questions/288137/how-to-stream-live-video-from-a-linux-server | |
* https://wiki.videolan.org/Stream_VLC_to_Website_with_asf_and_Flash#Method_2_H264_and_Flash_.flv | |
* http://blog.morscad.com/code-snippets/creating-a-video-player-in-as3-using-netstream/ | |
* | |
* Sample videos: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Author: Jeff Ward | |
// License: MIT | |
// | |
// Haxe Std.random() can only generate 31 bits of random data. This seems to | |
// be a Neko limitation that is foisted on the other platforms. Well, no | |
// longer! cpp, flash, and js are liberated below. | |
package; | |
class Rand32 { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <vector> | |
#include <math.h> | |
int main() | |
{ | |
std::vector<long> primes; | |
primes.push_back(2); | |
for(long i=3; i < 2^63; i++) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'rocketamf' | |
require 'stringio' | |
# Monkey patch for RocketAMF (0.2.1 gem) that handles IExrternalizable types | |
# in the input, storing their type as "__as3_type" parameter: | |
module RocketAMF | |
module Values #:nodoc: | |
class TypedHash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/ruby | |
# | |
# Usage: haxe Test.hx -main Test -cpp test 2>&1 | float_fix.rb | |
# | |
# Modifies files which appear on error lines as: | |
# | |
# Test.hx:15: characters 12-18 : Float should be Int | |
# | |
# Changes Test.hx line 15 from: needInt( 4.5 - 3 ) ; | |
# to: needInt( Std.int(4.5 - 3) ) ; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Testing with Haxe 3.1.3 and Neko 2.0 | |
class Rand { | |
static function intArg(ii:Int) { | |
trace(" - got intArg: "+ii); | |
} | |
static function main() { | |
var i1:Int = 0xffffffff; | |
trace("0xFFFFFFF = "+i1); | |
var i2:Int = 0x7fffffff; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Traversing (and populating where nodes don't exist) a hierarchical structure: | |
struct AllocStackIdMapEntry | |
{ | |
std::map<int, AllocStackIdMapEntry*> children; | |
}; | |
{ | |
std::vector<int> callstack; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Instructions for testing hxScout with hxcpp. | |
FYI, I've tested this using Haxe 3.1.3, OpenFL 2.1.7 (the legacy version, aka _v2, aka not next) in Windows 7. Your mileage may vary. All this is under heavy development, so it may cease working at some point. | |
1) Git checkout (or download) jcward's hxcpp (integration branch), hxtelemetry, and hxScout: | |
https://github.com/jcward/hxScout/archive/master.zip | |
https://github.com/jcward/hxtelemetry/archive/master.zip | |
https://github.com/jcward/hxcpp/archive/integration.zip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Note: Context.getDefines() requires Haxe 3.2 or later | |
class Main { // example main class | |
// - - - - - - - - - - - - - - - - - - - - - - - - - - | |
// Just paste this code into one of your classes: | |
// - - - - - - - - - - - - - - - - - - - - - - - - - - | |
macro public static function get_defines():haxe.macro.Expr { | |
var rtn = "Defines ("+ | |
(haxe.macro.Context.defined("macro")?"macro":"standard")+" pass):\n"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import haxe.Timer.stamp; | |
// Testing float to integer conversion faster than Std.int() for C++ based on: | |
// http://stackoverflow.com/questions/429632/how-to-speed-up-floating-point-to-integer-number-conversion | |
class Main { | |
#if cpp | |
@:functionCode(" | |
union Cast | |
{ |
OlderNewer