jadijadi / riverraidrust

A text based river raid clone in Rust; streamed
GNU General Public License v3.0
91 stars 27 forks source link

Quick solution to add styled contents. #77

Closed immmdreza closed 5 months ago

immmdreza commented 5 months ago

Added style: ContentStyle to the canvas's block to store style for each block.

Methods draw_styled_char and draw_styled_line are now available in Canvas.

Here is how you can add style to a char (or line).

sc.draw_styled_char(self, 'E', ContentStyle::new().red().into());

self.canvas
    .draw_styled_line(2, format!(" Score: {} ", self.player.score), ContentStyle::new().black().on_white().into())
jadijadi commented 5 months ago

A super thank. Now we can call this project a true rust program :D