Page 1 of 1

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

Posted: 24 January 2021, 20:06
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?

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

Posted: 25 January 2021, 07:33
by Tisaac
Just put some div/span with a background image in css.

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

Posted: 25 January 2021, 15:29
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' ];