This is my first attempt at doing anything with Java. This bedroom-rpogrammer idea is to recreate the ol’ 8-/16-bit scrolltext found on AMiGA, Commodre64 etc. but then do it on J2ME.
My code need to more or less do the following;
- Read a text string into an array.
- Associate each letter (element) in the array with an appropriate letter.
- Draw all letters after each other on displayarea (the screen) from left to right.
- Shift all X-positions of the letters a few pixels to left.
- Repeat (3) until the last letter has disappeared to the left side of the screen.
The aforementioned is no problem coz such is running in a window$ BlitzMax .exe already. See earlier post for a screenshot. My problem is step (2) and (3) in the above process. Blitzmax have a neat feature that it handles tiledbitmaps nifty:
BlitzMax-code;
Function paint()
DrawImage(imgTiledImage, Xpos, Ypos, frames, tileWidth, tileHeight, tileNumber); '//this way just
Endfunction
Some info’s;
The tiled bitmap (see earlier post) containing my font is 320 x 288 Pixels.
The letters are each 32x32 big.
To draw ‘#’ the third letter from the top in the bitmap must be taken.
I just cant get getclip() to work the way it apparentley could. There is drawn sumthing wrong or nothing.
this is a sample of my javacode, which should emulate the BlitzMax functionality;
/** paint the current animation frame */
private void Paint(clsLettertje objLettertje) throws Exception
{
String METHOD_NAME = "Paint";
if(objLettertje == null)
{
return;
}
if(this.graphics1 != null)
{
try {
clsLetterInMatrix displayObjInfo2 = this.GetLetterPosInTiledImage(objLettertje.TekstWaarde);
if(displayObjInfo2 != null)
{
clsTiledImage tiledimg1 = new clsTiledImage(this.graphics1);
tiledimg1.setImage(objLettertje.image.getImage());
tiledimg1.tileHeight = 32;
tiledimg1.tileWidth = 32;
tiledimg1.drawFrame(displayObjInfo2.Kolom, displayObjInfo2.Rij, 40, 20);
}
} catch (Exception objErr1) {
String strMelding2 = objErr1.getMessage();
throw new Exception(" Fout in " + CLASS_NAME + "." + METHOD_NAME + " --> " + strMelding2);
}
//'this.graphics1.drawImage(objLettertje.image.getImage(), objLettertje.CurrPosX1, objLettertje.CurrPosY1, 0);
}
}
The method drawFrame uses the code frm earlier post. If the program code could produce a scrolltext on the emulator it should probably be run on my Samsung E900 as well . My dev environment is Netbeans 5.5 with J2ME kit installed.
This should be sumthing trivial.