[Lazarus] Some comments about Windows Vista Folders

ArĂ­ Ricardo Ody ari.ody at japinfo.com.br
Thu Aug 14 18:56:39 CEST 2008


Dear Alvaro & cc to the Lazarus e-list & Dominique Louis,

FYI to *Alvaro*: Please remember that this project is on SourceForge and
you're a member of the team (just the 2 of us) who are developing it.

Note that the unit (attached) is strongly based on JEDI SDL graphics,
however, it (my unit for graphics & this project) has big problems working
with Lazarus for Linux in my current project. I might have something to do
with all of the Ttimer's on the app too. There are 6 Ttimers on my game
project!!!

To *Dominique Louis* (I hope I got you're name correctly spelt!) -- What do
you think about this?!? I mention this because I remember that you were/are
a great advocate of graphics programming / game design and the Lazarus RAD.
*SMILE* You *inspired* me to create some games software... although not
great -- I'm still proud of my efforts.

Best Regards,
PEW

---------- Forwarded message ----------
From: Peter Williams <pewtas at gmail.com>
Date: 2008/8/14
Subject: Re: [Lazarus] How can I improve my bitmap font drawing unit
(attached) ?
To: General mailing list <lazarus at lazarus.freepascal.org>


G'day Ido & All,

Perhaps I didn't explain myself correctly. When I said that (in the subject)
that I want to improve my unit... what I meant is that I want to optimize my
unit so that the graphics are rendered faster. And also possibly stored in a
more effective way.

Actually your suggestion (1) "add support for many more languages" is making
a false assumption ... actually it doesn't support any particular language
per se -- at the moment if you wanted to call it with a string of
anglo-saxon characters (e.g. using the alphabet)  in any language then it
would display it. It's just a matter of calling it (the appropriate
procedure or function) with the string of character codes & characters you
want to print. That string of characters could be in any language.
Additionally, there's no reason why you couldn't define a different
character set (bitmap font), of say, crylic or asian characters (or
whatever).

But I think you're missing the point of my unit. My unit is for a retro
remake game which displays old fashioned 'chunky' fonts, like an old
Commodore PET computer (circa 1977-80), and renders it on a TPaintBox which
serves as it's screen (or display) -- but its actually just a window of a
form. E.g. it's a RETRO Game... a game designed to have a display looking
like an old computer.

I'm really not the slightest bit interested in supporting bidi or Unicode TR
{ I hope that this doesn't offend you - but I'm just being honest!!! }. I
quickly researched what the are, on wiki. That would make my code more
complicated and slower. I want to do almost the opposite... e.g. I want to
optimize my code and make it render the graphics on the tpaintbox component
much quicker. So, basically what I'm saying is that I want to find more
efficient ways of storing my bitmap fonts and converting them into font
characters. I only have need for LTR direction of drawing the graphics.

If anyone has some more construction feedback, as opposite to your sarcastic
reply... then I'd be happy to discuss it... say on the IRC #lazarus-ide
channel -- which I've recently discovered & like to use.

*SMILE*

Fond Regards,
             PEW   ;-)))
from Hobart, Tasmania, Australia

2008/8/14 ik <idokan at gmail.com>

