Recent

Recent Posts

Pages: [1] 2 3 ... 10
1
FPC development / Re: create system unit from scratch
« Last post by Laksen on Today at 01:28:35 pm »
Those missing types are defined a platform specific sysosh.inc

For something like the PS1 maybe take a look at how the embedded platform structures the system unit and the sys*.inc contents
2
Other / Re: How to fu*k the Windows Defender
« Last post by BrassGear on Today at 01:24:31 pm »
Why is it necessary to use a poorly disguised vulgar cuss word when asking a question?

That is unfortunately how it often feels to deal with modern windows. :(

There's some good advice in this thread, thanks.
3
Graphics / Re: Spiral of Theodorus: Reversed n Rotate n Fills
« Last post by Roland57 on Today at 01:24:14 pm »
Thanks Roland57 for your transparent  BGRABitmap version.

I replaced the method for computing points, with another method that I find easier to understand.
4
my guess is that a pre-made game engine offers way more possibilities and can do more than just paint a screen so I assume with a game engine it can be more easy to handle your ideas and help you to do the same in less time, more robust and stable, with ready do use methods and bling bling.

You are probably correct. My expectations for the game were different when I made the decision.
5
FPC development / Re: create system unit from scratch
« Last post by Key-Real on Today at 01:14:09 pm »
OK, I can't define {$MODE FPC}
6
Third party / Re: InstallAware Using Lazarus IDE
« Last post by dbannon on Today at 01:05:38 pm »
It never passed any scrutiny. Bad software from 40 years ago is still bad software.

From their own website, https://www.installaware.com/company-overview.htm :

InstallAware Software, founded in 2003 by InstallShield alumni, is a software development company......... and is a Borland Technology Partner.

So, 40 years is a bit of a stretch. And I included the end of that paragraph just for fun !

Davo

7
FPC development / create system unit from scratch
« Last post by Key-Real on Today at 01:01:39 pm »
I looked at other implementation and the first thing all do is to include systemh.inc, so i do the same:

Code: Pascal  [Select][+][-]
  1. unit system;
  2. {$MODE FPC}
  3. interface
  4.  
  5. {$I systemh.inc}
  6.  
  7. implementation
  8. end.


but this gives me:



Compiling ./rtl/ps1/system.pp
systemh.inc(23,2) Error: Mode switch "OBJFPC" not allowed here
filerec.inc(33,17) Error: Identifier not found "THandle"
filerec.inc(33,24) Error: Error in type definition
textrec.inc(38,17) Error: Identifier not found "THandle"
textrec.inc(38,24) Error: Error in type definition
systemh.inc(867,17) Error: Identifier not found "TThreadID"
systemh.inc(867,26) Error: Error in type definition
mathh.inc(200,53) Fatal: Syntax error, ")" expected but "=" found
Fatal: Compilation aborted
8
How could any generalist game engine compete with that kind of simplicity and efficiency? The simple answer is they can't really.
How should anyone judge - we see no code?
So the only thing thats left is guessing or assuming, my guess is that a pre-made game engine offers way more possibilities and can do more than just paint a screen so I assume with a game engine it can be more easy to handle your ideas and help you to do the same in less time, more robust and stable, with ready do use methods and bling bling.
For 2D games, anything goes (even unaccelerated bitmaps, depend of course on type of game), for 3D my advise would be to watch different game engines and their features.
9
FPC development / Improvement of TFPTimerThread.Execute
« Last post by lagprogramming on Today at 12:53:29 pm »
packages/fcl-base/src/fptimer.pp has
Code: Pascal  [Select][+][-]
  1. {$ifdef Has_EventWait}
  2. procedure TFPTimerThread.Execute;
  3. var
  4.   WakeTime, StartTime: TDateTime;
  5.   WakeInterval: Integer;
  6.   Counter: int64; { use Int64 to avoid overflow with Counter*fInterval (~49 days)}
  7.   AInterval: int64;
  8.   Diff: Extended;
  9.  
  10. Const
  11.   wrSignaled = 0;
  12.   wrTimeout  = 1;
  13.   wrAbandoned= 2;
  14.   wrError    = 3;
  15.  
  16. begin
  17.   WakeInterval := MaxInt;
  18.   Counter := 1;
  19.   AInterval := fInterval;
  20.   FStartTime := Now;
  21.   while not Terminated do
  22.     begin
  23.     if GetWakeTime(AInterval,Counter,WakeInterval,WakeTime) then
  24.       Continue;
  25.     if not Terminated then
  26.       case BasicEventWaitFor(WakeInterval,fWaitEvent) of
  27.       wrTimeout:
  28.         begin
  29.         if Terminated then
  30.           Break
  31.         else
  32.           begin
  33.           try
  34.             if not Timer.UseTimerThread then
  35.               // If terminate is called while here, then the Synchronize will be
  36.               // queued while the stoptimer is being processed.
  37.               // StopTimer cannot wait until thread completion as this would deadlock
  38.               Synchronize(@Timer.Timer)  // Call user event
  39.             else
  40.               Timer.Timer;
  41.           except
  42.             // Trap errors to prevent this thread from terminating
  43.           end;
  44.           Inc(Counter);                // Next interval
  45.           end;
  46.         end;
  47.       wrSignaled:
  48.         begin
  49.         if Terminated then
  50.           Break
  51.         else
  52.           begin                      // Interval has changed
  53.           Counter := 1;              // Restart timer without creating new thread
  54.           AInterval := fInterval;
  55.           FStartTime := Now;
  56.           end;
  57.         end;
  58.       else
  59.         Break;
  60.       end
  61.     end;
  62.   BasicEventDestroy(fWaitEvent);
  63. end;
  64.  
  65. {$ELSE Has_EventWait}
  66.  
  67. procedure TFPTimerThread.Execute;
  68.  
  69. var
  70.   WakeTime, StartTime: TDateTime;
  71.   WakeInterval: Integer;
  72.   Counter: int64; { use Int64 to avoid overflow with Counter*fInterval (~49 days)}
  73.   AInterval: int64;
  74.   Diff: Extended;
  75.   S,Last: Cardinal;
  76.   RecheckTimeCounter: integer;
  77.  
  78. const
  79.   cSleepTime = 500;           // 0.5 second, better than every 5 milliseconds
  80.   cRecheckTimeCount = 120;    // Recheck clock every minute, as the sleep loop can loose time
  81.  
  82. begin
  83.   WakeInterval := MaxInt;
  84.   Counter := 1;
  85.   AInterval := fInterval;
  86.   FStartTime := Now;
  87.   while not Terminated do
  88.     begin
  89.     if GetWakeTime(AInterval,Counter,WakeInterval,WakeTime) then
  90.       Continue;
  91.     if not Terminated then
  92.       begin
  93.       RecheckTimeCounter := cRecheckTimeCount;
  94.       s := cSleepTime;
  95.       repeat
  96.         if s > WakeInterval then
  97.           s := WakeInterval;
  98.         sleep(s);
  99.         if fSignaled then            // Terminated or interval has changed
  100.           begin
  101.           if not Terminated then
  102.             begin
  103.             fSignaled := False;
  104.             Counter := 1;            // Restart timer
  105.             AInterval := fInterval;
  106.             StartTime := Now;
  107.             end;
  108.           break;                     // Need to break out of sleep loop
  109.           end;
  110.  
  111.         dec(WakeInterval,s);         // Update total wait time
  112.         dec(RecheckTimeCounter);     // Do we need to recheck current time
  113.         if (RecheckTimeCounter < 0) and (WakeInterval > 0) then
  114.           begin
  115.           Diff := (WakeTime - Now);
  116.           WakeInterval := Trunc(Diff * cMilliSecs);
  117.           RecheckTimeCounter := cRecheckTimeCount;
  118.           s := cSleepTime;
  119.           end;
  120.       until (WakeInterval<=0) or Terminated;
  121.       if WakeInterval <= 0 then
  122.         try
  123.           inc(Counter);
  124.           if not Timer.UseTimerThread then
  125.             // If terminate is called while here, then the Synchronize will be
  126.             // queued while the stoptimer is being processed.
  127.             // StopTimer cannot wait until thread completion as this would deadlock
  128.             Synchronize(@Timer.Timer)  // Call user event
  129.           else
  130.             Timer.Timer;
  131.         except
  132.           // Trap errors to prevent this thread from terminating
  133.         end;
  134.       end
  135.     end;
  136. end;
  137. {$ENDIF Has_EventWait}





Variable "Last" is declared but never used, which means it can be removed.
Looking at variable StartTime I've noticed that when Has_EventWait is defined, the variable can be removed because it's not used at all. But then I've looked at the content of the procedure when Has_EventWait is not defined. It has just a simple assignment: StartTime := Now;. When Has_EventWait is defined the equivalent line is FStartTime := Now;. It doesn't look right. Looks like a bug, a typo. Most likely should have been "FStartTime := Now;" instead of "StartTime := Now;".
Here is a patch.
10
General / Re: Assign (textfile) not compiling - sometimes.
« Last post by Thaddy on Today at 12:18:09 pm »
That does not make these things any better. It is not Pascal.
Pages: [1] 2 3 ... 10

TinyPortal © 2005-2018