Game Counter & Odometer & Digital clock - all OS - [Module]

Share your advanced PureBasic knowledge/code with the community.
User avatar
Saki
Addict
Addict
Posts: 830
Joined: Sun Apr 05, 2020 11:28 am
Location: Pandora

Re: Game Counter - Odometer

Post by Saki »

Hi,
Code updated.
The bugs should all be removed now.

Under MacOS there is a unknown PB bug with the clipping.
From the background image only the alpha channel is clipped away and the background are shifted, not clipped.
The DrawText output is not clipped at all.
This look at the first very strange and it damage the output completelly.

The clipping under MacOS is now disabled.

In different fonts, the position of the actual letters within its frame is often slightly different.
For example, in the "verdana" font, the letters are set a little lower and a little larger.
There are also fonts like "Georgia", where the numbers are even very different in size,
so you can't align them automatically, because a used clipping, you have to see how it fits and looks best.

Settings Font "verdana" :
Define v_adjust_odo.q=-3 ; Fine adjust the vertical char position
Define clip_output_yy_odo.d=-10 ; Clipping offset yy

I had forgotten:
Using Delay(1) is the usual way to lower the core load.
Using WindowEvent() here did not work off all the events, that then makes freeze problems.
You then do this with a sub loop to process all events.
I had forgotten to change it.

Tomorrow I look for further, please test again.
The next stepp is try make a procedure.
If this works, a module.
地球上の平和
User avatar
Saki
Addict
Addict
Posts: 830
Joined: Sun Apr 05, 2020 11:28 am
Location: Pandora

Re: Game Counter - Odometer [MODULE]

Post by Saki »

Code Updated

Hi all,

The module is ready.
地球上の平和
User avatar
Kwai chang caine
Always Here
Always Here
Posts: 5342
Joined: Sun Nov 05, 2006 11:42 pm
Location: Lyon - France

Re: Game Counter & Odometer - all OS - x64x86 [MODULE]

Post by Kwai chang caine »

Works always also good, in better nice :D
Thanks for sharing 8)
ImageThe happiness is a road...
Not a destination
davido
Addict
Addict
Posts: 1890
Joined: Fri Nov 09, 2012 11:04 pm
Location: Uttoxeter, UK

Re: Game Counter & Odometer - all OS - x64 x86 [MODULE]

Post by davido »

@Saki,

Just tried your latest Module version.
Looks fine to me.
Thank you for sharing this complicated code. :D



System: MacBookPro17,1 ; Apple M1 ;macOS 11.2.2 (20D80) ;Darwin 20.3.0
DE AA EB
User avatar
Saki
Addict
Addict
Posts: 830
Joined: Sun Apr 05, 2020 11:28 am
Location: Pandora

Re: Game Counter & Odometer - all OS - x64 x86 [MODULE]

Post by Saki »

Hi Kwai and davido.
Thank you very much.

@davido
On macOS I fixed another bug, please get the latest version.

I have reported the PB bug(s) I found on macOS.

If those are fixed by Fred you can re-enable the lines marked or commented out in the code.

Best Regards Saki
地球上の平和
davido
Addict
Addict
Posts: 1890
Joined: Fri Nov 09, 2012 11:04 pm
Location: Uttoxeter, UK

Re: Game Counter & Odometer - all OS - x64 x86 [MODULE]

Post by davido »

@Saki,

Thank you.
I've tested your updated code on my MacBook and find it not much different than before. I am happy with it. :D

I checked on a PC and can confirm that the PC shows graduated gold/yellow numbers whereas the Mac has plain yellow numbers.
Still fine for me, though.
DE AA EB
User avatar
Saki
Addict
Addict
Posts: 830
Joined: Sun Apr 05, 2020 11:28 am
Location: Pandora

