Blitzsdk with Haxe
Archives Forums/Blitz3D SDK Programming/Blitzsdk with Haxe
| ||
hello friends am new in this community but for many years that i followed, this is my first contribution to the community does not know if it will be very useful for many but for me it is. I always enjoy the Blitz3D engine but not the basic language and now Blitz3D is open source so i decided to call the blitz sdk with Haxe. All the power of Blitz3D with the power of Haxe. Haxe dint have one good community so i don't know where to share this. already calls working ; Input, 2d render ps:sorry my bad English |
| ||
Hiya Djoker, Haxe dint have one good community You mean Haxe dont have one good community. Blitzsdk with Haxe? Sound very interesting and looking forward to what you do with it :-) |
| ||
hi Hotshot , is nothing new is just one more language to use sdk. package; import blitz3d.B3D; /** * ... * @author Luis Santos AKA DJOKER */ class Main { public function new() { B3D.BeginBitz3D(); B3D.Graphics3D(800, 640, 0, 0); B3D.ShowPointer(); var image:Int = B3D.LoadImage("assets/haxelogo.png"); do { // B3D.RenderWorld(); // B3D.UpdateWorld(); B3D.Cls(); //B3D.TileImage(image, 100, 1); B3D.Color(255, 100, 100); B3D.Oval(B3D.MouseX(), B3D.MouseY(), 20, 20, 1); B3D.Text(20,20,"Blitz3D On HAXE"+B3D.KeyHit(1)); B3D.Color(244, 0, 0); B3D.Oval(200, 100, 20, 20, 1); B3D.Oval(200,120, 20, 20, 0); B3D.Color(244, 0, 250); B3D.Rect(100, 100, 120, 120, 0); B3D.Rect(100, 180, 120, 120, 1); B3D.Line(0, 0, 200, 200); // B3D.DrawImage(image, 200, 200); B3D.DrawImageRect(image, 100, 100, 20, 20, 44, 45); B3D.Flip(); } while (!B3D.KeyHit(B3D.KEY_ESCAPE)); B3D.EndBitz3D(); } static function main() { new Main(); } } package blitz3d; class B3D { /* public function new() { } */ public static function BeginBitz3D():Void { #if neko var init = B3D.load("neko_init",5); if (init!=null) { init(function(s) return new String(s), function(len:Int) { var r=[]; if (len>0) r[len-1]=null; return r; }, null, true, false ); } else throw("Could not find NekoAPI interface."); #end hxBeginBlitz3d(); } public static function EndBitz3D():Void { hxEndBlitz3D(); } public static function ShowPointer():Void { hxShowPointer(); } public static function HidePointer():Void { hxHidePointer(); } public static function Graphics3D(width:Int,height:Int,depth:Int,mode:Int):Void { hxGraphics3D(width, height, depth, mode); } public static function Flip(wait:Int=1):Void { hxFlip(wait); } public static function Delay(wait:Int=1):Void { hxDelay(wait); } public static function UpdateWorld(elapsed:Float=1):Void { hxUpdateWorld(elapsed); } public static function RenderWorld(tween:Float=1):Void { hxRenderWorld(tween); } public static function MilliSecs():Int { return hxMilliSecs(); } //***********************************************************MOUSE******************************************* public static function MouseDown(n:Int):Bool { return hxMouseDown(n); } public static function MouseHit(n:Int):Int { return hxMouseHit(n); } public static function MouseX():Int { return hxMouseX(); } public static function MouseY():Int { return hxMouseY(); } public static function MouseZ():Int { return hxMouseZ(); } public static function MouseXSpeed():Int { return hxMouseXSpeed(); } public static function MouseYSpeed():Int { return hxMouseYSpeed(); } public static function MouseZSpeed():Int { return hxMouseZSpeed(); } public static function GetMouse():Int { return hxGetMouse(); } public static function WaitMouse():Int { return hxWaitMouse(); } public static function FlushMouse():Void { hxFlushMouse(); } public static function MoveMouse(x:Int,y:Int):Void { return hxMoveMouse(x,y); } //***********************************************************KEYBOARD******************************************* public static function KeyDown(n:Int):Int { return hxKeyDown(n); } public static function KeyHit(n:Int):Bool { return hxKeyHit(n); } public static function WaitKey():Int { return hxWaitKey(); } public static function GetKey():Int { return hxGetKey(); } public static function FlushKeys():Void { hxFlushKeys(); } //****************************************** 2d render public static function Origin(x:Int,y:Int):Void { hxOrigin(x,y); } public static function Viewport(x:Int,y:Int,w:Int,h:Int):Void { hxViewport(x,y,w,h); } public static function Cls():Void { hxCls(); } public static function ClsColor(r:Int,g:Int,b:Int):Void { hxClsColor(r, g, b); } public static function GetColor(x:Int,y:Int):Void { hxGetColor(x,y); } public static function Color(r:Int,g:Int,b:Int):Void { hxColor(r, g, b); } public static function Plot(x:Int,y:Int):Void { hxPlot(x,y); } public static function Line(x1:Int,y1:Int,x2:Int,y2:Int):Void { hxLine(x1,y1,x2,y2); } public static function Rect(x:Int,y:Int,w:Int,h:Int,?solid:Int=0):Void { hxRect(x,y,w,h,solid); } public static function Oval(x:Int,y:Int,w:Int,h:Int,?solid:Int=0):Void { hxOval(x,y,w,h,solid); } public static function Text(x:Int,y:Int,txt:String,?center_h:Int=0,?center_w:Int=0):Void { hxText(x,y,center_w,center_h,txt); } public static function ColorRed():Int { return hxColorRed(); } public static function ColorGreen():Int { return hxColorGreen(); } public static function ColorBlue():Int { return hxColorBlue(); } public static function CopyRect(src_x:Int,src_y:Int,src_width:Int,src_height:Int,dest_x:Int,dest_y:Int,src_buffer:Int,dest_buffer:Int):Void { return hxCopyRect(src_x,src_y,src_width,src_height,src_buffer,dest_buffer); } //***********************************************************2d image public static function LoadImage(filename:String):Int { return hxLoadImage(filename); } public static function LoadAnimImage(filename:String,w:Int,h:Int,first:Int,cnt:Int):Int { return hxLoadAnimImage(filename,w,h,first,cnt); } public static function FreeImage(Image:Int):Void { hxFreeImage(Image); } public static function DrawImage(Image:Int,x:Int,y:Int,?frame:Int=0):Void { hxDrawImage(Image,x,y,frame); } public static function DrawImageRect(Image:Int,x:Int,y:Int,src_x:Int,src_y:Int,src_width:Int,src_height:Int,?frame:Int=0):Void { hxDrawImageRect(Image,x,y,src_x,src_y,src_width,src_height,frame); } public static function DrawBlockRect(Image:Int,x:Int,y:Int,src_x:Int,src_y:Int,src_width:Int,src_height:Int,?frame:Int=0):Void { hxDrawBlockRect(Image,x,y,src_x,src_y,src_width,src_height,frame); } public static function DrawBlock(Image:Int,x:Int,y:Int,?frame:Int=0):Void { hxDrawBlock(Image,x,y,frame); } public static function TileImage(Image:Int,x:Int,y:Int,?frame:Int=0):Void { hxTileImage(Image,x,y,frame); } public static function TileBlock(Image:Int,x:Int,y:Int,?frame:Int=0):Void { hxTileBlock(Image,x,y,frame); } public static function load(inFunction:String, inArgCount:Int) : Dynamic { #if cpp return cpp.Lib.load("hxb3d",inFunction, inArgCount); #else return neko.Lib.load("hxb3d",inFunction, inArgCount); #end } static var hxBeginBlitz3d = B3D.load("hxBeginBlitz3d", 0); static var hxEndBlitz3D = B3D.load("hxEndBlitz3D", 0); static var hxHidePointer = B3D.load("hxHidePointer", 0); static var hxShowPointer = B3D.load("hxShowPointer", 0); static var hxMilliSecs = B3D.load("hxMilliSecs", 0); static var hxGraphics3D = B3D.load("hxGraphics3D", 4); static var hxUpdateWorld = B3D.load("hxUpdateWorld", 1); static var hxFlip = B3D.load("hxFlip", 1); static var hxDelay = B3D.load("hxDelay", 1); static var hxRenderWorld = B3D.load("hxRenderWorld", 1); //input //mouse static var hxMouseDown = B3D.load("hxMouseDown", 1); static var hxMouseHit = B3D.load("hxMouseHit", 1); static var hxMouseX = B3D.load("hxMouseX", 0); static var hxMouseY = B3D.load("hxMouseY", 0); static var hxMouseZ = B3D.load("hxMouseZ", 0); static var hxMouseXSpeed = B3D.load("hxMouseXSpeed", 0); static var hxMouseYSpeed = B3D.load("hxMouseYSpeed", 0); static var hxMouseZSpeed = B3D.load("hxMouseZSpeed", 0); static var hxWaitMouse = B3D.load("hxWaitMouse", 0); static var hxGetMouse = B3D.load("hxGetMouse", 0); static var hxFlushMouse = B3D.load("hxFlushMouse", 0); static var hxMoveMouse = B3D.load("hxMoveMouse", 2); //keyboard static var hxFlushKeys = B3D.load("hxFlushKeys", 0); static var hxGetKey = B3D.load("hxGetKey", 0); static var hxWaitKey = B3D.load("hxWaitKey", 0); static var hxKeyDown = B3D.load("hxKeyDown", 1); static var hxKeyHit = B3D.load("hxKeyHit", 1); //2d render static var hxOrigin = B3D.load("hxOrigin", 2); static var hxViewport = B3D.load("hxViewport", 4); static var hxColor = B3D.load("hxColor", 3); static var hxClsColor = B3D.load("hxClsColor", 3); static var hxCls = B3D.load("hxCls", 0); static var hxPlot = B3D.load("hxPlot", 2); static var hxColorRed = B3D.load("hxColorRed", 0); static var hxColorGreen = B3D.load("hxColorGreen", 0); static var hxColorBlue = B3D.load("hxColorBlue", 0); static var hxGetColor = B3D.load("hxGetColor", 2); static var hxLine = B3D.load("hxLine", 4); static var hxRect = B3D.load("hxRect", 5); static var hxOval = B3D.load("hxOval", 5); static var hxText = B3D.load("hxText", 5); static var hxCopyRect = B3D.load("hxCopyRect", -1); //2d image static var hxLoadImage = B3D.load("hxLoadImage", 1); static var hxLoadAnimImage = B3D.load("hxLoadAnimImage", 5); static var hxFreeImage = B3D.load("hxFreeImage", 1); static var hxDrawImage = B3D.load("hxDrawImage", 4); static var hxDrawBlock = B3D.load("hxDrawBlock", 4); static var hxTileImage = B3D.load("hxTileImage", 4); static var hxTileBlock = B3D.load("hxTileBlock", 4); static var hxMaskImage = B3D.load("hxMaskImage", 4); static var hxHandleImage = B3D.load("hxHandleImage", 3); static var hxScaleImage = B3D.load("hxScaleImage", 3); static var hxResizeImage = B3D.load("hxResizeImage", 3); static var hxRotateImage = B3D.load("hxRotateImage", 2); static var hxAutoMidHandle = B3D.load("hxAutoMidHandle", 1); static var hxMidHandle = B3D.load("hxMidHandle", 1); static var hxImageWidth = B3D.load("hxImageWidth", 1); static var hxImageHeight = B3D.load("hxImageHeight", 1); static var hxImageXHandle = B3D.load("hxImageXHandle", 1); static var hxImageYHandle = B3D.load("hxImageYHandle", 1); static var hxDrawImageRect = B3D.load("hxDrawImageRect", -1); static var hxDrawBlockRect = B3D.load("hxDrawBlockRect", -1); public static inline var GFX_DEFAULT =0; public static inline var GFX_FULLSCREEN =1; public static inline var GFX_WINDOWED =2; public static inline var GFX_WINDOWEDSCALED =3; public static inline var PROJ_NONE =0; public static inline var PROJ_PERSPECTIVE =1; public static inline var PROJ_ORTHO =2; public static inline var LIGHT_DIRECTIONAL =1; public static inline var LIGHT_POINT =2; public static inline var LIGHT_SPOT =3; public static inline var TX_COLOR =1; public static inline var TX_ALPHA =2; public static inline var TX_MASKED =4; public static inline var TX_MIP =8; public static inline var TX_CLAMPU =16; public static inline var TX_CLAMPV =32; public static inline var TX_SPHERE =64; public static inline var TX_CUBIC =128; public static inline var TX_VRAM =256; public static inline var TX_HIGHCOLOR =512; public static inline var TX_BLEND_NONE =0; public static inline var TX_BLEND_ALPHA =1; public static inline var TX_BLEND_MULT =2; public static inline var TX_BLEND_ADD =3; public static inline var TX_BLEND_DOT3 =4; public static inline var TX_BLEND_MULT2 =5; public static inline var CUBEFACE_LEFT =0; public static inline var CUBEFACE_FRONT =1; public static inline var CUBEFACE_RIGHT =2; public static inline var CUBEFACE_BACK =3; public static inline var CUBEFACE_TOP =4; public static inline var CUBEFACE_BOTTOM =5; public static inline var CUBEMODE_SPECULAR =1; public static inline var CUBEMODE_DIFFUSE =2; public static inline var CUBEMODE_REFRACTION =3; public static inline var BRUSHBLEND_NONE =0; public static inline var BRUSHBLEND_ALPHA =1; public static inline var BRUSHBLEND_MULTIPLY =2; public static inline var BRUSHBLEND_ADD =3; public static inline var BRUSHFX_NONE =0; public static inline var BRUSHFX_FULLBRIGHT =1; public static inline var BRUSHFX_VERTEXCOLOR =2; public static inline var BRUSHFX_FLAT =4; public static inline var BRUSHFX_NOFOG =8; public static inline var BRUSHFX_DOUBLESIDED =16 ; public static inline var BRUSHFX_VERTEXALPHA =32; public static inline var ANIM_STOP =0; public static inline var ANIM_LOOP =1; public static inline var ANIM_PINGPONG =2; public static inline var ANIM_ONCE =3; public static inline var SPRITE_TURNXY =1; public static inline var SPRITE_STILL =2; public static inline var SPRITE_ALIGNZ =3; public static inline var SPRITE_TURNY =4; public static inline var PLAYCD_SINGLE =1; public static inline var PLAYCD_LOOP =2; public static inline var PLAYCD_ALL =3; public static inline var MOUSE_BUTTON =1; public static inline var MOUSE_RIGHTBUTTON =2; public static inline var MOUSE_MIDDLEBUTTON =3; public static inline var JOYTYPE_NONE =0; public static inline var JOYTYPE_DIGITAL =1; public static inline var JOYTYPE_ANALOG =2; public static inline var COLLIDE_SPHERESPHERE =1 ; public static inline var COLLIDE_SPHEREPOLY =2; public static inline var COLLIDE_SPHEREBOX =3; public static inline var COLLIDE_STOP =1; public static inline var COLLIDE_SLIDE1 =2; public static inline var COLLIDE_SLIDE2 =3; public static inline var PICK_NONE =0;// Unpickable (default) public static inline var PICK_SPHERE =1;// Sphere (EntityRadius is used) public static inline var PICK_POLY =2;// Polygon public static inline var PICK_BOX =3;// Box (EntityBox is used) public static inline var KEY_UP = 200; public static inline var KEY_LEFT = 203 ; public static inline var KEY_RIGHT = 205; public static inline var KEY_DOWN = 208 ; public static inline var KEY_ESCAPE = 1; public static inline var KEY_TAB = 15 ; public static inline var KEY_SPACE = 57 ; public static inline var KEY_RETURN = 28; public static inline var KEY_1 = 2; public static inline var KEY_2 = 3; public static inline var KEY_3 = 4 ; public static inline var KEY_4 = 5; public static inline var KEY_5 = 6; public static inline var KEY_6 = 7; public static inline var KEY_7 = 8; public static inline var KEY_8 = 9; public static inline var KEY_9 = 10; public static inline var KEY_0 = 11 ; public static inline var KEY_LEFTSHIFT = 42; public static inline var KEY_LEFTCONTROL = 29; public static inline var KEY_LEFTALT = 56; public static inline var KEY_RIGHTSHIFT = 54; public static inline var KEY_RIGHTCONTROL = 157; public static inline var KEY_RIGHTALT = 184; public static inline var KEY_F1 = 59; public static inline var KEY_F2 = 60; public static inline var KEY_F3 = 61; public static inline var KEY_F4 = 62; public static inline var KEY_F5 = 63; public static inline var KEY_F6 = 64; public static inline var KEY_F7 = 65; public static inline var KEY_F8 = 66; public static inline var KEY_F9 = 67; public static inline var KEY_F10 = 68; public static inline var KEY_Q = 16; public static inline var KEY_W = 17; public static inline var KEY_E = 18; public static inline var KEY_R = 19; public static inline var KEY_T = 20; public static inline var KEY_Y = 21; public static inline var KEY_U = 22; public static inline var KEY_I = 23; public static inline var KEY_O = 24; public static inline var KEY_P = 25; public static inline var KEY_A = 30; public static inline var KEY_S = 31; public static inline var KEY_D = 32; public static inline var KEY_F = 33; public static inline var KEY_G = 34; public static inline var KEY_H = 35; public static inline var KEY_J = 36; public static inline var KEY_K = 37; public static inline var KEY_L = 38; public static inline var KEY_Z = 44; public static inline var KEY_X = 45 ; public static inline var KEY_C = 46; public static inline var KEY_V = 47; public static inline var KEY_B = 48; public static inline var KEY_N = 49; public static inline var KEY_M = 50; public static inline var KEY_MINUS = 12; public static inline var KEY_EQUALS = 13; public static inline var KEY_BACKSPACE = 14; public static inline var KEY_LEFTBRACKET = 26; public static inline var KEY_RIGHTBRACKET = 27; public static inline var KEY_SEMICOLON = 39; public static inline var KEY_APOSTROPHE = 40; public static inline var KEY_GRAVE = 41; public static inline var KEY_BACKSLASH = 43; public static inline var KEY_COMMA = 51; public static inline var KEY_PERIOD = 52; public static inline var KEY_SLASH = 53; public static inline var KEY_CAPSLOCK = 58; public static inline var KEY_PRINT = 183; public static inline var KEY_SCROLLLOCK = 70; public static inline var KEY_PAUSEBREAK = 197; public static inline var KEY_INSERT = 210; public static inline var KEY_DELETE = 211; public static inline var KEY_HOME = 199; public static inline var KEY_END = 207; public static inline var KEY_PAGEUP = 201; public static inline var KEY_PAGEDOWN = 209; public static inline var KEY_NUMLOCK = 69; public static inline var KEY_NUMPADDIVIDE = 181; public static inline var KEY_NUMPADMULT = 55; public static inline var KEY_NUMPADMINUS = 74; public static inline var KEY_NUMPADPLUS = 78; public static inline var KEY_NUMPADENTER = 156; public static inline var KEY_NUMPADDOT = 83; public static inline var KEY_NUMPAD0 = 82; public static inline var KEY_NUMPAD1 = 79; public static inline var KEY_NUMPAD2 = 80; public static inline var KEY_NUMPAD3 = 81; public static inline var KEY_NUMPAD4 = 75; public static inline var KEY_NUMPAD5 = 76; public static inline var KEY_NUMPAD6 = 77; public static inline var KEY_NUMPAD7 = 71; public static inline var KEY_NUMPAD8 = 72; public static inline var KEY_NUMPAD9 = 73; public static inline var KEY_F11 = 87; public static inline var KEY_F12 = 88 ; public static inline var KEY_LEFTWINDOWS = 219; public static inline var KEY_RIGHTWINDOWS = 220; public static inline var KEY_NUMPADEQUALS = 141 ; public static inline var KEY_NUMPADCOMMA = 179; public static inline var KEY_OEM_102 = 86 ; public static inline var KEY_AT = 145; public static inline var KEY_COLON = 146; public static inline var KEY_UNDERLINE = 147; public static inline var KEY_BREAK = 149; public static inline var KEY_PREVIOUSTRACK = 144; public static inline var KEY_NEXTTRACK = 153; public static inline var KEY_MUTE = 160; public static inline var KEY_PLAYPAUSE = 162; public static inline var KEY_STOP = 164; public static inline var KEY_VOLUMELESS = 174; public static inline var KEY_VOLUMEMORE = 176; public static inline var KEY_APPS = 221; public static inline var KEY_POWER = 222; public static inline var KEY_SLEEP = 223; public static inline var KEY_WAKE = 227; public static inline var KEY_WEBHOME = 178; public static inline var KEY_WEBSEARCH = 229; public static inline var KEY_WEBFAVORITES = 230; public static inline var KEY_WEBREFRESH = 231; public static inline var KEY_WEBSTOP = 232; public static inline var KEY_WEBFORWARD = 233; public static inline var KEY_WEBBACK = 234; public static inline var KEY_MYCOMPUTER = 235 ; public static inline var KEY_CALCULATOR = 161; public static inline var KEY_MAIL = 236; public static inline var KEY_MEDIASELECT = 237; } |
| ||
I would be interest trying it but does that mean I have installed haxe Files on my computer!? |
| ||
yes HotShot , blitz3d is like lib for haxe |