Forum > Games

Image inside Bitmap

<< < (4/4)

furious programming:

--- Quote from: Handoko on January 24, 2023, 04:51:40 am ---As far as I know the lowest possible value for TTimer.Interval is 15 on Windows 7, any lower value will be ignored.

--- End quote ---

Typically, the minimum interval is about 10ms on all Windows systems (at least since Windows XP). The minimum available interval is 1ms, but to activate it, use the timeBeginPeriod function, and when high resolution is no longer needed, restore the previous one using the timeEndPeriod function. Two simple functions are enough for this:

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---uses  MMSystem; var  TimePeriod: Integer = -1; procedure InitializeShedulerResolution();var  Periods: TTimeCaps;begin  if TimeGetDevCaps(@Periods, SizeOf(Periods)) = TIMERR_NOERROR then    if TimeBeginPeriod(Periods.wPeriodMin) = TIMERR_NOERROR then      TimePeriod := Periods.wPeriodMin;end; procedure FinalizeShedulerResolution();begin  if TimePeriod <> -1 then    TimeEndPeriod(TimePeriod);end; 
This is an example of setting a minimum interval, once for the entire program session.

Within one session of the program, the resolution of the sheduler can be changed many times, but there must be the same number of calls to timeBeginPeriod as to timeEndPeriod. You can change the resolution only when you need it and then restore it right away. This will allow you to use slightly less energy and increase system performance, because the sheduler will run at a higher resolution only at specific times, not for the entire session of the program. Although in the end, the system will decide it anyway, but it would be good to help it with this.

When creating games, you don't have to worry about it, because libraries such as SDL take care of it for us.



What follow is not related with Pascal Lazarus, but with game development.

If in the future you're interested, with creating Games,

Try Godot it's a 2D/3D opensource Game Engine.

Work on Windows, Linux and Mac.

you can use Python or C# language.



[0] Message Index

[*] Previous page

Go to full version