From: kthakore Date: Wed, 9 Mar 2011 04:21:11 +0000 (-0500) Subject: Added new pages and docs X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=fcf60e89673f759573b518df17a379d1a9436b4c;p=sdlgit%2FSDL-Site.git Added new pages and docs --- diff --git a/pages/SDL-TTF-Font.html-inc b/pages/SDL-TTF-Font.html-inc index 38815eb..cca3b8d 100644 --- a/pages/SDL-TTF-Font.html-inc +++ b/pages/SDL-TTF-Font.html-inc @@ -33,8 +33,9 @@ my $font = SDL::TTF::Font->new($font_file, $point_size, $face_index); -

Load file for use as a font, at the given size. This can load TTF and FON files. -You can specify the face index of a font file containing multiple faces.

+

Load file for use as a font, at the given size. This can load TTF, OTF and +FON files. You can specify the face index of a font file containing multiple +faces.

Returns: a SDL::TTF::Font object. undef is returned on errors.

Example:

 use SDL::TTF::Font;
diff --git a/pages/SDL-TTF.html-inc b/pages/SDL-TTF.html-inc
index 7693e8e..91fdfbf 100644
--- a/pages/SDL-TTF.html-inc
+++ b/pages/SDL-TTF.html-inc
@@ -212,7 +212,7 @@ After calling this the SDL::TTF functions should not be used, excepting  my $font = SDL::TTF::open_font($font_file, $point_size);
 
 
-

Load file for use as a font, at the given size. This is actually SDL::TTF::open_font_index(..., ..., $index = 0). This can load TTF and FON files.

+

Load file for use as a font, at the given size. This is actually SDL::TTF::open_font_index(..., ..., $index = 0). This can load TTF, OTF and FON files.

Returns: a SDL::TTF::Font object. undef is returned on errors.

Example:

 use SDL::TTF;
@@ -634,7 +634,7 @@ version 2.3.5

SDL::init(SDL_INIT_VIDEO); SDL::TTF::init(); my $display = SDL::Video::set_video_mode(640, 480, 32, SDL_SWSURFACE); - my $font = SDL::TTF::open_font('test/data/aircut3.ttf', '24'); + my $font = SDL::TTF::open_font('somefont.ttf', '24'); die 'Coudnt make font '. SDL::get_error if !$font; my $surface = SDL::TTF::render_text_solid($font, 'Hallo!', SDL::Color->new(0xFF,0xFF,0xFF)); SDL::Video::blit_surface($surface, SDL::Rect->new(0, 0, 640, 480), $display, SDL::Rect->new(10, 10, 640, 480)); diff --git a/pages/SDL-Video.html-inc b/pages/SDL-Video.html-inc index ed3df79..9b6a1a8 100644 --- a/pages/SDL-Video.html-inc +++ b/pages/SDL-Video.html-inc @@ -1130,7 +1130,7 @@ If the SDL::PixelFormat's bpp (color depth)

map_RGBA

-
 $pixel = SDL::Video::map_RGB( $pixel_format, $r, $g, $b, $a );
+
 $pixel = SDL::Video::map_RGBA( $pixel_format, $r, $g, $b, $a );
 
 

