TCOD

 view release on metacpan or  search on metacpan

lib/TCOD/Sys.pod  view on Meta::CPAN


    TCOD::Sys::save_screenshot( $path );

This function allows you to save the current game screen in a PNG file, or
possibly a BMP file if you provide a filename ending with C<.bmp>.

=head2 update_char

    TCOD::Sys::update_char( $code, $x, $y, $image, $x, $y );

You can dynamically change the bitmap of a character in the font. All cells
using this ASCII code will be updated at next flush call.

=head2 set_renderer

    TCOD::Sys::set_renderer( $renderer );

As of 1.5.1, libtcod contains 3 different renderers:

=over

=item * SDL

Historic libtcod renderer. Should work and be pretty fast everywhere

=item * OpenGL

Requires OpenGL compatible video card. Might be much faster or much slower
than SDL, depending on the drivers

=item * GLSDL

Requires OpenGL 1.4 compatible video card with C<GL_ARB_shader_objects>
extension. Blazing fast if you have the proper hardware and drivers.

=back

This function switches the current renderer dynamically. The value in
C<$renderer> must be an element of the L<Renderer|TCOD/Renderer> enum.

=head2 get_renderer

    $renderer = TCOD::Sys::get_renderer;

Get the internal renderer. This will be an element of the
L<Renderer|TCOD/Renderer> enum.

=head2 get_char_size

    ( $w, $h ) = TCOD::Sys::get_char_size;

You can get the size in pixels of the characters in the font.

=head2 get_current_resolution

    ( $w, $h ) = TCOD::Sys::get_current_resolution;

You can get the current screen resolution with
L<get_current_resolution|/get_current_resolution>.

You can use it for example to get the desktop resolution before initialising
the root console.

=head2 force_fullscreen_resolution

    TCOD::Sys::force_fullscreen_resolution( $width, $height );

This function allows you to force the use of a specific resolution in
fullscreen mode. The default resolution depends on the root console size
and the font character size.

=head2 get_directory_contents

    @filenames = TCOD::Sys::get_directory_contents( $path );

Returns a list of the contents of a directory (including files and
subdirectories), not including C<.> and C<..>. Will die with an error message
if the operation fails.

This function is implemented here for compatibility. Standard Perl solutions
are probably preferable.

=head2 wait_for_event

    # Deprecated
    TCOD::Sys::wait_for_event( $mask, \$key, \$mouse, $flush );

This function waits for an event from the user. The C<$mask> shows what
events we're waiting for. The return value indicate what event was actually
triggered. Values in key and mouse structures are updated accordingly.

If flush is false, the function waits only if there are no pending events,
else it returns the first event in the buffer.

This function is deprecated. Use C<SDL_WaitEvent> from SDL instead.

=head2 check_for_event

    # Deprecated
    $event = TCOD::Sys::check_for_event( $mask, \$key, \$mouse );

This function checks if an event from the user is in the buffer. The
C<$mask> shows what events we're waiting for. The return value indicates what
event was actually found. Values in key and mouse structures are updated
accordingly.

This function is deprecated. Use C<SDL_PollEvent> from SDL instead.

=head2 clipboard_set

    # Deprecated
    $bool = TCOD::Sys::clipboard_set( $contents );

Takes UTF-8 text and copies it into the system clipboard. On Linux, because
an application cannot access the system clipboard unless a window is open,
if no window is open the call will do nothing.

This function is deprecated. Use SDL2 to handle the clipboard.

=head2 clipboard_get



( run in 1.416 second using v1.01-cache-2.11-cpan-99c4e6809bf )