DigitalClock Animation

Share your advanced PureBasic knowledge/code with the community.
User avatar
Keya
Addict
Addict
Posts: 1890
Joined: Thu Jun 04, 2015 7:10 am

Re: DigitalClock Animation

Post by Keya »

StarBootics wrote:By the way did you try my version of Snakes of balls demo on WinXP and Win 7 ?
i just get the same "Can't open screen !" errmsg
User avatar
StarBootics
Addict
Addict
Posts: 1006
Joined: Sun Jul 07, 2013 11:35 am
Location: Canada

Re: DigitalClock Animation

Post by StarBootics »

I can't reproduce this problem under WinXP, I get an error about creating sprites instead.

I don't have any computer with Win7 so you will have to figure out the problem your self. Perhaps a bug in PureBasic V5.50.

If you try this code :

Code: Select all

If InitKeyboard() = 0 Or InitSprite() = 0 Or InitMouse() = 0 ; Or InitSprite3D() = 0
  MessageRequester("ERROR","Can't initialize DirectX !")
  End 
EndIf 

ExamineDesktops()
Screen_W = DesktopWidth(0)
Screen_H = DesktopHeight(0)

If OpenScreen(Screen_W, Screen_H, 32, "Sprite Demo") = 0 
  MessageRequester("ERROR", "Can't open 32 bit screen !")
  If OpenScreen(Screen_W, Screen_H, 24, "Sprite Demo") = 0 
    MessageRequester("ERROR", "Can't open 24 bit screen !")
    If OpenScreen(Screen_W, Screen_H, 16, "Sprite Demo") = 0 
      MessageRequester("ERROR", "Can't open 16 bit screen !")
      End
    EndIf
  EndIf
EndIf 

Repeat 
  
  If IsScreenActive() 
    
    ClearScreen(0)
 
  Else 
    
    Delay(10) 
    
  EndIf 
  
  FlipBuffers() 
  ExamineMouse()
  ExamineKeyboard() 
  
Until KeyboardPushed(#PB_Key_All) ; MouseDeltaX() Or MouseDeltaY() Or MouseWheel() Or 

CloseScreen()

End 
What do get as error message ?

Best regards
StarBootics
The Stone Age did not end due to a shortage of stones !
User avatar
Keya
Addict
Addict
Posts: 1890
Joined: Thu Jun 04, 2015 7:10 am

Re: DigitalClock Animation

Post by Keya »

in both XP and Win7 i get the same result ... Can't open 32bit screen, click ok, then Cant open 24bit screen, click ok, then Cant open 16bit screen
User avatar
StarBootics
Addict
Addict
Posts: 1006
Joined: Sun Jul 07, 2013 11:35 am
Location: Canada

Re: DigitalClock Animation

Post by StarBootics »

Keya wrote:in both XP and Win7 i get the same result ... Can't open 32bit screen, click ok, then Cant open 24bit screen, click ok, then Cant open 16bit screen
Very strange to me, look like a bug somewhere within PureBasic it's self.

Just for curiosity :

Code: Select all

  InitSprite()

  If ExamineScreenModes()
    While NextScreenMode()
      Debug Str(ScreenModeWidth())+"x"+Str(ScreenModeHeight())+"x"+Str(ScreenModeDepth())+"@"+Str(ScreenModeRefreshRate())+"Hz"
    Wend
  EndIf
Best regards
StarBootics
The Stone Age did not end due to a shortage of stones !
User avatar
Keya
Addict
Addict
Posts: 1890
Joined: Thu Jun 04, 2015 7:10 am

Re: DigitalClock Animation

Post by Keya »

800x600x16@60Hz
640x480x16@60Hz
1024x768x16@60Hz
1152x864x16@60Hz
1280x960x16@60Hz
800x600x32@60Hz
640x480x32@60Hz
1024x768x32@60Hz
1152x864x32@60Hz
1280x960x32@60Hz
1280x960x32@60Hz
800x600x32@60Hz

im using 5.42LTS, but i just also tested with 5.31 and same problem
I also redid all the tests in both inside VM and on my non-VM host machine, same problem
I dont play any games so perhaps i dont have directx or opengl or whatever installed - if that's needed?
Last edited by Keya on Sat Sep 10, 2016 3:40 am, edited 1 time in total.
User avatar
StarBootics
Addict
Addict
Posts: 1006
Joined: Sun Jul 07, 2013 11:35 am
Location: Canada

Re: DigitalClock Animation

Post by StarBootics »

Keya wrote:800x600x16@60Hz
640x480x16@60Hz
1024x768x16@60Hz
1152x864x16@60Hz
1280x960x16@60Hz
800x600x32@60Hz
640x480x32@60Hz
1024x768x32@60Hz
1152x864x32@60Hz
1280x960x32@60Hz
1280x960x32@60Hz
800x600x32@60Hz

im using 5.42LTS, but i just also tested with 5.31 and same problem
This doesn't make any sense ! You should be able to open a screen properly with one of these settings. You should report this as a bug under Windows. But first make sure you have the latest graphic card driver installed, perhaps the problem came from there.

Edit : I have discovered an issue in the FullScreen Module, it's now corrected, see the First post for the download link.

Best regards
StarBootics
The Stone Age did not end due to a shortage of stones !
User avatar
Kwai chang caine
Always Here
Always Here
Posts: 5494
Joined: Sun Nov 05, 2006 11:42 pm
Location: Lyon - France

Re: DigitalClock Animation

Post by Kwai chang caine »

StarBootics wrote:Can you run this code and post back the Debugger output ?
Best regards
StarBootics
Excuse me for the late answer :oops:
This is the result
Debugger wrote:1680
1050
32
ImageThe happiness is a road...
Not a destination
User avatar
StarBootics
Addict
Addict
Posts: 1006
Joined: Sun Jul 07, 2013 11:35 am
Location: Canada

Re: DigitalClock Animation

Post by StarBootics »

Hello everyone,

I have updated the source to solve the problem pointed out by Kwai chang caine (thanks by the way), see DigitalClock::CreateScreen() instruction for details.
See the first post for the download link.

Best regards
StarBootics
The Stone Age did not end due to a shortage of stones !
User avatar
StarBootics
Addict
Addict
Posts: 1006
Joined: Sun Jul 07, 2013 11:35 am
Location: Canada

Re: DigitalClock Animation

Post by StarBootics »

Hello everyone,

I have take a little break from my game project and re-visited an old code. So this is the version 6 of the DigitalClock FullScreen animation. Nothing is different from the previous version. The main difference is the OOP programming style just to see if the code get any slower in comparison with the Modular approach. I don't see any difference at all. You can download the new source code here :

https://www.dropbox.com/s/vo9v57dh41488 ... 6.zip?dl=0

Best regards
StarBootics
The Stone Age did not end due to a shortage of stones !
Post Reply