Recent

Author Topic: Animation for a four-in-a-row game  (Read 5975 times)

winni

  • Hero Member
  • *****
  • Posts: 3197
Re: Animation for a four-in-a-row game
« Reply #30 on: September 09, 2020, 11:07:46 pm »

The essential thing is that there is a canvas :) .

Hi!

That is not true.
You can do all work with BGRAbitmap and friends without ever using a Canvas.

You can use a Canvas - If you like it.
But then  you dont have Floating Point coordinates.

You should use the Canvas2D if you need HTML-like graphics.

So your statement about drawing is true for the LCL.
But not for all the graphic libraries.

Winni

circular

  • Hero Member
  • *****
  • Posts: 4196
    • Personal webpage
Re: Animation for a four-in-a-row game
« Reply #31 on: September 10, 2020, 04:11:11 am »
devEric69 is talking about the fact that we can actually display something whether it is with TImage or TPaintBox. So it is true.

What you say would be between TImage and TBGRAVirtualScreen or between TBitmap and TBGRABitmap.
Conscience is the debugger of the mind

Roland57

  • Sr. Member
  • ****
  • Posts: 421
    • msegui.net
Re: Animation for a four-in-a-row game
« Reply #32 on: September 12, 2020, 10:27:32 am »
Thank you all for the informative discussion. Here is the final version of the demo. It is ready to be used for the Velena project.  :)
« Last Edit: September 12, 2020, 06:28:15 pm by Roland57 »
My projects are on Gitlab and on Codeberg.

circular

  • Hero Member
  • *****
  • Posts: 4196
    • Personal webpage
Re: Animation for a four-in-a-row game
« Reply #33 on: September 12, 2020, 06:44:52 pm »
Hi,

It works nicely.

For MacOS compatibility, you need to specify the path for the images. If you run the program as you would do on Linux or Windows, i.e., not using an application bundle, then the directory would be:
Code: Pascal  [Select][+][-]
  1. function GetImageDir: string;
  2. begin
  3.   result := ExtractFilePath(Application.ExeName) + 'images' + PathDelim;
  4. end;

And then use it when you access the images:
Code: Pascal  [Select][+][-]
  1. if FindFirst(GetImageDir+'*', faAnyFile or faDirectory, LRec) = 0 then

Note that when running the program without a bundle, you will get a terminal opening as well. But making an application bundle is another story.
Conscience is the debugger of the mind

Roland57

  • Sr. Member
  • ****
  • Posts: 421
    • msegui.net
Re: Animation for a four-in-a-row game
« Reply #34 on: September 13, 2020, 04:01:20 am »
For MacOS compatibility, you need to specify the path for the images.

Hi! Thank you for the information and for the snippet. I incorporated it in the code.
My projects are on Gitlab and on Codeberg.

Roland57

  • Sr. Member
  • ****
  • Posts: 421
    • msegui.net
Re: Animation for a four-in-a-row game
« Reply #35 on: September 13, 2020, 12:24:10 pm »
The new version of Velena is ready.

https://github.com/rchastain/velena

@circular
Thank you very much for your contribution.  ;)
My projects are on Gitlab and on Codeberg.

circular

  • Hero Member
  • *****
  • Posts: 4196
    • Personal webpage
Re: Animation for a four-in-a-row game
« Reply #36 on: September 13, 2020, 03:11:08 pm »
You're welcome my friend  :)
Conscience is the debugger of the mind

winni

  • Hero Member
  • *****
  • Posts: 3197
Re: Animation for a four-in-a-row game
« Reply #37 on: September 22, 2020, 02:56:58 am »
@Roland57 - and to whom it may concern:

Again:

Code: Text  [Select][+][-]
  1. WARNING: TGtk2WidgetSet.InvalidateRect refused invalidating during paint message: TBGRAdialog
  2. WARNING: TGtk2WidgetSet.InvalidateRect refused invalidating during paint message: TBGRAdialog
  3. WARNING: TGtk2WidgetSet.InvalidateRect refused invalidating during paint message: TBGRAdialog
  4. WARNING: TGtk2WidgetSet.InvalidateRect refused invalidating during paint message: TBGRAdialog

The " Bad Boy" is TBCButton:
It has three states: normal,  hover, clicked

Every time the mouse goes over the Button the state and the design changes: from normal to hover. And with every MouseMove the above message is triggered four times.

So: Don't care about it.
It just says that it wants to paint again while it is painting.

Poor Painterman.

Winni

 

TinyPortal © 2005-2018