Re: Game Counter & Odometer & Digitalclock - all OS - [Modu

Post by Saki »

Many thanks davido.

Code updated - Main update

Counter now with System clock synchronisation available.

Digital clock with animation available.

Please look at the first posting.

Have fun
地球上の平和
User avatar
Saki
Addict
Addict
Posts: 830
Joined: Sun Apr 05, 2020 11:28 am
Location: Pandora

Re: Game Counter & Odometer & Digital clock - all OS - [Mod

Post by Saki »

Code updated

Little fixes and many enhancements.

Extra designs added for the digital clock,
looks pretty good. :wink:

Image

Image

Image
地球上の平和
User avatar
Saki
Addict
Addict
Posts: 830
Joined: Sun Apr 05, 2020 11:28 am
Location: Pandora

Re: Game Counter & Odometer & Digital clock - all OS - [Mod

Post by Saki »

Bugfix
Scrolling up numbers are offset by 1 pixel
Only visible in Counter mode, not visible in Clock mode.

I hadn't noticed that on my 4K monitor with high scaling and DPI aware.
On standard monitors, however, you see it right away.
Also Padding yy adjustment because this issue.

I've reached the point where I want to say that fine tuning and DPI aware without a
4K monitor factually not possible.

This is all very very annoying and time consuming. :evil:

Please check in from time to time and download the latest code, as I can't announce everything.

The code is now also included in the GFX_Wizzard_BF archive and will be maintained there.
viewtopic.php?f=12&t=66927
地球上の平和
User avatar
Saki
Addict
Addict
Posts: 830
Joined: Sun Apr 05, 2020 11:28 am
Location: Pandora

Re: Game Counter & Odometer & Digital clock - all OS - [Mod

Post by Saki »

Code enhanced and Little fixes

12h AM/PM mode added.

The clock can now be switched between 24hr and 12hr AM/PM at will,
even on demand during operation. :wink:

Many different designs selectable.

Image

Image
地球上の平和
User avatar
Saki
Addict
Addict
Posts: 830
Joined: Sun Apr 05, 2020 11:28 am
Location: Pandora

Re: Game Counter & Odometer & Digital clock - all OS - [Mod

Post by Saki »

Code updated

Max Value - Min Value overflow fixed
Stop function fixed

These were regressions caused by the installation of the clock function and were only noticed now after intensive testing.
But it is important that they work.

The stop function is synchronized with the time (Second(Date()) based counter output and the clock output.

The PB Unix Date() function can also be replaced very simple by a DateEX() function if needed.

If they need two or more clocks, for example, then they simply duplicate the module.
You only have to change the name of the module and the names of the global procedures a little.
If you do not use "UseModule" it is enough to change only the name of the module.
This is only a minute of work.

Since this code is quite important, it is and will remain completely free, even if it is included in the GFX_Wizzard_BF archive.
viewtopic.php?f=12&t=66927

Remember that small code changes and optimizations are not announced.

Now all is final final. :wink:
地球上の平和
davido
Addict
Addict
Posts: 1890
Joined: Fri Nov 09, 2012 11:04 pm
Location: Uttoxeter, UK

Re: Game Counter & Odometer & Digital clock - all OS - [Mod

Post by davido »

@Saki,
Thank you for all the work you have done to get this working with MacOS.
DE AA EB
User avatar
Saki
Addict
Addict
Posts: 830
Joined: Sun Apr 05, 2020 11:28 am
Location: Pandora

Re: Game Counter & Odometer & Digital clock - all OS - [Mod

Post by Saki »

Thank you very much davido.
I also want to give you a special treat.
I think I can emulate the missing GradientColor function for the text under MacOS, as well as the missing clipping.

This may sound strange, but let's see. :wink:

I'll take a look at it today.
地球上の平和
User avatar
Kwai chang caine
Always Here
Always Here
Posts: 5342
Joined: Sun Nov 05, 2006 11:42 pm
Location: Lyon - France

Re: Game Counter & Odometer & Digital clock - all OS - [Mod

Post by Kwai chang caine »

Works great here :D
Thanks for sharing all this versions more and more nice 8)
ImageThe happiness is a road...
Not a destination
davido
Addict
Addict
Posts: 1890
Joined: Fri Nov 09, 2012 11:04 pm
Location: Uttoxeter, UK

Re: Game Counter & Odometer & Digital clock - all OS - [Mod

Post by davido »

@Saki,
That'll be a neat trick!
Also most welcome. Thank you for attempting this.
DE AA EB
Post Reply