Maps the RGBA color value to the specified SDL::PixelFormat and returns the pixel value as a 32-bit int. diff --git a/pages/SDLx-Controller.html-inc b/pages/SDLx-Controller.html-inc index 7cf82d5..f01db69 100644 --- a/pages/SDLx-Controller.html-inc +++ b/pages/SDLx-Controller.html-inc @@ -13,6 +13,7 @@

  • run
  • stop
  • pause
  • +
  • paused
  • add_event_handler
  • add_move_handler
  • add_show_handler
  • @@ -113,6 +114,7 @@ This is useful to add slo-mo and fast-forward features to the game, all you woul Having the min_t at 1 / 60 ensures that the controller can update the screen at a maximum of 60 times per second. A "V-Sync" such as this is necessary to prevent video "tear", which occurs when the app is updating faster than the monitor can display. Setting it to 0, as seen above, will let the app run as fast as it possibly can.

    +

    delay specifies a loop delay in millisecs to place on the controller loop. NOTE: Picking a good delay based on the needs can help reduce CPU load and pressure.

    event is a SDL::Event object that events going to the event callbacks are polled in to. It defaults to SDL::Event->new().

    All parameters are optional.

    Returns the new object.

    @@ -174,6 +176,37 @@ Otherwise, time will accumulate while the application is paused, and many moveme

    Note 2: a pause will be potentially dangerous to the run cycle (even if you implement your own) unless called by an event callback.

    +

    paused

    +
    +

    Returns 1 if the app is paused, undef otherwise. +This is only useful when used within code that will be run by pause:

    +
     sub pause {
    +     # press P to toggle pause
    +
    +     my ($e, $app) = @_;
    +     if($e->type == SDL_QUIT) {
    +         $app->stop;
    +         # quit handling is here so that the app
    +         # can be stopped while paused
    +     }
    +     elsif($e->type == SDL_KEYDOWN) {
    +         if($e->key_sym == SDLK_P) {
    +             # We're paused, so end pause
    +             return 1 if $app->paused;
    +
    +             # We're not paused, so pause
    +             $app->pause(\&pause);
    +         }
    +     }
    +     return 0;
    + }
    +
    +
    +
    +
    +
    + +

    add_event_handler

    Register a callback to handle events. You can add as many subs as you need. diff --git a/pages/SDLx-Text.html-inc b/pages/SDLx-Text.html-inc new file mode 100644 index 0000000..37d9728 --- /dev/null +++ b/pages/SDLx-Text.html-inc @@ -0,0 +1,300 @@ +

    + +

    Index

    + +
    + + +

    NAME

    Top

    +
    +

    SDLx::Text - SDL extension for manipulating text

    + +
    +

    CATEGORY

    Top

    +
    +

    Extension

    + +
    +

    SYNOPSIS

    Top

    +
    +
        use SDL;
    +    use SDLx::App; 
    +    use SDLx::Text;
    +
    +    my $app = SDLx::App->new;
    +
    +    my $message = SDLx::Text->new;
    +
    +    $message->write_to( $app, "Hello, World!" );
    +    $app->update;
    +
    +
    +
    +
    +
    + +
    +

    DESCRIPTION

    Top

    +
    +

    The standard SDL API for handling fonts and rendering text is full of quirks +and and low-level functions scattered all over the place. This is a sugar +layer meant to let you easily handle text in your SDL apps.

    + +
    +

    CONSTRUCTION

    Top

    +
    + +
    +

    new

    +
    + +
    +

    new ( %attributes )

    +
    +

    Instantiates a new SDLx::Text object. All attributes are optional:

    +
        my $text = SDLx::Text->new(
    +            font    => '/path/to/my/font.ttf',
    +            color   => [255, 255, 255], # "white"
    +            size    => 24,
    +            x       => 0,
    +            y       => 0,
    +            h_align => 'left',
    +            text    => 'All your base are belong to us.'
    +    );
    +
    +
    +

    Please check the accessors below for more information on each attribute. +All values shown above are the default values, except for "text", +which defaults to undef; and "font", which if not provided will load +the Gentium Basic free font (see "http://search.cpan.org/perldoc?" for more +information).

    + +
    +

    ACCESSORS

    Top

    +
    +

    All accessors below can be used to get and set their respective attributes. +For example:

    +
       my $font_name = $self->font;     # gets the font filename
    +   $self->font( 'somefont.ttf' );   # sets a new font
    +
    +
    +

    All accessors return their current value, after being set.

    + +
    +

    x

    +
    +

    Gets/sets the left (x) positioning of the text to be rendered, relative +to whatever surface you are placing it into.

    + +
    +

    y

    +
    +

    Gets/sets the top (y) positioning of the text to be rendered, relative +to whatever surface you are placing it into.

    + +
    +

    h_align

    +
    +

    Gets/sets the horizontal alignment of the text to be rendered relative to +whatever surface you are placing it into. Available alignments are 'left', +'right' and 'center'. Default is 'left'.

    + +
    +

    color

    +
    +

    Gets/sets the text color. The color is an array reference in [R, G, B] or [R, G, B, A] format. See SDL::Color for more information on colors.

    + +
    +

    size

    +
    +

    Gets/sets the font size.

    + +
    +

    font

    +
    +

    Pass it a string containing the path to your desired font to use it. Fonts +can be in TTF, OTF or FON formats. Generates an exception if the font +cannot be loaded.

    +

    Returns the SDL::TTF::Font object representing the font.

    + + + + + +
    +

    METHODS

    Top

    +
    + +
    +

    text( $some_text )

    +
    +

    Sets the text to be displayed by the SDLx::Text object. Return the SDLx::Text object itself, so you can easily chain this method around.

    +
        my $obj = SDLx::Text->new->text( "Hello, Dave." );
    +
    +
    +

    Text will always be rendered as utf8, so you can pass any string containing +regular ASCII or valid utf8 characters.

    + +
    +

    write_to( $target_surface )

    +
    + +
    +

    write_to( $target_surface, "text to write" )

    +
    +

    Renders the text onto $target_surface (usually the app itself). The +text string may be passed as a parameter, otherwise it will use whatever +is already set (via the new() or text() methods.

    + +
    +

    write_xy( $target_surface, $x, $y )

    +
    + +
    +

    write_xy( $target_surface, $x, $y, $text )

    +
    +

    Same as write_to(), but will render the text using the given top (y) and +left (x) coordinates.

    + + + + + +
    +

    READ-ONLY ATTRIBUTES

    Top

    +
    +

    As you set or update your text, font or size, SDLx::Text updates the surface +that represents it. You don't usually need to worry about this at all, and +we strongly recommend you use the http://search.cpan.org/perldoc? above to render your text.

    +

    If however you need to know how tall or wide the rendered text will be +(in pixels), or if you want to retrieve the surface so you can manipulate and +render it yourself, you can use the following getters:

    + +
    +

    surface

    +
    +

    Returns the underlying surface representing the text itself. You probably don't need this, unless you're doing something really funky.

    + +
    +

    w

    +
    +

    Shortcut to see the width of the underlying surface representing the text.

    + +
    +

    h

    +
    +

    Shortcut to see the height of the underlying surface representing the text.

    + +
    +

    ERRORS AND DIAGNOSTICS

    Top

    +
    +
    +
    * "SDL_ttf support has not been compiled"
    +
    +

    In order to render text in SDL you must have enabled SDL_ttf while building Alien::SDL.

    +
    +
    * "Cannot init TTF: <some error>"
    +
    +

    In order to load fonts and render text, we need to initialize SDL::TTF +- that is, in case it hasn't been initialized already. The error above will +appear in the rare event of any problem during initialization.

    +
    +
    * "Error opening font: <some error>"
    +
    +

    The font file you set either via font( 'font.ttf' ) or during +construction could not be loaded. The file may not exist in the given path, +have wrong permissions, be corrupted, or of an unsupported format. Please +refer the <some error> message in the message itself for further +information.

    +
    +
    * "TTF rendering error: <some error>"
    +
    +

    When you call text(), it renders the provided string onto an internal +SDL::Surface object. If there was any problem rendering the text, this +message will appear.

    +
    +
    + +
    +

    BUGS

    Top

    +
    +

    Please report any bugs or feature requests to the bug tracker. We will be notified, and then you'll automatically be notified of progress on your bug as we make changes.

    + + + + + +
    +

    SUPPORT

    Top

    +
    +

    You can find documentation for this module with the perldoc command.

    +
        perldoc SDLx::Text
    +
    +
    +
    +
    +
    + +
    +

    AUTHORS

    Top

    +
    +

    See /SDL.html#AUTHORS.

    + + + + + +
    +

    COPYRIGHT & LICENSE

    Top

    + +

    SEE ALSO

    Top

    + +
    \ No newline at end of file diff --git a/pages/documentation.html-inc b/pages/documentation.html-inc index 5eafa97..4ab516e 100644 --- a/pages/documentation.html-inc +++ b/pages/documentation.html-inc @@ -1,2 +1,2 @@
    -

    Documentation (latest development branch)

    Core
    thumbSDL- Simple DirectMedia Layer for Perl
    thumbSDL::Credits- Authors and contributors of the SDL Perl project
    thumbSDL::Deprecated- Log of Deprecated items per release
    thumbSDL::Time- An SDL Perl extension for managing timers
    Audio
    thumbSDL::Audio- SDL Bindings for Audio
    Structure
    thumbSDL::AudioCVT- Audio Conversion Structure
    thumbSDL::AudioSpec- SDL Bindings for structure SDL::AudioSpec
    CDROM
    thumbSDL::CDROM- SDL Bindings for the CDROM device
    Structure
    thumbSDL::CD- SDL Bindings for structure SDL_CD
    thumbSDL::CDTrack- SDL Bindings for structure SDL_CDTrack
    Events
    thumbSDL::Events- Bindings to the Events Category in SDL API
    Structure
    thumbSDL::Event- General event structure
    Joystick
    thumbSDL::Joystick- SDL Bindings for the Joystick device
    Mouse
    thumbSDL::Mouse- SDL Bindings for the Mouse device
    Structure
    thumbSDL::Cursor- Mouse cursor structure
    Structure
    thumbSDL::Version- SDL Bindings for structure SDL_Version
    Video
    thumbSDL::Video- Bindings to the video category in SDL API
    Structure
    thumbSDL::Color- Format independent color description
    thumbSDL::Overlay- YUV Video overlay
    thumbSDL::Palette- Color palette for 8-bit pixel formats
    thumbSDL::PixelFormat- Stores surface format information
    thumbSDL::Rect- Defines a rectangular area
    thumbSDL::Surface- Graphic surface structure
    thumbSDL::VideoInfo- Video Target Information

    Cookbook
    thumbSDL::Cookbook
    thumbSDL::Cookbook::OpenGL- Using SDL with OpenGL
    thumbSDL::Cookbook::PDL

    Extension
    thumbSDLx::App- a SDL perl extension
    thumbSDLx::Layer- Storage object for surface and position information
    thumbSDLx::LayerManager- Extension for managing layers in a 2D world
    thumbSDLx::Rect- SDL extension for storing and manipulating rectangular coordinates
    thumbSDLx::SFont- Extension making fonts out of images and printing them
    thumbSDLx::Sound
    thumbSDLx::Sprite- interact with images quick and easily in SDL
    thumbSDLx::Sprite::Animated- create animated SDL sprites easily!
    thumbSDLx::Surface- Graphic surface matrix extension
    Controller
    thumbSDLx::Controller- Handles the loops for events, movement and rendering
    thumbSDLx::Controller::Interface- Interface Physics and Rendering with the Controller with callbacks
    thumbSDLx::Controller::State- the state of a SDLx::Controller::Interface

    GFX
    thumbSDL::GFX::Framerate- framerate calculating functions
    thumbSDL::GFX::Primitives- basic drawing functions
    Structure
    thumbSDL::GFX::FPSManager- data structure used by SDL::GFX::Framerate

    Image
    thumbSDL::Image- Bindings for the SDL_Image library

    Mixer
    thumbSDL::Mixer- Sound and music functions
    thumbSDL::Mixer::Channels- SDL::Mixer channel functions and bindings
    thumbSDL::Mixer::Effects- sound effect functions
    thumbSDL::Mixer::Groups- Audio channel group functions
    thumbSDL::Mixer::Music- functions for music
    thumbSDL::Mixer::Samples- functions for loading sound samples
    Structure
    thumbSDL::Mixer::MixChunk- SDL Bindings for structure SDL_MixChunk
    thumbSDL::Mixer::MixMusic- SDL Bindings for structure SDL_MixMusic

    Pango
    thumbSDL::Pango- Text rendering engine
    Structure
    thumbSDL::Pango::Context- Context object for SDL::Pango

    TODO
    thumbSDL::MPEG- a SDL perl extension
    thumbSDL::SMPEG- a SDL perl extension
    MultiThread
    thumbSDL::MultiThread- Bindings to the MultiThread category in SDL API
    Structure
    thumbSDL::RWOps- SDL Bindings to SDL_RWOPs
    GFX
    thumbSDL::GFX::BlitFunc- blitting functions
    thumbSDL::GFX::ImageFilter- image filtering functions
    thumbSDL::GFX::Rotozoom- rotation and zooming functions for surfaces

    TTF
    thumbSDL::TTF- True Type Font functions (libfreetype)
    Structure
    thumbSDL::TTF::Font- Font object type for SDL_ttf

    Tutorials
    thumbSDL::Tutorial- introduction to Perl SDL
    thumbSDL::Tutorial::Animation
    thumbSDL::Tutorial::LunarLander- a small tutorial on Perl SDL
    +

    Documentation (latest development branch)

    Core
    thumbSDL- Simple DirectMedia Layer for Perl
    thumbSDL::Credits- Authors and contributors of the SDL Perl project
    thumbSDL::Deprecated- Log of Deprecated items per release
    thumbSDL::Time- An SDL Perl extension for managing timers
    Audio
    thumbSDL::Audio- SDL Bindings for Audio
    Structure
    thumbSDL::AudioCVT- Audio Conversion Structure
    thumbSDL::AudioSpec- SDL Bindings for structure SDL::AudioSpec
    CDROM
    thumbSDL::CDROM- SDL Bindings for the CDROM device
    Structure
    thumbSDL::CD- SDL Bindings for structure SDL_CD
    thumbSDL::CDTrack- SDL Bindings for structure SDL_CDTrack
    Events
    thumbSDL::Events- Bindings to the Events Category in SDL API
    Structure
    thumbSDL::Event- General event structure
    Joystick
    thumbSDL::Joystick- SDL Bindings for the Joystick device
    Mouse
    thumbSDL::Mouse- SDL Bindings for the Mouse device
    Structure
    thumbSDL::Cursor- Mouse cursor structure
    Structure
    thumbSDL::Version- SDL Bindings for structure SDL_Version
    Video
    thumbSDL::Video- Bindings to the video category in SDL API
    Structure
    thumbSDL::Color- Format independent color description
    thumbSDL::Overlay- YUV Video overlay
    thumbSDL::Palette- Color palette for 8-bit pixel formats
    thumbSDL::PixelFormat- Stores surface format information
    thumbSDL::Rect- Defines a rectangular area
    thumbSDL::Surface- Graphic surface structure
    thumbSDL::VideoInfo- Video Target Information

    Cookbook
    thumbSDL::Cookbook
    thumbSDL::Cookbook::OpenGL- Using SDL with OpenGL
    thumbSDL::Cookbook::PDL

    Extension
    thumbSDLx::App- a SDL perl extension
    thumbSDLx::Layer- Storage object for surface and position information
    thumbSDLx::LayerManager- Extension for managing layers in a 2D world
    thumbSDLx::Rect- SDL extension for storing and manipulating rectangular coordinates
    thumbSDLx::SFont- Extension making fonts out of images and printing them
    thumbSDLx::Sound
    thumbSDLx::Sprite- interact with images quick and easily in SDL
    thumbSDLx::Sprite::Animated- create animated SDL sprites easily!
    thumbSDLx::Surface- Graphic surface matrix extension
    thumbSDLx::Text- SDL extension for manipulating text
    Controller
    thumbSDLx::Controller- Handles the loops for events, movement and rendering
    thumbSDLx::Controller::Interface- Interface Physics and Rendering with the Controller with callbacks
    thumbSDLx::Controller::State- the state of a SDLx::Controller::Interface

    GFX
    thumbSDL::GFX::Framerate- framerate calculating functions
    thumbSDL::GFX::Primitives- basic drawing functions
    Structure
    thumbSDL::GFX::FPSManager- data structure used by SDL::GFX::Framerate

    Image
    thumbSDL::Image- Bindings for the SDL_Image library

    Mixer
    thumbSDL::Mixer- Sound and music functions
    thumbSDL::Mixer::Channels- SDL::Mixer channel functions and bindings
    thumbSDL::Mixer::Effects- sound effect functions
    thumbSDL::Mixer::Groups- Audio channel group functions
    thumbSDL::Mixer::Music- functions for music
    thumbSDL::Mixer::Samples- functions for loading sound samples
    Structure
    thumbSDL::Mixer::MixChunk- SDL Bindings for structure SDL_MixChunk
    thumbSDL::Mixer::MixMusic- SDL Bindings for structure SDL_MixMusic

    Pango
    thumbSDL::Pango- Text rendering engine
    Structure
    thumbSDL::Pango::Context- Context object for SDL::Pango

    TODO
    thumbSDL::MPEG- a SDL perl extension
    thumbSDL::SMPEG- a SDL perl extension
    MultiThread
    thumbSDL::MultiThread- Bindings to the MultiThread category in SDL API
    Structure
    thumbSDL::RWOps- SDL Bindings to SDL_RWOPs
    GFX
    thumbSDL::GFX::BlitFunc- blitting functions
    thumbSDL::GFX::ImageFilter- image filtering functions
    thumbSDL::GFX::Rotozoom- rotation and zooming functions for surfaces

    TTF
    thumbSDL::TTF- True Type Font functions (libfreetype)
    Structure
    thumbSDL::TTF::Font- Font object type for SDL_ttf

    Tutorials
    thumbSDL::Tutorial- introduction to Perl SDL
    thumbSDL::Tutorial::Animation
    thumbSDL::Tutorial::LunarLander- a small tutorial on Perl SDL
    diff --git a/pages/tags-Contest.html-inc b/pages/tags-Contest.html-inc new file mode 100644 index 0000000..9751ee2 --- /dev/null +++ b/pages/tags-Contest.html-inc @@ -0,0 +1 @@ +

    Results for tag: Contest

    SDL Perl Game Contest - week 1 roundup
    Tuesday, 08 March 2011
    Tags: [Contest] [Game] [Perl] [SDL] [games]
    As you probably know, last week we started the SDL Perl Game Contest (more like a Game Challenge, as people pointed out), where you have to write one game per week throughout the entire month of March!
    So far we had some awesome entries - people really stood up to the challenge! Check them out:
    Solar Conflict , by JT Palmer (jtpalmer)
    [more]


    The SDL Perl Game Contest!
    Friday, 25 February 2011
    Tags: [Contest] [Game] [Perl] [SDL]
    Let's get a Party Started
    Sure, you know what SDL is, right? Well, SDL has very nice Perl
    bindings that let you use the power and flexibility of Perl to write
    [more]

    \ No newline at end of file diff --git a/pages/tags-games.html-inc b/pages/tags-games.html-inc new file mode 100644 index 0000000..623de5a --- /dev/null +++ b/pages/tags-games.html-inc @@ -0,0 +1 @@ +

    Results for tag: games

    SDL Perl Game Contest - week 1 roundup
    Tuesday, 08 March 2011
    Tags: [Contest] [Game] [Perl] [SDL] [games]
    As you probably know, last week we started the SDL Perl Game Contest (more like a Game Challenge, as people pointed out), where you have to write one game per week throughout the entire month of March!
    So far we had some awesome entries - people really stood up to the challenge! Check them out:
    Solar Conflict , by JT Palmer (jtpalmer)
    [more]

    \ No newline at end of file