Jump to content

Disappearing countdown timer in OpenGL


Recommended Posts

Hi, I hope that you can help me. I'm having a problem with the countdown timer disappearing in some programs that use OpenGL.
When I start the program, my timer disappears, I exit the program and it's there.
Not all programs do it like those that use Direct3D, Directdraw or Directx, only those that use OpenGL do it.

Link to comment
Share on other sites

AdlibRegister("Clock", 1000)

HotKeySet("{esc}", "exit1")

$seconds = 60

GUICreate("Timer", 181, 50)
GUISetBkColor(0x000000)
GUICtrlCreateLabel("00:00:00", 10, 0, 200, 70)
GUICtrlSetFont(-1, 30, 800)
GUICtrlSetBkColor(-1, 0x000000)
GUICtrlSetColor(-1, 0xFFFFFF)
GUISetState(@SW_SHOW)

While True
    $minutes = Mod($seconds / 60, 60)
    $hours = $seconds / 3600
    $display = StringFormat("%02i:%02i:%02i", $hours, $minutes, Mod($seconds, 60))
    WinSetOnTop("Timer", "", 1)
WEnd

Func clock()
    If $seconds = 30 Then
        SoundPlay(@WindowsDir & "\media\tada.wav")
    EndIf

    If $seconds < 10 And $seconds > 0  Then
        SoundPlay(@WindowsDir & "\media\ding.wav")
        If Mod($seconds, 2) = 0 Then
            GUICtrlSetColor(-1, 0xff0000)
        Else
            GUICtrlSetColor(-1, 0xffffff)
        EndIf
    EndIf

    If $seconds = 0 Then
        SoundPlay(@WindowsDir & "\media\Ring01.wav")
    EndIf

    If $seconds > 0 Then
        $seconds -= 1
    EndIf
    GUICtrlSetData(-1, $display)
EndFunc   ;==>clock

Func exit1()
    Exit
EndFunc   ;==>exit1
Link to comment
Share on other sites

When you post code, please use the method described in the link.  Thanks.

Your code looks good, if that does not work with opengl windows, try using :

 

One comment on your script, you should put a small sleep inside your main loop to reduce cpu consumption.

Link to comment
Share on other sites

If I had to guess, the app is using a hardware overlay (full screen perhaps?) and obscuring any and all other windows.

The way to test that is to try a screen capture. If the app is not captured, then it's an overlay and not much to be done about it aside from using a secondary monitor to display the timer or forcing the app to run in windowed mode (if it supports that).

Link to comment
Share on other sites

I understand the forum rules.  I can't find another example to explain it to you.  : I have 5 computers that I rent.  When playing certain games, some do watch the timer, but not others.  Checking it I realized that those who use opengl don't look.  

I do this to control time.  Using my rental computer

Link to comment
Share on other sites

  • Developers
Posted (edited)

So you understand the rules and then you go on saying you want to use this stuff for game automation..   really?

So explain please!

Ps: all others please stay out for now.

Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Hello, I think I didn't explain myself well. An apology for that since my English is not good.
Jos, what I meant is that I have the computers in an Internet cafe and I rent them for a certain period of time.

My clients tell me they don't look at my remaining screen time. That happens when they play or when they are on the internet or doing works shool, etc.

The timer is for my clients to see the time they have left to use the PC.

but thanks to everyone.

problem solved

Link to comment
Share on other sites

1 hour ago, angel83 said:

problem solved

Fine.  But since you asked us for help, the least you could do is to tell us how you solved your issue.

I am sure community would appreciate an explanation. 

Link to comment
Share on other sites

  • Developers
4 hours ago, Nine said:

Fine.  But since you asked us for help, the least you could do is to tell us how you solved your issue.

Though we had an agreement not to post in threads that aren't cleared after we request to stay out? 

On 3/21/2024 at 9:02 PM, Jos said:

Ps: all others please stay out for now.

 

5 hours ago, angel83 said:

The timer is for my clients to see the time they have left to use the PC.

This is a somewhat strange explanation after your first vague comment about being familiar with our forum rules, but since you have solved it, I will close this thread.

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

  • Jos locked this topic
Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...