Announcement

Collapse
No announcement yet.

µVGA-II: How do i simply display a picture for a few seconds before prog runs?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • µVGA-II: How do i simply display a picture for a few seconds before prog runs?

    Like a "splash screen"? I've tried the file_LoadImageControl() function after putting my simple graphic through the graphics composer and putting it onto a FAT16 formatted µSD card.

    It just shows a blank screen. No picture. I tried this function in an attempt to debug:

    flcount := file_Count("*.GCI");

    And it returns zero files even though I have 1 *.GCI file on the µSD card.

    Can some one post some example code of how to simply display a picture on the µVGA-II?

  • #2


    No idea how you've tried to go about this, or what code you have generated.

    Have you tried using AN1006? http://www.4dsystems.com.au/appnotes.php


    Here's a quick and dirty way to get an image up.



    In workshop..
    Click New
    Select 4D-Visi Program and click OK.
    Select whatever uVGA II option you want, then click OK

    Uncomment the /* */ code

    Add an image from the system menu and click on a place to locate it on the image, Select an image and click open

    Move the image agound and maximise it to the window size.

    Position the cursor below the file_loadimage control statement and Click 'Paste Code' in the object inspector.
    Click Comp'nload
    Follow the directions

    and you show have an image displayed. Hopefully you can equate that with what you were doing to work out where you went wrong
    Mark

    Comment


    • #3


      Thanks! That worked, I had to modify the code a bit to get it to display only for a few seconds at boot. So the media_Image() function just flashes the image on the screen for a ms or two right?

      Here's the code that I used to get a boot up "splash screen":

      var i;
      i := 0;

      repeat
      while(!media_Init());
      media_SetSector(0x0000,0x0000);
      media_Image(0,208);
      i++;
      until(i>100);

      Comment


      • #4


        No it leaves the image there 'forever'.



        But, if you drop out of the bottom of the program, your screen will go blank



        Something like this might be more what you are after



        while(!media_Init());
        media_SetSector(0x0000,0x0000);
        media_Image(0,208);


        repeat
        forever
        Mark

        Comment


        • #5


          I see. The function I made was ending too quickly. I made this one and it runs ok...

          HTML Code:
          func splash()
          gfx_Set(CLIPPING, OFF);
          gfx_Set(PEN_SIZE, SOLID);       // clear the window
          gfx_Rectangle(0, 0, 640, 480, BLACK);
          var i := 0;
          if(games%2)
          repeat          // display logo 1 for a few seconds
          while(!media_Init());
          media_SetSector(0x003B,0x9401);
          media_Image(0,208);
          i++;
          until(i>20);
          else
          repeat          // display logo 2 for a few seconds
          while(!media_Init());
          media_SetSector(0x003B,0x94A2);
          media_Image(50,0);
          i++;
          until(i>20);
          endif
          gfx_Set(PEN_SIZE, SOLID);       // clear the window
          gfx_Rectangle(0, 0, 640, 480, BLACK);
          
          repeat          // display pong rules
          while(!media_Init());
          media_SetSector(0x003B,0x98B0);
          media_Image(0,0);
          i++;
          until(i>30);
          
          gfx_Set(PEN_SIZE, SOLID);       // clear the window
          gfx_Rectangle(0, 0, 640, 480, BLACK);
          endfunc
          Is there a better way to do this? It still works, but maybe it could be smoother transition or something?

          Comment


          • #6


            The snippet below should work I would think.

            Note sure why you aren't using FAT.

            gfx_RectangleFilled() will do a filled rectangle, you don't need to play with the pen size.

            Would it be a good time to pass over the manual again?

            (use 'Wrap [quote] tags', 'Wrap [Code] tags' is for HTML code)

            func splash()
            while(!media_Init()); // this only needs to be done once, for the whole program
            gfx_Set(CLIPPING, OFF); // not sure if you really need this

            gfx_Cls() ;
            if(games%2)
            media_SetSector(0x003B,0x9401);

            media_Image(0,208);
            else
            media_SetSector(0x003B,0x94A2);
            media_Image(50,0);
            endif
            pause(2000) ; // display logo 1 or 2 for 2 seconds

            // don't need to clear window if next image is 'full screen'

            media_SetSector(0x003B,0x98B0);
            media_Image(0,0);
            pause(3000) ; // display logo 3 for 3 seconds

            gfx_Cls() ;

            endfunc
            Mark

            Comment

            Working...
            X