Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
New and updated graphics demo programs
#1
First to the important thing. You can download the demo-programs at


http://www.theuserbl.ag.vu/gdemo.zip


Big Grin

In this zip-file are the following files included:
- graphis.bi
- letter.bi
- loadbmp.bi
- gptcext.bi
- freebas.bmp
- gdemoptc.bas
- gdemosdl.bas
- gextdemo.bas


With this files the example programs at
http://forum.qbasicnews.com/viewtopic.php?t=7716
are obsolete.


About the files:

graphis.bi gives support for drawing lines, ellipses, rects, etc.

letter.bi includes commands like GCOLOR, GLOCATE and GPRINT.
At the moment you can only write all uppercase letters and only lowercase letter until "s" with it.
Numbers and other things like +/*-§$%&!"()=... etc are at the moment not supported

loadbmp.bi loads black/white bitmaps. It don't call functions in sdl or ddraw which implementing the same. It is completely a own implementation from me. It is written in freeBasic.

freebas.bmp is a black/white image used by gdemoptc.bas and gdemosdl.bas.

gdemoptc.bas is based on the graphic-runtime in fb's tinyptc.bas.
It demonstrates the use of graphis.bi, letter.bi and loadbmp.bi

gdemosdl.bas is the same program as gdemoptc.bas, but is based on libsdl

gptcext.bi is only in very early stage. At the moment I want to try to implement GINPUT. But at the moment .... its only at the beginning.

gextdemo.bas demonstrates gptcext.bi
But at the moment the program asks only for one letter. And if you have pressed a key on your keyboard it says in the graphic window, which letter you have pressed.

Greatings
theuserbl
Reply
#2
Hmmm... everytime the same.
The problem is, that I haven't at home an internet-connection. So my computer is isolated. And not all Internetcafés in which I go have access to floppy disks or CDROMs for users.

So, here now the updated version of gptcext.bi as sourcecode:

Code:
declare function gInput$

function gInput$

dim text as string
dim letter as string

dim n as integer, i as integer
dim Textxx as integer
Textxx=Textx

doitagain:

dim mm as integer, nn as integer

  for nn=0 to SCR_HEIGHT
    for mm=0 to SCR_WIDTH
      i=mm+nn*SCR_WIDTH
      buffer(i)=xybuffer(mm,nn)
    next mm
  next nn


do
  letzter = inkey$
  ptc_update @buffer(0)
loop until letter <> ""

if ASC(letter)=13 then
  gINPUT$ = text
  exit function
end if

if ASC(letter)=8 then
  if len(text)>1 then
    text=mid$(text,1,len(text)-1)
    Textx=Textxx
    for i=1 to len(text)+1
      clfh Textx+(i-1)*8,Texty,0
    next i
    Textx=Textxx
    gprint text
  else
    text=""
    Textx=Textxx
    clfh Textx,Texty,0
    Textx=Textxx
  end if
elseif ASC(letter)=32 OR ASC(letter)>=65 and ASC(letter)<=90 then
  text=text+letter
  Textx=Textxx
  for i=1 to len(text)
    clfh Textx+(i-1)*8,Texty,0
  next i
  Textx=Textxx
  gprint text
end if

goto doitagain

end function


You can test it, if you write in the part with the easy code in gextdemo.bas:

Code:
filledbox 0,0,319,239,&h880088
dim YourName as string

GCOLOR &hffff00
GLOCATE 3,5
GPRINT "PLEASE ENTER YOUR NAME"
GLOCATE 4,5
YourName=gInput$
GLOCATE 5,5
GPRINT "Hello "+ YourName


So at the moment it is supported to input letters and space.
You can correct your typing with backspace.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)