1. Add support for many more languages.
> 2. Add bidi and the rest of the Unicode TR (bidi etc).
> 3. And then ask again :)
>
> Ido
>
> 2008/8/14 Peter Williams <pewtas at gmail.com>:
> >
> > Hi All,
> >
> > I'd like some advice about the attached unit, named
> "uFixedWidthFonts.pas".
> > It is designed to read 2-colour bitmaps of font character sets of
> different
> > sizes, from files which are Windowz BMP format. For example,
> > "Chars_Lower_8x8.bmp" -- this is a 320 x 56 pixels, 1 layer BMP file,
> file
> > size 2.25 KB. E.g. the BMP file is a 2 colour image of a 256 character
> > bitmap, where each character in the BMP file (in this case) is 8x8
> pixels.
> >
> > There are 8 BMP files:
> >
> > Chars_Lower_8x8.bmp
> > Chars_Lower_16x16.bmp
> > Chars_Lower_24x24.bmp
> > Chars_Lower_32x32.bmp
> > Chars_Upper_8x8.bmp
> > Chars_Upper_16x16.bmp
> > Chars_Upper_24x24.bmp
> > Chars_Upper_32x32.bmp
> >
> > The *Lower* files define the Commodore PET 4032 upper/lower case
> character
> > set & the *Upper* files define the Graphics/Uppercase character set.
> >
> > My main question is: would I be better off using a TImageList?!? Can
> someone
> > please post sample code. Note: I tried to run the TImageList example
> program
> > for Lazarus... it compiles okay... but when run it does not find some of
> its
> > files (BMPs) in the Image sub-folder of the example program. e.g. it gets
> a
> > runtime error.
> >
> > Note that this unit is based strongly on a unit from the Jedi SDL
> component,
> > sample unit for drawing bitmap fonts onto a graphic canvas.
> >
> > At the moment I use statements like this to define the bitmap font (some
> of
> > the code is pasted below):
> >
> > Best Regards & Happy Programming ;-)))
> > PEW
> >
> > -----------------
> > const
> >   Rects_low = 0;
> >   Rects_high = 255;
> >
> > type
> >   // these lines "borrowed" from SDL.pas
> >   SInt16 = smallint;
> >   UInt16 = word;
> >
> > // [ALVAROGP] TSDL_Rect converted to class, to avoid warnings
> > {
> >   PSDL_Rect = ^TSDL_Rect;
> >   TSDL_Rect = record
> >     x, y: SInt16;
> >     w, h: UInt16;
> >   end;
> > }
> >   TSDL_Rect = class
> >   public
> >     x, y: SInt16;
> >     w, h: UInt16;
> >   end;
> >
> >   // end lines from SDL
> >
> >   PFixedFont = ^TFixedFont;
> >   TFixedFont = object
> >   private
> >     Image: TBitmap;
> > // [ALVAROGP] Rects redefined as array of class TSDL_Rect
> > {
> >     Rects: array[Rects_low..Rects_high] of PSDL_Rect;
> > }
> >     Rects: array[Rects_low..Rects_high] of TSDL_Rect;
> >   public
> >     LastCharacterDefined: byte;
> >     TransparentColor,
> >       TextColor,
> >       BackgroundColor: Tcolor;
> >     // this is used only when UseTransparentBackground is false
> >     Char_width,
> >       Char_height: byte; // default is 8x8
> >     ReverseVideo: Boolean; // default =false
> >     HorizontalGap: byte;
> >     // Horizontal Gap between characters in Pixels -- default =1
> >     UseTransparentBackground: Boolean;
> >
> >     constructor Initialize;
> >     procedure LoadFont(const Fontfile: string);
> >     procedure FreeUpAll;
> >     destructor Finalize;
> >     procedure WriteText2(x, y: integer; Txt: string; TextLength:
> cardinal;
> >       var PaintBox1: TPaintBox);
> >   end;
> >
> > var
> >   Font1: PFixedFont;
> > -----------------
> >
> > [...snip...]
> >
> > function PSDLRect(aLeft, aTop, aWidth, aHeight: integer): TSDL_Rect;
> > var
> >   Rect: TSDL_Rect;
> > begin
> >   Rect := TSDL_Rect.Create;
> >   with Rect do
> >   begin
> >     x := aLeft;
> >     y := aTop;
> >     w := aWidth;
> >     h := aHeight;
> >   end;
> >   Result := Rect;
> > end;
> >
> > {---------------------------------------------------------}
> >
> > constructor TFixedFont.Initialize;
> > begin
> >   // defaults
> >   LastCharacterDefined := 0; // PEW
> >   Char_width := 8;
> >   Char_height := 8;
> >   HorizontalGap := 1; // 1 pixel by default
> >   ReverseVideo := False; // off by default
> > end;
> > {---------------------------------------------------------}
> >
> > procedure TFixedFont.LoadFont(const Fontfile: string);
> > var
> >   i, x, y: integer;
> > begin
> >   FreeUpAll;
> >   if not fileexists(Fontfile) then
> >   begin
> >     showmessage('Error: font file does not exist: "' + fontfile + '"');
> >     exit;
> >   end;
> >
> >   Image := TBitmap.Create;
> >   try
> >     Image.LoadFromFile(Fontfile);
> >   except
> >     showmessage('Error: Exception occurred trying to load font file.');
> >     exit;
> >   end;
> >
> >   if Image = nil then
> >     exit;
> >   x := 0;
> >   y := 0;
> >   i := Rects_low;
> >   repeat
> >     if x >= Image.width then
> >       break;
> >
> >     Rects[i] := PSDLRect(x, y, Char_width, Char_height);
> >
> >     LastCharacterDefined := i; // PEW
> >     inc(i);
> >     inc(x, Char_width);
> >     if x >= Image.width then
> >     begin
> >       // font bitmap is a block of characters, so if we go past
> >       // the end of bitmap, then go down to next row of characters.
> >       x := 0;
> >       inc(y, Char_height);
> >     end;
> >
> >   until (y >= Image.height) or (i > Rects_High);
> >   // Determine the transparent color
> >   TransparentColor := Image.Canvas.Pixels[Rects[Rects_low].x +
> >     Rects[Rects_low].w, 0];
> >
> >   UseTransparentBackground := true; // default
> > end;
> > {---------------------------------------------------------}
> >
> >
> > --
> > Fond Regards,
> > Peter Eric (aka 'pew') WILLIAMS
> > from Hobart, Tasmania, Australia -- phone (03) 6236-9675
> >
> > My free website is: http://pewtas.googlepages.com (or)
> > http://tinyurl.com/yuyejs
> >
> > (please visit my free website and let me know what you think about it.)
> >
> > _______________________________________________
> > Lazarus mailing list
> > Lazarus at lazarus.freepascal.org
> > http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
> >
> >
>
>
>
> --
> http://ik.homelinux.org/
> _______________________________________________
> Lazarus mailing list
> Lazarus at lazarus.freepascal.org
> http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
>



-- 
Fond Regards,
Peter Eric (aka 'pew') WILLIAMS
from Hobart, Tasmania, Australia -- phone (03) 6236-9675

My free website is: http://pewtas.googlepages.com (or)
http://tinyurl.com/yuyejs

(please visit my free website and let me know what you think about it.)



-- 
Fond Regards,
Peter Eric (aka 'pew') WILLIAMS
from Hobart, Tasmania, Australia -- phone (03) 6236-9675

My free website is: http://pewtas.googlepages.com (or)
http://tinyurl.com/yuyejs

(please visit my free website and let me know what you think about it.)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20080814/9e0c0712/attachment-0007.html>


More information about the Lazarus mailing list