Hi,
While waiting for a gamebuino I would like to code some stuff to test.
Is there an emulator or something else, that would allow me to see some rendering ?
( I've never worked on arduino project before so sorry if my question is stupid )
adekto wrote:there arduino emulators out there, but i dont know any with the lcd screen
autodesk even has one
package
{
import flash.display.Bitmap;
import flash.display.BitmapData;
import flash.geom.ColorTransform;
/**
* Try to simulate the gamebuino display
* @author Alain Le Guirec
*/
public class LCD extends Bitmap
{
// this buffer is the memory
protected var m_buffer:Vector.<int> = new Vector.<int>(48 * (80 / 8));
// this buffer is used by flash to render buffer fast
// usefull to simulate the remanence to
protected var m_colors:Vector.<uint> = new Vector.<uint>(48*80);
public function LCD()
{
super();
bitmapData = new BitmapData(80, 48, false, 0xFFFFFF);
transform.colorTransform = new ColorTransform(0.8, 0.9, 0.8); // put here the screen color (rgb values between 0.0 and 1.0)
}
public function setPixel(px:uint, py:uint, bState:Boolean):void
{
if (px >= 80 || py >= 48)
return;
if(bState)
m_buffer[(py * 10) + (px >> 3)] |= 0xFF & (1 << (7 - (px & 7)));
else
m_buffer[(py * 10) + (px >> 3)] &= 0xFF ^ (1 << (7 - (px & 7)));
}
/*
* simulate the gamebuino display function
*/
public function drawBitmap(px:int, py:int, btm:Vector.<int>):void
{
var idxRead:int = 2;
var byteWidth:int = btm[0] >> 3;
for (var py:int = 0; py < btm[1]; py++)
{
for (var nbyte:int = 0; nbyte < byteWidth; nbyte++)
{
var val:int = btm[idxRead++];
for (var nbits:int = 0; nbits < 8; nbits++)
{
setPixel(px + nbits, py, (val & 0x80) != 0);
val <<= 1;
}
}
}
}
/*
* this function transfert the memory buffer to the flash bitmap
* must be called each frame
*/
public function update():void
{
var idxRead:int = 0;
var idxWrite:int = 0;
for (var py:int = 0; py < 48; py++)
{
var px:int = 0;
for (var nbyte:int = 0; nbyte < 10; nbyte++)
{
var byte:int = m_buffer[idxRead++];
for (var npix:int = 0; npix < 8; npix++,px++, idxWrite++)
{
if ((byte & 0x80) != 0)
m_colors[idxWrite] = 0;
else
{
var l:int = ((m_colors[idxWrite] & 0xFF) + 0xFF) >> 1;
m_colors[idxWrite] = l<<16 | l<<8 | l;
}
byte <<= 1;
}
}
}
bitmapData.setVector(bitmapData.rect, m_colors);
}
}
}
adekto wrote:hi there, i have tryed this to but in lua
the problem is u have to interprite c code or the hex comiled code to emulate it properly
rodot wrote:I still think that it's easier to assemble a fake-buino on a breadboard
Return to Software Development
Users browsing this forum: No registered users and 8 guests