| 1 | package SDL2::Window { | ||
| 2 | use SDL2::Utils; | ||
| 3 | has | ||
| 4 | magic => 'opaque', | ||
| 5 | id => 'uint32', | ||
| 6 | title => 'opaque', # char * | ||
| 7 | icon => 'SDL_Surface', | ||
| 8 | x => 'int', | ||
| 9 | y => 'int', | ||
| 10 | w => 'int', | ||
| 11 | h => 'int', | ||
| 12 | min_w => 'int', | ||
| 13 | min_h => 'int', | ||
| 14 | max_w => 'int', | ||
| 15 | max_h => 'int', | ||
| 16 | flags => 'uint32', | ||
| 17 | last_fullscreen_flags => 'uint32', | ||
| 18 | windowed => 'SDL_Rect', | ||
| 19 | fullscreen_mode => 'opaque', # SDL_DisplayMode | ||
| 20 | opacity => 'float', | ||
| 21 | brightness => 'float', | ||
| 22 | gamma => 'uint16[255]', # uint16* | ||
| 23 | saved_gamma => 'uint16[255]', # uint16* | ||
| 24 | surface => 'opaque', # SDL_Surface* | ||
| 25 | surface_valid => 'bool', | ||
| 26 | is_hiding => 'bool', | ||
| 27 | is_destroying => 'bool', | ||
| 28 | is_dropping => 'bool', | ||
| 29 | shaper => 'opaque', # SDL_WindowShaper | ||
| 30 | hit_test => 'opaque', # SDL_HitTest | ||
| 31 | hit_test_data => 'opaque', # void* | ||
| 32 | data => 'opaque', # SDL_WindowUserData* | ||
| 33 | driverdata => 'opaque', # void* | ||
| 34 | prev => 'opaque', # SDL_Window* | ||
| 35 | next => 'opaque' # SDL_Window* | ||
| 36 | ; | ||
| 37 | |||
| 38 | =encoding utf-8 | ||
| 39 | |||
| 40 | =head1 NAME | ||
| 41 | |||
| 42 | SDL2::Window - SDL Window Structure, Corresponding to Toplevel Windows | ||
| 43 | |||
| 44 | =head1 SYNOPSIS | ||
| 45 | |||
| 46 | use SDL2 qw[:all]; | ||
| 47 | SDL_Init(SDL_INIT_VIDEO); # Initialize SDL2 | ||
| 48 | |||
| 49 | # Create an application window with the following settings; | ||
| 50 | my $window = SDL_CreateWindow( | ||
| 51 | 'An SDL2 window', # window title | ||
| 52 | SDL_WINDOWPOS_UNDEFINED, # initial x position | ||
| 53 | SDL_WINDOWPOS_UNDEFINED, # initial y position | ||
| 54 | 640, # width, in pixels | ||
| 55 | 480, # height, in pixels | ||
| 56 | SDL_WINDOW_OPENGL # flags | ||
| 57 | ); | ||
| 58 | |||
| 59 | # Check that the window was successfully created | ||
| 60 | exit printf 'Could not create window: %s', SDL_GetError() if !defined $window; | ||
| 61 | |||
| 62 | # The window is open: could enter program loop here (see SDL__PollEvent()) | ||
| 63 | sleep 5; # Pause execution for 5 secconds, for example | ||
| 64 | SDL_DestroyWindow($window); # Close and destory the window | ||
| 65 | SDL_Quit(); # Clean up | ||
| 66 | exit; | ||
| 67 | |||
| 68 | =head1 DESCRIPTION | ||
| 69 | |||
| 70 | SDL2::Window | ||
| 71 | |||
| 72 | =head1 AUTHOR | ||
| 73 | |||
| 74 | Sanko Robinson E<lt>sanko@cpan.orgE<gt> | ||
| 75 | |||
| 76 | =begin stopwords | ||
| 77 | |||
| 78 | |||
| 79 | |||
| 80 | =end stopwords | ||
| 81 | |||
| 82 | =cut | ||
| 83 | |||
| 84 | }; | ||
| 85 | 1; |