C64 Loading screen?

Just starting out? Need help? Post your questions and find answers here.
Swos2009
Enthusiast
Enthusiast
Posts: 112
Joined: Sat Nov 08, 2008 8:19 pm

C64 Loading screen?

Post by Swos2009 »

infratec
Always Here
Always Here
Posts: 7625
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: C64 Loading screen?

Post by infratec »

Hi,

one posibillity:

Code: Select all

UseJPEGImageDecoder()

OpenWindow(0, 0, 0, 640, 400, "C64 loading", #PB_Window_SystemMenu|#PB_Window_ScreenCentered)
CanvasGadget(0, 0, 0, 640, 400)


LoadImage(0, "c:\tmp\C64.jpg")
AddWindowTimer(0, 1, 25)


Repeat
  
  Event = WaitWindowEvent()
  
  If Event = #PB_Event_Timer
    GrabImage(0, 1, x, y, 20, 20)
    StartDrawing(CanvasOutput(0))
    DrawImage(ImageID(1), x, y)
    StopDrawing()
    FreeImage(1)
    x + 20
    If x = 640
      x = 0
      y + 20
    EndIf
    If y = 400
      RemoveWindowTimer(0, 1)
      FreeImage(0)
    EndIf
  EndIf
  
Until Event = #PB_Event_CloseWindow
Picture:
http://assets2.ignimgs.com/2009/02/26/t ... 766725.jpg

Bernd
Last edited by infratec on Thu Oct 01, 2015 7:18 am, edited 1 time in total.
Swos2009
Enthusiast
Enthusiast
Posts: 112
Joined: Sat Nov 08, 2008 8:19 pm

Re: C64 Loading screen?

Post by Swos2009 »

Nice one :) thanks and I would like do full screen without CanvasGadget...

do I have change open screen setting?
infratec
Always Here
Always Here
Posts: 7625
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: C64 Loading screen?

Post by infratec »

Hey,

you are a programmer :!:

Code: Select all

EnableExplicit

#WindowedScreen = #True

Define.i x, y, Event, Exit, ScreenOk

UseJPEGImageDecoder()

If InitSprite()
 
  
 
  If InitKeyboard()
    If #WindowedScreen
      
      If ExamineScreenModes()
        While NextScreenMode()
          Debug Str(ScreenModeWidth())+"x"+Str(ScreenModeHeight())+"x"+Str(ScreenModeDepth())+"@"+Str(ScreenModeRefreshRate())+"Hz"
        Wend
      EndIf
      
      MessageRequester("Pause", "Click to go")
      
      If OpenWindow(0, 0, 0, 640, 400, "Test", #PB_Window_SystemMenu|#PB_Window_ScreenCentered)
        If OpenWindowedScreen(WindowID(0), 0, 0, 640, 400)
          ScreenOk = #True
        EndIf
      EndIf
    Else
      If OpenScreen(640, 480, 32, "C64 loading")
        ScreenOk = #True
      EndIf
    EndIf
    If ScreenOk
      If LoadImage(0, "c:\tmp\C64.jpg")
        If CreateSprite(0, 640, 480)
         
          Repeat
            
            If #WindowedScreen
              Repeat
                Event = WindowEvent()
                
                If Event = #PB_Event_CloseWindow
                  Exit = #True
                EndIf
                
              Until Event = 0
            EndIf
            
            ClearScreen(0)
             
            If IsImage(0)
              GrabImage(0, 1, x, y, 20, 20)
              If StartDrawing(SpriteOutput(0))
                DrawImage(ImageID(1), x, y)
                StopDrawing()               
                x + 20
                If x = 640
                  x = 0
                  y + 20
                  If y = 400
                    FreeImage(0)
                  EndIf
                EndIf
              EndIf
              FreeImage(1)
            EndIf
           
            DisplaySprite(0, 0, 0)
             
            FlipBuffers()
           
            ExamineKeyboard()
           
          Until KeyboardReleased(#PB_Key_Escape) Or Exit
         
        Else
          MessageRequester("Error", "CreateSprite() failed")
        EndIf
      Else
        MessageRequester("Error", "LoadImage() failed")
      EndIf
    Else
      MessageRequester("Error", "OpenScreen() failed")
    EndIf
  Else
    MessageRequester("Error", "InitKeyboard() failed")
  EndIf
Else
  MessageRequester("Error", "InitSprite() failed")
EndIf
Bernd
Last edited by infratec on Fri Oct 02, 2015 7:03 am, edited 4 times in total.
Swos2009
Enthusiast
Enthusiast
Posts: 112
Joined: Sat Nov 08, 2008 8:19 pm

Re: C64 Loading screen?

Post by Swos2009 »

I dont understand why I got the error

http://oi62.tinypic.com/2803w3r.jpg
infratec
Always Here
Always Here
Posts: 7625
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: C64 Loading screen?

Post by infratec »

Hi,

that's strange.
At home I have also a fault.
At home I use PB 5.40b8 x86 on Win7 x64.
On my office PC it works like expected.
I changed the example to make it 'bullet proof', but it even than I get in trouble.

OpenScreen() fails in my case, but I don't know why.

Bernd
infratec
Always Here
Always Here
Posts: 7625
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: C64 Loading screen?

Post by infratec »

Found it:

640x400 is not supported by my graphics card.
I have to use 640x480.

Try the listing above.
I extended it to show the possible sizes.

But I still don't know why the code stucks with OpenWindowedScreen().

Bernd
Swos2009
Enthusiast
Enthusiast
Posts: 112
Joined: Sat Nov 08, 2008 8:19 pm

Re: C64 Loading screen?

Post by Swos2009 »

Excellent man and it work so well....

MY PC is AMD 10 7100 Laptop :)
infratec
Always Here
Always Here
Posts: 7625
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: C64 Loading screen?

Post by infratec »

Now also the OpenWindowedScreen() version works.
If you use it, you need an event loop.

Bernd
Post Reply