Skip to content

Instantly share code, notes, and snippets.

@kfprimm
Last active April 18, 2017 22:47
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kfprimm/233b7f8d7c13f454f71055a63bef5c39 to your computer and use it in GitHub Desktop.
Save kfprimm/233b7f8d7c13f454f71055a63bef5c39 to your computer and use it in GitHub Desktop.
Blitz3D -> C -> macOS
Graphics 800,600,32,2
SetBuffer BackBuffer()
img=LoadImage( "_release/samples/mak/b3dlogo.jpg" )
while Not KeyDown(1)
Cls
Color 255,255,255
DrawImage img,10,10,0
Rect 400,400,50,50,1
Color 0,255,0
Rect MouseX(),MouseY(),20,20
Flip
Wend
End
#include <bb/blitz/commands.h>
#include <bb/hook/commands.h>
#include <bb/event/commands.h>
#include <bb/math/commands.h>
#include <bb/string/commands.h>
#include <bb/runtime/commands.h>
#include <bb/system/commands.h>
#include <bb/system.macos/commands.h>
#include <bb/stream/commands.h>
#include <bb/filesystem/commands.h>
#include <bb/bank/commands.h>
#include <bb/audio/commands.h>
#include <bb/input/commands.h>
#include <bb/graphics/commands.h>
#include <bb/blitz2d/commands.h>
#include <bb/blitz3d/commands.h>
#include <bb/blitz3d.gl/commands.h>
#include <bb/pixmap/commands.h>
#include <bb/runtime.glfw3/commands.h>
;
void bbMain(){
bb_int_t img;
// test/DrawImage.bb
bbGraphics( 800,600,32,2 );
bbSetBuffer( (bb_int_t)(bbBackBuffer()) );
img = (bb_int_t)(bbLoadImage( _bbStrConst("_release/samples/mak/b3dlogo.jpg") ));
while((bb_int_t)((bb_int_t)(bbKeyDown( 1 )) == 0)){
// test/DrawImage.bb
bbCls();
bbColor( 255,255,255 );
bbDrawImage( (bb_int_t)(img),10,10,0 );
bbRect( 400,400,50,50,1 );
bbColor( 0,255,0 );
bbRect( (bb_int_t)(bbMouseX()),(bb_int_t)(bbMouseY()),20,20,1 );
bbFlip( 1 );
}
bbEnd();
}
_release/bin/blitzcc -d +q -j test/DrawImage.bb | bin/ast2c | clang++ -o DrawImage -x c - `bin/bb-config`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment