Would this be of interest to anyone?......
Each Blitz function is registered as a C function, and is then callable from a 'C' DLL. If all the Blitz functions were supported in the same fashion (as the demo code below) then it would be possible to write your game/application completely in C/C++ without having to further touch Blitz.
This might be of interest to people who like the simplicity of drawing graphics with Blitz but who want to program purely in C/C++.
This example draws a line rotationg about a point.
Here's the C code
Here's the C header
Here's the Blitz code
Each Blitz function is registered as a C function, and is then callable from a 'C' DLL. If all the Blitz functions were supported in the same fashion (as the demo code below) then it would be possible to write your game/application completely in C/C++ without having to further touch Blitz.
This might be of interest to people who like the simplicity of drawing graphics with Blitz but who want to program purely in C/C++.
This example draws a line rotationg about a point.
Here's the C code
//Write your game/application here void ezRunApp() { ezGraphics(1024,768); float a = 0; while(!ezKeyHit(13) && !ezKeyHit(27)) // Enter or Escape { ezCls(); ezDrawLine(320, 240, 320+cos(a)*100, 240+sin(a)*100); ezFlip(); a += c2PI/360; if(a == c2PI) a=0; } }
Here's the C header
#include <math.h> const float c2PI = 6.28318531; #define EZSHARE_API __declspec(dllexport) //Run App extern "C"{EZSHARE_API void _cdecl ezRunApp(void);} //Register prototypes extern "C"{EZSHARE_API void _cdecl ezRegisterGraphics(int* func);} extern "C"{EZSHARE_API void _cdecl ezRegisterCls(int* func);} extern "C"{EZSHARE_API void _cdecl ezRegisterFlip(int* func);} extern "C"{EZSHARE_API void _cdecl ezRegisterKeyHit(int* func);} extern "C"{EZSHARE_API void _cdecl ezRegisterDrawLine(int* infunc);} //Use these to directly call Blitz functions int (*ezGraphics)(int, int); void (*ezCls)(); void (*ezFlip)(); int (*ezKeyHit)(int); void (*ezDrawLine)(float, float, float, float); //Blitz uses these to register its functions void ezRegisterGraphics(int* func){ezGraphics = (int (*) (int, int)) func;} void ezRegisterKeyHit(int* func){ezKeyHit = (int (*) (int)) func;} void ezRegisterCls(int* func){ezCls = (void (*) ()) func;} void ezRegisterFlip(int* func){ezFlip = (void (*) ()) func;} void ezRegisterDrawLine(int* func){ezDrawLine = (void (*) (float,float,float,float)) func;}
Here's the Blitz code
Import pub.win32 Global ezLib=LoadLibraryA("Adder") Global ezRegisterGraphics(fp:Byte Ptr)=getprocaddress(ezLib,"ezRegisterGraphics") Global ezRegisterCls(fp:Byte Ptr)=getprocaddress(ezLib,"ezRegisterCls") Global ezRegisterDrawLine(fp:Byte Ptr)=getprocaddress(ezLib,"ezRegisterDrawLine") Global ezRegisterFlip(fp:Byte Ptr)=getprocaddress(ezLib,"ezRegisterFlip") Global ezRegisterKeyHit(fp:Byte Ptr)=getprocaddress(ezLib,"ezRegisterKeyHit") Global ezRunApp()=getprocaddress(ezLib,"ezRunApp") ezRegisterGraphics(ezGraphics) ezRegisterCls(Cls) ezRegisterDrawLine(DrawLine) ezRegisterFlip(Flip) ezRegisterKeyHit(KeyHit) Function ezGraphics( a:Int, b:Int ) Graphics a, b End Function ' Run the game/app ezRunApp End