[SOLVED] can you put sprites in the "tableWindow"?

Game development with Board Game Arena Studio
Post Reply
User avatar
Nierin
Posts: 10
Joined: 13 September 2015, 15:11

[SOLVED] can you put sprites in the "tableWindow"?

Post by Nierin »

Let's say you have a table that show some strings :

(from ###.game.php )

Code: Select all

$this->notifyAllPlayers( "tableWindow", '', array(
    "id" => 'finalScoring',
    "title" => clienttranslate("Result of this round"),
    "table" => array( array( "one", "two"  ), array( "three", "four" ) ),
    "closing" => clienttranslate( "Ok" )
) ); 
and some "1 2 3 4" images in a "numbers.png" file in the img folder (like 40*40 pixels in a 160*40 pixels file )

Is there an easy way to put the images in place of the strings?
Last edited by Nierin on 12 February 2021, 22:07, edited 1 time in total.
User avatar
Tisaac
Posts: 2736
Joined: 26 August 2014, 21:28

Re: can you put sprites in the "tableWindow"?

Post by Tisaac »

Just put some div/span with a background image in css.
User avatar
Lymon Flowers
Posts: 195
Joined: 01 April 2020, 21:14

Re: can you put sprites in the "tableWindow"?

Post by Lymon Flowers »

You can do the same trick as in the logs to replace variables with sprites as all strings are passed through format_string_recursive(). I have done that for downforce and medina:

Code: Select all

            $table[0][1] = [ 'str' => '${piece}', 'args' => [ 'piece' => 'building', 'piece_type' => 'building', 'piece_color' => Piece::White ], 'type' => 'header' ];
Post Reply

Return to “Developers”