Skip to content

Commit

Permalink
Allow TileData to come from strings for neko too
Browse files Browse the repository at this point in the history
  • Loading branch information
hughsando committed May 22, 2017
1 parent e0df48f commit f7487e9
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 8 deletions.
1 change: 1 addition & 0 deletions acadnme/src/AllNme.hx
Expand Up @@ -210,6 +210,7 @@ import nme.utils.ByteArray;
import nme.utils.CompressionAlgorithm;
import nme.utils.Endian;
import nme.utils.Float32Array;
import nme.utils.Float32Buffer;
import nme.utils.IDataInput;
import nme.utils.IDataOutput;
import nme.utils.IMemoryRange;
Expand Down
4 changes: 2 additions & 2 deletions project/src/common/ExternalInterface.cpp
Expand Up @@ -3284,10 +3284,10 @@ value nme_gfx_draw_tiles(value inGfx,value inSheet, value inXYIDs,value inFlags,
if (!buf)
buf = val_to_buffer(inXYIDs);
if (buf)
{
fvals = (float *)buffer_data(buf);
}
}
if (!fvals && val_is_string(inXYIDs))
fvals = (float *)val_string(inXYIDs);
if (fvals)
TAddTiles( gfx->getPath(), sheet, n, fvals, flags, fullImage );
else
Expand Down
21 changes: 15 additions & 6 deletions src/nme/utils/Float32Buffer.hx
Expand Up @@ -55,7 +55,8 @@ class Float32Buffer extends ByteArray implements ArrayAccess<Float>
static function hxcppGetFloat(b:haxe.io.BytesData, pos:Int):Float return 0.0;
#end

inline public function setF32(index:Int,val:Float)
#if !cppia inline #end
public function setF32(index:Int,val:Float)
{
#if jsprime
if (index>=count)
Expand All @@ -72,20 +73,25 @@ class Float32Buffer extends ByteArray implements ArrayAccess<Float>
count = index+1;
ensureElem(bpos+3,true);
}
#if (cpp && !cppia)
#if cppia
untyped __global__.__hxcpp_memory_set_float(b,index,val);
#elseif cpp
hxcppSetFloat(b,bpos,val);
#else
setFloat(bpos,val);
#end
#end
}

inline public function getF32(index:Int):Float
#if !cppia inline #end
public function getF32(index:Int):Float
{
#if jsprime
return f32View[index];
#else
#if (cpp && !cppia)
#if cppia
untyped return __global__.__hxcpp_memory_get_float(b,index);
#elseif cpp
return hxcppGetFloat(b,index<<2);
#else
return getFloat(index<<2);
Expand All @@ -95,12 +101,15 @@ class Float32Buffer extends ByteArray implements ArrayAccess<Float>



inline public function setF32q(index:Int,val:Float)
#if !cppia inline #end
public function setF32q(index:Int,val:Float)
{
#if jsprime
f32View[index]=val;
#else
#if (cpp && !cppia)
#if cppia
untyped __global__.__hxcpp_memory_set_float(b,index,val);
#elseif cpp
hxcppSetFloat(b,index<<2,val);
#else
setFloat(index<<2,val);
Expand Down

0 comments on commit f7487e9

Please sign in to comment.