Page 1 of 1

C64 Loading screen?

Posted: Wed Sep 30, 2015 8:28 pm
by Swos2009

Re: C64 Loading screen?

Posted: Wed Sep 30, 2015 10:06 pm
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

Re: C64 Loading screen?

Posted: Wed Sep 30, 2015 11:01 pm
by Swos2009
Nice one :) thanks and I would like do full screen without CanvasGadget...

do I have change open screen setting?

Re: C64 Loading screen?

Posted: Thu Oct 01, 2015 6:51 am
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

Re: C64 Loading screen?

Posted: Thu Oct 01, 2015 10:08 pm
by Swos2009
I dont understand why I got the error

http://oi62.tinypic.com/2803w3r.jpg

Re: C64 Loading screen?

Posted: Thu Oct 01, 2015 11:23 pm
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

Re: C64 Loading screen?

Posted: Thu Oct 01, 2015 11:44 pm
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

Re: C64 Loading screen?

Posted: Fri Oct 02, 2015 12:14 am
by Swos2009
Excellent man and it work so well....

MY PC is AMD 10 7100 Laptop :)

Re: C64 Loading screen?

Posted: Fri Oct 02, 2015 7:03 am
by infratec
Now also the OpenWindowedScreen() version works.
If you use it, you need an event loop.

Bernd