fortplot_ascii_player Module

Plays back ASCII animations produced by save_animation(*.txt).

The on-disk format is a sequence of frames separated by a header line of the form "=== Frame ===" followed by the ASCII rendering of the figure. The player reads each frame, prints it to a chosen output unit, and sleeps for 1000/fps milliseconds between frames.



Variables

Type Visibility Attributes Name Initial
integer, public, parameter :: ASCII_PLAYER_MAX_LINE = 1024
integer, public, parameter :: ASCII_PLAYER_DEFAULT_FPS = 10

Derived Types

type, public ::  ascii_player_options_t

Components

Type Visibility Attributes Name Initial
integer, public :: fps = ASCII_PLAYER_DEFAULT_FPS
logical, public :: loop = .false.
logical, public :: clear_screen = .true.
logical, public :: dry_run = .false.
integer, public :: max_loops = 1

Functions

public pure function max_player_line_length() result(n)

Arguments

None

Return Value integer

public function parse_frame_header(line, frame_index) result(is_header)

Recognize lines of the form "=== Frame ===" and return N.

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: line
integer, intent(out) :: frame_index

Return Value logical


Subroutines

public subroutine play_ascii_animation(filename, options, out_unit, status, frames_played)

Open a .txt animation and play frames at options%fps.

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: filename
type(ascii_player_options_t), intent(in) :: options
integer, intent(in), optional :: out_unit
integer, intent(out), optional :: status
integer, intent(out), optional :: frames_played

public subroutine count_animation_frames(filename, n_frames, status)

Count frames in a .txt animation without playing them.

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: filename
integer, intent(out) :: n_frames
integer, intent(out), optional :: status