Gameduino2 Examples

Share code examples with other users

Gameduino2 Examples

Postby RKP » Thu Feb 25, 2016 3:33 am

Gentlemen,

I finally purchase a real working display, since I was not successful using the cheap Chinese display.

Trying the example on page 34 from the gd2book_v0.pdf from the Excamera website.
The example is about using bitmap handles but unfortunately it does not compile.
It does not the "-1" value in this line FT.cmd_loadimage(-1, 0)

Any ideas as to how to make this work as in the example

Thanks,
Keith

Code: Select all
'*****************************************************************************
'*  Name    : UNTITLED.1                                                     *
'*  Author  : [select VIEW...EDITOR OPTIONS]                                 *
'*  Notice  : Copyright (c) 2016 [select VIEW...EDITOR OPTIONS]              *
'*          : All Rights Reserved                                            *
'*  Date    : 2/19/2016                                                      *
'*  Version : 1.0                                                            *
'*  Notes   :                                                                *
'*          :                                                                *
'*****************************************************************************

' Imports section...

#option _gccOptimise = Os
#option FT_MODEL = GAMEDUINO
imports Ft800

' Declarations...

Sub Main()                             
   Ft.Clear()
   Ft.cmd_text(240, 136, 29, OPT_CENTER, "Loading, please wait...") 
   Ft.Swap()
   'Ft.cmd_loadimage(0, 0)
   'Ft.Load("dog.jpg")
   
   FT.BitmapHandle(0)
   FT.cmd_loadimage(0, 0)
   FT.load("sunrise.jpg")
   FT.BitmapHandle(1)
   FT.cmd_loadimage(-1, 0)
   FT.load("healsky3.jpg")
   
   while true
      FT.Clear     
      Ft.Begin(BITMAPS)
      Ft.Vertex2ii(0, 0, 0)
      Ft.Vertex2ii(200,100, 1)
      Ft.Swap()
      Delayms(2000)
      'FT.Clear
      'Ft.Begin(BITMAPS)
      'Ft.Vertex2ii(250, 100, 1)
      'FT.Swap()
      'Delayms(2000)     
   end while     
   
end sub
RKP
 
Posts: 21
Joined: Mon Nov 26, 2012 3:12 am

Re: Gameduino2 Examples

Postby David John Barker » Thu Feb 25, 2016 10:33 am

I'm not sure what -1 is supposed to do. In any case, the library uses unsigned integer values, so try using &HFFFFFFFF if a negative value is important.
User avatar
David John Barker
 
Posts: 491
Joined: Thu Nov 08, 2012 12:21 pm

Re: Gameduino2 Examples

Postby RKP » Thu Feb 25, 2016 1:45 pm

I'll try that suggestion when I get home.
According to the James's cook book the "-1" is special in that it puts the next bitmap in the FT800 next available address in its memory.
This according to my memory of the page 34 as I can't look at James's cook book now, because it is blocked from work.

I tried making it a sign integer in the library and it did compiled but the display of the first jpeg is is only half correct and the second image is fine.
It appears the the memory location of the first image is being over written by the second image file.

I am using the latest version 1.0.0.6 not any of the beta versions.

Thanks for your reply,
Keith
RKP
 
Posts: 21
Joined: Mon Nov 26, 2012 3:12 am

Re: Gameduino2 Examples

Postby David John Barker » Thu Feb 25, 2016 2:00 pm

I've not really played around with JPEGS. I used the FT800 image conversion utility to create "raw" bitmaps, which are much easier and faster to process

http://www.ftdichip.com/Support/Documents/AppNotes/AN_303%20FT800%20Image%20File%20Conversion.pdf

some examples here

http://www.firewing.info/pmwiki.php?n=FirewingUser.FT800Widget

If you still want to try load image, then

Code: Select all
ft.cmd_loadimage(cuint(-1),0)

should also work
User avatar
David John Barker
 
Posts: 491
Joined: Thu Nov 08, 2012 12:21 pm

Re: Gameduino2 Examples

Postby RKP » Fri Feb 26, 2016 1:38 pm

Thanks David, the &HFFFFFFFF worked.

I have some questions since i am not a software guy by profession.
I think that FFFFFFFF is = -1 if it is a signed integer, but what does the and "&" do to this?
Or also what are you & ing it with.

Thanks
RKP
 
Posts: 21
Joined: Mon Nov 26, 2012 3:12 am

Re: Gameduino2 Examples

Postby David John Barker » Fri Feb 26, 2016 1:49 pm

It's the VB way of representing hex numbers :

Code: Select all
&H - hex
&B - binary
&O - octal


or you can use the typecast, as previously shown...
User avatar
David John Barker
 
Posts: 491
Joined: Thu Nov 08, 2012 12:21 pm


Return to Code Examples

Who is online

Users browsing this forum: No registered users and 2 guests

cron

x