comparison include/SDL_video.h @ 3685:64ce267332c6

Switched from SDL_WindowID and SDL_TextureID to SDL_Window* and SDL_Texture* for code simplicity and improved performance.
author Sam Lantinga <slouken@libsdl.org>
date Thu, 21 Jan 2010 06:21:52 +0000
parents cec9ea711294
children 9fed2aa469ed
comparison
equal deleted inserted replaced
3684:cc564f08884f 3685:64ce267332c6
86 * \sa SDL_SetWindowPosition() 86 * \sa SDL_SetWindowPosition()
87 * \sa SDL_SetWindowSize() 87 * \sa SDL_SetWindowSize()
88 * \sa SDL_SetWindowTitle() 88 * \sa SDL_SetWindowTitle()
89 * \sa SDL_ShowWindow() 89 * \sa SDL_ShowWindow()
90 */ 90 */
91 typedef Uint32 SDL_WindowID; 91 struct SDL_Window;
92 typedef struct SDL_Window SDL_Window;
92 93
93 /** 94 /**
94 * \brief The flags on a window 95 * \brief The flags on a window
95 * 96 *
96 * \sa SDL_GetWindowFlags() 97 * \sa SDL_GetWindowFlags()
246 } SDL_TextureScaleMode; 247 } SDL_TextureScaleMode;
247 248
248 /** 249 /**
249 * \brief An efficient driver-specific representation of pixel data 250 * \brief An efficient driver-specific representation of pixel data
250 */ 251 */
251 typedef Uint32 SDL_TextureID; 252 struct SDL_Texture;
253 typedef struct SDL_Texture SDL_Texture;
252 254
253 /** 255 /**
254 * \brief An opaque handle to an OpenGL context. 256 * \brief An opaque handle to an OpenGL context.
255 */ 257 */
256 typedef void *SDL_GLContext; 258 typedef void *SDL_GLContext;
447 * \return 0 on success, or -1 if setting the display mode failed. 449 * \return 0 on success, or -1 if setting the display mode failed.
448 * 450 *
449 * \sa SDL_GetWindowDisplayMode() 451 * \sa SDL_GetWindowDisplayMode()
450 * \sa SDL_SetWindowFullscreen() 452 * \sa SDL_SetWindowFullscreen()
451 */ 453 */
452 extern DECLSPEC int SDLCALL SDL_SetWindowDisplayMode(SDL_WindowID windowID, 454 extern DECLSPEC int SDLCALL SDL_SetWindowDisplayMode(SDL_Window * window,
453 const SDL_DisplayMode 455 const SDL_DisplayMode
454 * mode); 456 * mode);
455 457
456 /** 458 /**
457 * \brief Fill in information about the display mode used when a fullscreen 459 * \brief Fill in information about the display mode used when a fullscreen
458 * window is visible on the currently selected display. 460 * window is visible on the currently selected display.
459 * 461 *
460 * \sa SDL_SetWindowDisplayMode() 462 * \sa SDL_SetWindowDisplayMode()
461 * \sa SDL_SetWindowFullscreen() 463 * \sa SDL_SetWindowFullscreen()
462 */ 464 */
463 extern DECLSPEC int SDLCALL SDL_GetWindowDisplayMode(SDL_WindowID windowID, 465 extern DECLSPEC int SDLCALL SDL_GetWindowDisplayMode(SDL_Window * window,
464 SDL_DisplayMode * mode); 466 SDL_DisplayMode * mode);
465 467
466 /** 468 /**
467 * \brief Set the palette entries for indexed display modes. 469 * \brief Set the palette entries for indexed display modes.
468 * 470 *
549 * 551 *
550 * \return The id of the window created, or zero if window creation failed. 552 * \return The id of the window created, or zero if window creation failed.
551 * 553 *
552 * \sa SDL_DestroyWindow() 554 * \sa SDL_DestroyWindow()
553 */ 555 */
554 extern DECLSPEC SDL_WindowID SDLCALL SDL_CreateWindow(const char *title, 556 extern DECLSPEC SDL_Window * SDLCALL SDL_CreateWindow(const char *title,
555 int x, int y, int w, 557 int x, int y, int w,
556 int h, Uint32 flags); 558 int h, Uint32 flags);
557 559
558 /** 560 /**
559 * \brief Create an SDL window from an existing native window. 561 * \brief Create an SDL window from an existing native window.
562 * 564 *
563 * \return The id of the window created, or zero if window creation failed. 565 * \return The id of the window created, or zero if window creation failed.
564 * 566 *
565 * \sa SDL_DestroyWindow() 567 * \sa SDL_DestroyWindow()
566 */ 568 */
567 extern DECLSPEC SDL_WindowID SDLCALL SDL_CreateWindowFrom(const void *data); 569 extern DECLSPEC SDL_Window * SDLCALL SDL_CreateWindowFrom(const void *data);
570
571 /**
572 * \brief Get the numeric ID of the window, for logging purposes.
573 */
574 extern DECLSPEC Uint32 SDLCALL SDL_GetWindowID(SDL_Window * window);
575
576 /**
577 * \brief Get a window from a stored ID, or NULL if it doesn't exist.
578 */
579 extern DECLSPEC SDL_Window * SDLCALL SDL_GetWindowFromID(Uint32 id);
568 580
569 /** 581 /**
570 * \brief Get the window flags. 582 * \brief Get the window flags.
571 */ 583 */
572 extern DECLSPEC Uint32 SDLCALL SDL_GetWindowFlags(SDL_WindowID windowID); 584 extern DECLSPEC Uint32 SDLCALL SDL_GetWindowFlags(SDL_Window * window);
573 585
574 /** 586 /**
575 * \brief Set the title of the window, in UTF-8 format. 587 * \brief Set the title of the window, in UTF-8 format.
576 * 588 *
577 * \sa SDL_GetWindowTitle() 589 * \sa SDL_GetWindowTitle()
578 */ 590 */
579 extern DECLSPEC void SDLCALL SDL_SetWindowTitle(SDL_WindowID windowID, 591 extern DECLSPEC void SDLCALL SDL_SetWindowTitle(SDL_Window * window,
580 const char *title); 592 const char *title);
581 593
582 /** 594 /**
583 * \brief Get the title of the window, in UTF-8 format. 595 * \brief Get the title of the window, in UTF-8 format.
584 * 596 *
585 * \sa SDL_SetWindowTitle() 597 * \sa SDL_SetWindowTitle()
586 */ 598 */
587 extern DECLSPEC const char *SDLCALL SDL_GetWindowTitle(SDL_WindowID windowID); 599 extern DECLSPEC const char *SDLCALL SDL_GetWindowTitle(SDL_Window * window);
588 600
589 /** 601 /**
590 * \brief Set the icon of the window. 602 * \brief Set the icon of the window.
591 * 603 *
592 * \param icon The icon for the window. 604 * \param icon The icon for the window.
593 */ 605 */
594 extern DECLSPEC void SDLCALL SDL_SetWindowIcon(SDL_WindowID windowID, 606 extern DECLSPEC void SDLCALL SDL_SetWindowIcon(SDL_Window * window,
595 SDL_Surface * icon); 607 SDL_Surface * icon);
596 608
597 /** 609 /**
598 * \brief Associate an arbitrary pointer with the window. 610 * \brief Associate an arbitrary pointer with the window.
599 * 611 *
600 * \sa SDL_GetWindowData() 612 * \sa SDL_GetWindowData()
601 */ 613 */
602 extern DECLSPEC void SDLCALL SDL_SetWindowData(SDL_WindowID windowID, 614 extern DECLSPEC void SDLCALL SDL_SetWindowData(SDL_Window * window,
603 void *userdata); 615 void *userdata);
604 616
605 /** 617 /**
606 * \brief Retrieve the data pointer associated with the window. 618 * \brief Retrieve the data pointer associated with the window.
607 * 619 *
608 * \sa SDL_SetWindowData() 620 * \sa SDL_SetWindowData()
609 */ 621 */
610 extern DECLSPEC void *SDLCALL SDL_GetWindowData(SDL_WindowID windowID); 622 extern DECLSPEC void *SDLCALL SDL_GetWindowData(SDL_Window * window);
611 623
612 /** 624 /**
613 * \brief Set the position of the window. 625 * \brief Set the position of the window.
614 * 626 *
615 * \param windowID The window to reposition. 627 * \param window The window to reposition.
616 * \param x The x coordinate of the window, ::SDL_WINDOWPOS_CENTERED, or 628 * \param x The x coordinate of the window, ::SDL_WINDOWPOS_CENTERED, or
617 ::SDL_WINDOWPOS_UNDEFINED. 629 ::SDL_WINDOWPOS_UNDEFINED.
618 * \param y The y coordinate of the window, ::SDL_WINDOWPOS_CENTERED, or 630 * \param y The y coordinate of the window, ::SDL_WINDOWPOS_CENTERED, or
619 ::SDL_WINDOWPOS_UNDEFINED. 631 ::SDL_WINDOWPOS_UNDEFINED.
620 * 632 *
621 * \note The window coordinate origin is the upper left of the display. 633 * \note The window coordinate origin is the upper left of the display.
622 * 634 *
623 * \sa SDL_GetWindowPosition() 635 * \sa SDL_GetWindowPosition()
624 */ 636 */
625 extern DECLSPEC void SDLCALL SDL_SetWindowPosition(SDL_WindowID windowID, 637 extern DECLSPEC void SDLCALL SDL_SetWindowPosition(SDL_Window * window,
626 int x, int y); 638 int x, int y);
627 639
628 /** 640 /**
629 * \brief Get the position of the window. 641 * \brief Get the position of the window.
630 * 642 *
631 * \sa SDL_SetWindowPosition() 643 * \sa SDL_SetWindowPosition()
632 */ 644 */
633 extern DECLSPEC void SDLCALL SDL_GetWindowPosition(SDL_WindowID windowID, 645 extern DECLSPEC void SDLCALL SDL_GetWindowPosition(SDL_Window * window,
634 int *x, int *y); 646 int *x, int *y);
635 647
636 /** 648 /**
637 * \brief Set the size of the window's client area. 649 * \brief Set the size of the window's client area.
638 * 650 *
639 * \note You can't change the size of a fullscreen window, it automatically 651 * \note You can't change the size of a fullscreen window, it automatically
640 * matches the size of the display mode. 652 * matches the size of the display mode.
641 * 653 *
642 * \sa SDL_GetWindowSize() 654 * \sa SDL_GetWindowSize()
643 */ 655 */
644 extern DECLSPEC void SDLCALL SDL_SetWindowSize(SDL_WindowID windowID, int w, 656 extern DECLSPEC void SDLCALL SDL_SetWindowSize(SDL_Window * window, int w,
645 int h); 657 int h);
646 658
647 /** 659 /**
648 * \brief Get the size of the window's client area. 660 * \brief Get the size of the window's client area.
649 * 661 *
650 * \sa SDL_SetWindowSize() 662 * \sa SDL_SetWindowSize()
651 */ 663 */
652 extern DECLSPEC void SDLCALL SDL_GetWindowSize(SDL_WindowID windowID, int *w, 664 extern DECLSPEC void SDLCALL SDL_GetWindowSize(SDL_Window * window, int *w,
653 int *h); 665 int *h);
654 666
655 /** 667 /**
656 * \brief Show the window. 668 * \brief Show the window.
657 * 669 *
658 * \sa SDL_HideWindow() 670 * \sa SDL_HideWindow()
659 */ 671 */
660 extern DECLSPEC void SDLCALL SDL_ShowWindow(SDL_WindowID windowID); 672 extern DECLSPEC void SDLCALL SDL_ShowWindow(SDL_Window * window);
661 673
662 /** 674 /**
663 * \brief Hide the window. 675 * \brief Hide the window.
664 * 676 *
665 * \sa SDL_ShowWindow() 677 * \sa SDL_ShowWindow()
666 */ 678 */
667 extern DECLSPEC void SDLCALL SDL_HideWindow(SDL_WindowID windowID); 679 extern DECLSPEC void SDLCALL SDL_HideWindow(SDL_Window * window);
668 680
669 /** 681 /**
670 * \brief Raise the window above other windows and set the input focus. 682 * \brief Raise the window above other windows and set the input focus.
671 */ 683 */
672 extern DECLSPEC void SDLCALL SDL_RaiseWindow(SDL_WindowID windowID); 684 extern DECLSPEC void SDLCALL SDL_RaiseWindow(SDL_Window * window);
673 685
674 /** 686 /**
675 * \brief Make the window as large as possible. 687 * \brief Make the window as large as possible.
676 * 688 *
677 * \sa SDL_RestoreWindow() 689 * \sa SDL_RestoreWindow()
678 */ 690 */
679 extern DECLSPEC void SDLCALL SDL_MaximizeWindow(SDL_WindowID windowID); 691 extern DECLSPEC void SDLCALL SDL_MaximizeWindow(SDL_Window * window);
680 692
681 /** 693 /**
682 * \brief Minimize the window to an iconic representation. 694 * \brief Minimize the window to an iconic representation.
683 * 695 *
684 * \sa SDL_RestoreWindow() 696 * \sa SDL_RestoreWindow()
685 */ 697 */
686 extern DECLSPEC void SDLCALL SDL_MinimizeWindow(SDL_WindowID windowID); 698 extern DECLSPEC void SDLCALL SDL_MinimizeWindow(SDL_Window * window);
687 699
688 /** 700 /**
689 * \brief Restore the size and position of a minimized or maximized window. 701 * \brief Restore the size and position of a minimized or maximized window.
690 * 702 *
691 * \sa SDL_MaximizeWindow() 703 * \sa SDL_MaximizeWindow()
692 * \sa SDL_MinimizeWindow() 704 * \sa SDL_MinimizeWindow()
693 */ 705 */
694 extern DECLSPEC void SDLCALL SDL_RestoreWindow(SDL_WindowID windowID); 706 extern DECLSPEC void SDLCALL SDL_RestoreWindow(SDL_Window * window);
695 707
696 /** 708 /**
697 * \brief Set the window's fullscreen state. 709 * \brief Set the window's fullscreen state.
698 * 710 *
699 * \return 0 on success, or -1 if setting the display mode failed. 711 * \return 0 on success, or -1 if setting the display mode failed.
700 * 712 *
701 * \sa SDL_SetWindowDisplayMode() 713 * \sa SDL_SetWindowDisplayMode()
702 * \sa SDL_GetWindowDisplayMode() 714 * \sa SDL_GetWindowDisplayMode()
703 */ 715 */
704 extern DECLSPEC int SDLCALL SDL_SetWindowFullscreen(SDL_WindowID windowID, 716 extern DECLSPEC int SDLCALL SDL_SetWindowFullscreen(SDL_Window * window,
705 int fullscreen); 717 int fullscreen);
706 718
707 /** 719 /**
708 * \brief Set the window's input grab mode. 720 * \brief Set the window's input grab mode.
709 * 721 *
710 * \param mode This is 1 to grab input, and 0 to release input. 722 * \param mode This is 1 to grab input, and 0 to release input.
711 * 723 *
712 * \sa SDL_GetWindowGrab() 724 * \sa SDL_GetWindowGrab()
713 */ 725 */
714 extern DECLSPEC void SDLCALL SDL_SetWindowGrab(SDL_WindowID windowID, 726 extern DECLSPEC void SDLCALL SDL_SetWindowGrab(SDL_Window * window,
715 int mode); 727 int mode);
716 728
717 /** 729 /**
718 * \brief Get the window's input grab mode. 730 * \brief Get the window's input grab mode.
719 * 731 *
720 * \return This returns 1 if input is grabbed, and 0 otherwise. 732 * \return This returns 1 if input is grabbed, and 0 otherwise.
721 * 733 *
722 * \sa SDL_SetWindowGrab() 734 * \sa SDL_SetWindowGrab()
723 */ 735 */
724 extern DECLSPEC int SDLCALL SDL_GetWindowGrab(SDL_WindowID windowID); 736 extern DECLSPEC int SDLCALL SDL_GetWindowGrab(SDL_Window * window);
725 737
726 /** 738 /**
727 * \brief Get driver specific information about a window. 739 * \brief Get driver specific information about a window.
728 * 740 *
729 * \note Include SDL_syswm.h for the declaration of SDL_SysWMinfo. 741 * \note Include SDL_syswm.h for the declaration of SDL_SysWMinfo.
730 */ 742 */
731 struct SDL_SysWMinfo; 743 struct SDL_SysWMinfo;
732 extern DECLSPEC SDL_bool SDLCALL SDL_GetWindowWMInfo(SDL_WindowID windowID, 744 extern DECLSPEC SDL_bool SDLCALL SDL_GetWindowWMInfo(SDL_Window * window,
733 struct SDL_SysWMinfo 745 struct SDL_SysWMinfo
734 *info); 746 *info);
735 747
736 /** 748 /**
737 * \brief Destroy a window. 749 * \brief Destroy a window.
738 */ 750 */
739 extern DECLSPEC void SDLCALL SDL_DestroyWindow(SDL_WindowID windowID); 751 extern DECLSPEC void SDLCALL SDL_DestroyWindow(SDL_Window * window);
740 752
741 /** 753 /**
742 * \brief Get the number of 2D rendering drivers available for the current 754 * \brief Get the number of 2D rendering drivers available for the current
743 * display. 755 * display.
744 * 756 *
767 SDL_RendererInfo * info); 779 SDL_RendererInfo * info);
768 780
769 /** 781 /**
770 * \brief Create and make active a 2D rendering context for a window. 782 * \brief Create and make active a 2D rendering context for a window.
771 * 783 *
772 * \param windowID The window where rendering is displayed. 784 * \param window The window where rendering is displayed.
773 * \param index The index of the rendering driver to initialize, or -1 to 785 * \param index The index of the rendering driver to initialize, or -1 to
774 * initialize the first one supporting the requested flags. 786 * initialize the first one supporting the requested flags.
775 * \param flags ::SDL_RendererFlags. 787 * \param flags ::SDL_RendererFlags.
776 * 788 *
777 * \return 0 on success, -1 if there was an error creating the renderer. 789 * \return 0 on success, -1 if there was an error creating the renderer.
778 * 790 *
779 * \sa SDL_SelectRenderer() 791 * \sa SDL_SelectRenderer()
780 * \sa SDL_GetRendererInfo() 792 * \sa SDL_GetRendererInfo()
781 * \sa SDL_DestroyRenderer() 793 * \sa SDL_DestroyRenderer()
782 */ 794 */
783 extern DECLSPEC int SDLCALL SDL_CreateRenderer(SDL_WindowID windowID, 795 extern DECLSPEC int SDLCALL SDL_CreateRenderer(SDL_Window * window,
784 int index, Uint32 flags); 796 int index, Uint32 flags);
785 797
786 /** 798 /**
787 * \brief Select the rendering context for a particular window. 799 * \brief Select the rendering context for a particular window.
788 * 800 *
789 * \return 0 on success, -1 if the selected window doesn't have a 801 * \return 0 on success, -1 if the selected window doesn't have a
790 * rendering context. 802 * rendering context.
791 */ 803 */
792 extern DECLSPEC int SDLCALL SDL_SelectRenderer(SDL_WindowID windowID); 804 extern DECLSPEC int SDLCALL SDL_SelectRenderer(SDL_Window * window);
793 805
794 /** 806 /**
795 * \brief Get information about the current rendering context. 807 * \brief Get information about the current rendering context.
796 */ 808 */
797 extern DECLSPEC int SDLCALL SDL_GetRendererInfo(SDL_RendererInfo * info); 809 extern DECLSPEC int SDLCALL SDL_GetRendererInfo(SDL_RendererInfo * info);
809 * of range. 821 * of range.
810 * 822 *
811 * \sa SDL_QueryTexture() 823 * \sa SDL_QueryTexture()
812 * \sa SDL_DestroyTexture() 824 * \sa SDL_DestroyTexture()
813 */ 825 */
814 extern DECLSPEC SDL_TextureID SDLCALL SDL_CreateTexture(Uint32 format, 826 extern DECLSPEC SDL_Texture * SDLCALL SDL_CreateTexture(Uint32 format,
815 int access, int w, 827 int access, int w,
816 int h); 828 int h);
817 829
818 /** 830 /**
819 * \brief Create a texture from an existing surface. 831 * \brief Create a texture from an existing surface.
828 * \note The surface is not modified or freed by this function. 840 * \note The surface is not modified or freed by this function.
829 * 841 *
830 * \sa SDL_QueryTexture() 842 * \sa SDL_QueryTexture()
831 * \sa SDL_DestroyTexture() 843 * \sa SDL_DestroyTexture()
832 */ 844 */
833 extern DECLSPEC SDL_TextureID SDLCALL SDL_CreateTextureFromSurface(Uint32 845 extern DECLSPEC SDL_Texture * SDLCALL SDL_CreateTextureFromSurface(Uint32
834 format, 846 format,
835 SDL_Surface 847 SDL_Surface
836 * surface); 848 * surface);
837 849
838 /** 850 /**
839 * \brief Query the attributes of a texture 851 * \brief Query the attributes of a texture
840 * 852 *
841 * \param textureID A texture to be queried. 853 * \param texture A texture to be queried.
842 * \param format A pointer filled in with the raw format of the texture. The 854 * \param format A pointer filled in with the raw format of the texture. The
843 * actual format may differ, but pixel transfers will use this 855 * actual format may differ, but pixel transfers will use this
844 * format. 856 * format.
845 * \param access A pointer filled in with the actual access to the texture. 857 * \param access A pointer filled in with the actual access to the texture.
846 * \param w A pointer filled in with the width of the texture in pixels. 858 * \param w A pointer filled in with the width of the texture in pixels.
847 * \param h A pointer filled in with the height of the texture in pixels. 859 * \param h A pointer filled in with the height of the texture in pixels.
848 * 860 *
849 * \return 0 on success, or -1 if the texture is not valid. 861 * \return 0 on success, or -1 if the texture is not valid.
850 */ 862 */
851 extern DECLSPEC int SDLCALL SDL_QueryTexture(SDL_TextureID textureID, 863 extern DECLSPEC int SDLCALL SDL_QueryTexture(SDL_Texture * texture,
852 Uint32 * format, int *access, 864 Uint32 * format, int *access,
853 int *w, int *h); 865 int *w, int *h);
854 866
855 /** 867 /**
856 * \brief Query the pixels of a texture, if the texture does not need to be 868 * \brief Query the pixels of a texture, if the texture does not need to be
857 * locked for pixel access. 869 * locked for pixel access.
858 * 870 *
859 * \param textureID A texture to be queried, which was created with 871 * \param texture A texture to be queried, which was created with
860 * ::SDL_TEXTUREACCESS_STREAMING. 872 * ::SDL_TEXTUREACCESS_STREAMING.
861 * \param pixels A pointer filled with a pointer to the pixels for the 873 * \param pixels A pointer filled with a pointer to the pixels for the
862 * texture. 874 * texture.
863 * \param pitch A pointer filled in with the pitch of the pixel data. 875 * \param pitch A pointer filled in with the pitch of the pixel data.
864 * 876 *
865 * \return 0 on success, or -1 if the texture is not valid, or must be locked 877 * \return 0 on success, or -1 if the texture is not valid, or must be locked
866 * for pixel access. 878 * for pixel access.
867 */ 879 */
868 extern DECLSPEC int SDLCALL SDL_QueryTexturePixels(SDL_TextureID textureID, 880 extern DECLSPEC int SDLCALL SDL_QueryTexturePixels(SDL_Texture * texture,
869 void **pixels, int *pitch); 881 void **pixels, int *pitch);
870 882
871 /** 883 /**
872 * \brief Set the color palette of an indexed texture. 884 * \brief Set the color palette of an indexed texture.
873 * 885 *
874 * \param textureID The texture to update. 886 * \param texture The texture to update.
875 * \param colors The array of RGB color data. 887 * \param colors The array of RGB color data.
876 * \param firstcolor The first index to update. 888 * \param firstcolor The first index to update.
877 * \param ncolors The number of palette entries to fill with the color data. 889 * \param ncolors The number of palette entries to fill with the color data.
878 * 890 *
879 * \return 0 on success, or -1 if the texture is not valid or not an indexed 891 * \return 0 on success, or -1 if the texture is not valid or not an indexed
880 * texture. 892 * texture.
881 */ 893 */
882 extern DECLSPEC int SDLCALL SDL_SetTexturePalette(SDL_TextureID textureID, 894 extern DECLSPEC int SDLCALL SDL_SetTexturePalette(SDL_Texture * texture,
883 const SDL_Color * colors, 895 const SDL_Color * colors,
884 int firstcolor, 896 int firstcolor,
885 int ncolors); 897 int ncolors);
886 898
887 /** 899 /**
888 * \brief Get the color palette from an indexed texture if it has one. 900 * \brief Get the color palette from an indexed texture if it has one.
889 * 901 *
890 * \param textureID The texture to update. 902 * \param texture The texture to update.
891 * \param colors The array to fill with RGB color data. 903 * \param colors The array to fill with RGB color data.
892 * \param firstcolor The first index to retrieve. 904 * \param firstcolor The first index to retrieve.
893 * \param ncolors The number of palette entries to retrieve. 905 * \param ncolors The number of palette entries to retrieve.
894 * 906 *
895 * \return 0 on success, or -1 if the texture is not valid or not an indexed 907 * \return 0 on success, or -1 if the texture is not valid or not an indexed
896 * texture. 908 * texture.
897 */ 909 */
898 extern DECLSPEC int SDLCALL SDL_GetTexturePalette(SDL_TextureID textureID, 910 extern DECLSPEC int SDLCALL SDL_GetTexturePalette(SDL_Texture * texture,
899 SDL_Color * colors, 911 SDL_Color * colors,
900 int firstcolor, 912 int firstcolor,
901 int ncolors); 913 int ncolors);
902 914
903 /** 915 /**
904 * \brief Set an additional color value used in render copy operations. 916 * \brief Set an additional color value used in render copy operations.
905 * 917 *
906 * \param textureID The texture to update. 918 * \param texture The texture to update.
907 * \param r The red source color value multiplied into copy operations. 919 * \param r The red source color value multiplied into copy operations.
908 * \param g The green source color value multiplied into copy operations. 920 * \param g The green source color value multiplied into copy operations.
909 * \param b The blue source color value multiplied into copy operations. 921 * \param b The blue source color value multiplied into copy operations.
910 * 922 *
911 * \return 0 on success, or -1 if the texture is not valid or color modulation 923 * \return 0 on success, or -1 if the texture is not valid or color modulation
912 * is not supported. 924 * is not supported.
913 * 925 *
914 * \sa SDL_GetTextureColorMod() 926 * \sa SDL_GetTextureColorMod()
915 */ 927 */
916 extern DECLSPEC int SDLCALL SDL_SetTextureColorMod(SDL_TextureID textureID, 928 extern DECLSPEC int SDLCALL SDL_SetTextureColorMod(SDL_Texture * texture,
917 Uint8 r, Uint8 g, Uint8 b); 929 Uint8 r, Uint8 g, Uint8 b);
918 930
919 931
920 /** 932 /**
921 * \brief Get the additional color value used in render copy operations. 933 * \brief Get the additional color value used in render copy operations.
922 * 934 *
923 * \param textureID The texture to query. 935 * \param texture The texture to query.
924 * \param r A pointer filled in with the source red color value. 936 * \param r A pointer filled in with the source red color value.
925 * \param g A pointer filled in with the source green color value. 937 * \param g A pointer filled in with the source green color value.
926 * \param b A pointer filled in with the source blue color value. 938 * \param b A pointer filled in with the source blue color value.
927 * 939 *
928 * \return 0 on success, or -1 if the texture is not valid. 940 * \return 0 on success, or -1 if the texture is not valid.
929 * 941 *
930 * \sa SDL_SetTextureColorMod() 942 * \sa SDL_SetTextureColorMod()
931 */ 943 */
932 extern DECLSPEC int SDLCALL SDL_GetTextureColorMod(SDL_TextureID textureID, 944 extern DECLSPEC int SDLCALL SDL_GetTextureColorMod(SDL_Texture * texture,
933 Uint8 * r, Uint8 * g, 945 Uint8 * r, Uint8 * g,
934 Uint8 * b); 946 Uint8 * b);
935 947
936 /** 948 /**
937 * \brief Set an additional alpha value used in render copy operations. 949 * \brief Set an additional alpha value used in render copy operations.
938 * 950 *
939 * \param textureID The texture to update. 951 * \param texture The texture to update.
940 * \param alpha The source alpha value multiplied into copy operations. 952 * \param alpha The source alpha value multiplied into copy operations.
941 * 953 *
942 * \return 0 on success, or -1 if the texture is not valid or alpha modulation 954 * \return 0 on success, or -1 if the texture is not valid or alpha modulation
943 * is not supported. 955 * is not supported.
944 * 956 *
945 * \sa SDL_GetTextureAlphaMod() 957 * \sa SDL_GetTextureAlphaMod()
946 */ 958 */
947 extern DECLSPEC int SDLCALL SDL_SetTextureAlphaMod(SDL_TextureID textureID, 959 extern DECLSPEC int SDLCALL SDL_SetTextureAlphaMod(SDL_Texture * texture,
948 Uint8 alpha); 960 Uint8 alpha);
949 961
950 /** 962 /**
951 * \brief Get the additional alpha value used in render copy operations. 963 * \brief Get the additional alpha value used in render copy operations.
952 * 964 *
953 * \param textureID The texture to query. 965 * \param texture The texture to query.
954 * \param alpha A pointer filled in with the source alpha value. 966 * \param alpha A pointer filled in with the source alpha value.
955 * 967 *
956 * \return 0 on success, or -1 if the texture is not valid. 968 * \return 0 on success, or -1 if the texture is not valid.
957 * 969 *
958 * \sa SDL_SetTextureAlphaMod() 970 * \sa SDL_SetTextureAlphaMod()
959 */ 971 */
960 extern DECLSPEC int SDLCALL SDL_GetTextureAlphaMod(SDL_TextureID textureID, 972 extern DECLSPEC int SDLCALL SDL_GetTextureAlphaMod(SDL_Texture * texture,
961 Uint8 * alpha); 973 Uint8 * alpha);
962 974
963 /** 975 /**
964 * \brief Set the blend mode used for texture copy operations. 976 * \brief Set the blend mode used for texture copy operations.
965 * 977 *
966 * \param textureID The texture to update. 978 * \param texture The texture to update.
967 * \param blendMode ::SDL_BlendMode to use for texture blending. 979 * \param blendMode ::SDL_BlendMode to use for texture blending.
968 * 980 *
969 * \return 0 on success, or -1 if the texture is not valid or the blend mode is 981 * \return 0 on success, or -1 if the texture is not valid or the blend mode is
970 * not supported. 982 * not supported.
971 * 983 *
972 * \note If the blend mode is not supported, the closest supported mode is 984 * \note If the blend mode is not supported, the closest supported mode is
973 * chosen. 985 * chosen.
974 * 986 *
975 * \sa SDL_GetTextureBlendMode() 987 * \sa SDL_GetTextureBlendMode()
976 */ 988 */
977 extern DECLSPEC int SDLCALL SDL_SetTextureBlendMode(SDL_TextureID textureID, 989 extern DECLSPEC int SDLCALL SDL_SetTextureBlendMode(SDL_Texture * texture,
978 int blendMode); 990 int blendMode);
979 991
980 /** 992 /**
981 * \brief Get the blend mode used for texture copy operations. 993 * \brief Get the blend mode used for texture copy operations.
982 * 994 *
983 * \param textureID The texture to query. 995 * \param texture The texture to query.
984 * \param blendMode A pointer filled in with the current blend mode. 996 * \param blendMode A pointer filled in with the current blend mode.
985 * 997 *
986 * \return 0 on success, or -1 if the texture is not valid. 998 * \return 0 on success, or -1 if the texture is not valid.
987 * 999 *
988 * \sa SDL_SetTextureBlendMode() 1000 * \sa SDL_SetTextureBlendMode()
989 */ 1001 */
990 extern DECLSPEC int SDLCALL SDL_GetTextureBlendMode(SDL_TextureID textureID, 1002 extern DECLSPEC int SDLCALL SDL_GetTextureBlendMode(SDL_Texture * texture,
991 int *blendMode); 1003 int *blendMode);
992 1004
993 /** 1005 /**
994 * \brief Set the scale mode used for texture copy operations. 1006 * \brief Set the scale mode used for texture copy operations.
995 * 1007 *
996 * \param textureID The texture to update. 1008 * \param texture The texture to update.
997 * \param scaleMode ::SDL_TextureScaleMode to use for texture scaling. 1009 * \param scaleMode ::SDL_TextureScaleMode to use for texture scaling.
998 * 1010 *
999 * \return 0 on success, or -1 if the texture is not valid or the scale mode is 1011 * \return 0 on success, or -1 if the texture is not valid or the scale mode is
1000 * not supported. 1012 * not supported.
1001 * 1013 *
1002 * \note If the scale mode is not supported, the closest supported mode is 1014 * \note If the scale mode is not supported, the closest supported mode is
1003 * chosen. 1015 * chosen.
1004 * 1016 *
1005 * \sa SDL_GetTextureScaleMode() 1017 * \sa SDL_GetTextureScaleMode()
1006 */ 1018 */
1007 extern DECLSPEC int SDLCALL SDL_SetTextureScaleMode(SDL_TextureID textureID, 1019 extern DECLSPEC int SDLCALL SDL_SetTextureScaleMode(SDL_Texture * texture,
1008 int scaleMode); 1020 int scaleMode);
1009 1021
1010 /** 1022 /**
1011 * \brief Get the scale mode used for texture copy operations. 1023 * \brief Get the scale mode used for texture copy operations.
1012 * 1024 *
1013 * \param textureID The texture to query. 1025 * \param texture The texture to query.
1014 * \param scaleMode A pointer filled in with the current scale mode. 1026 * \param scaleMode A pointer filled in with the current scale mode.
1015 * 1027 *
1016 * \return 0 on success, or -1 if the texture is not valid. 1028 * \return 0 on success, or -1 if the texture is not valid.
1017 * 1029 *
1018 * \sa SDL_SetTextureScaleMode() 1030 * \sa SDL_SetTextureScaleMode()
1019 */ 1031 */
1020 extern DECLSPEC int SDLCALL SDL_GetTextureScaleMode(SDL_TextureID textureID, 1032 extern DECLSPEC int SDLCALL SDL_GetTextureScaleMode(SDL_Texture * texture,
1021 int *scaleMode); 1033 int *scaleMode);
1022 1034
1023 /** 1035 /**
1024 * \brief Update the given texture rectangle with new pixel data. 1036 * \brief Update the given texture rectangle with new pixel data.
1025 * 1037 *
1026 * \param textureID The texture to update 1038 * \param texture The texture to update
1027 * \param rect A pointer to the rectangle of pixels to update, or NULL to 1039 * \param rect A pointer to the rectangle of pixels to update, or NULL to
1028 * update the entire texture. 1040 * update the entire texture.
1029 * \param pixels The raw pixel data. 1041 * \param pixels The raw pixel data.
1030 * \param pitch The number of bytes between rows of pixel data. 1042 * \param pitch The number of bytes between rows of pixel data.
1031 * 1043 *
1032 * \return 0 on success, or -1 if the texture is not valid. 1044 * \return 0 on success, or -1 if the texture is not valid.
1033 * 1045 *
1034 * \note This is a fairly slow function. 1046 * \note This is a fairly slow function.
1035 */ 1047 */
1036 extern DECLSPEC int SDLCALL SDL_UpdateTexture(SDL_TextureID textureID, 1048 extern DECLSPEC int SDLCALL SDL_UpdateTexture(SDL_Texture * texture,
1037 const SDL_Rect * rect, 1049 const SDL_Rect * rect,
1038 const void *pixels, int pitch); 1050 const void *pixels, int pitch);
1039 1051
1040 /** 1052 /**
1041 * \brief Lock a portion of the texture for pixel access. 1053 * \brief Lock a portion of the texture for pixel access.
1042 * 1054 *
1043 * \param textureID The texture to lock for access, which was created with 1055 * \param texture The texture to lock for access, which was created with
1044 * ::SDL_TEXTUREACCESS_STREAMING. 1056 * ::SDL_TEXTUREACCESS_STREAMING.
1045 * \param rect A pointer to the rectangle to lock for access. If the rect 1057 * \param rect A pointer to the rectangle to lock for access. If the rect
1046 * is NULL, the entire texture will be locked. 1058 * is NULL, the entire texture will be locked.
1047 * \param markDirty If this is nonzero, the locked area will be marked dirty 1059 * \param markDirty If this is nonzero, the locked area will be marked dirty
1048 * when the texture is unlocked. 1060 * when the texture is unlocked.
1054 * ::SDL_TEXTUREACCESS_STATIC. 1066 * ::SDL_TEXTUREACCESS_STATIC.
1055 * 1067 *
1056 * \sa SDL_DirtyTexture() 1068 * \sa SDL_DirtyTexture()
1057 * \sa SDL_UnlockTexture() 1069 * \sa SDL_UnlockTexture()
1058 */ 1070 */
1059 extern DECLSPEC int SDLCALL SDL_LockTexture(SDL_TextureID textureID, 1071 extern DECLSPEC int SDLCALL SDL_LockTexture(SDL_Texture * texture,
1060 const SDL_Rect * rect, 1072 const SDL_Rect * rect,
1061 int markDirty, void **pixels, 1073 int markDirty, void **pixels,
1062 int *pitch); 1074 int *pitch);
1063 1075
1064 /** 1076 /**
1065 * \brief Unlock a texture, uploading the changes to video memory, if needed. 1077 * \brief Unlock a texture, uploading the changes to video memory, if needed.
1066 * 1078 *
1067 * \sa SDL_LockTexture() 1079 * \sa SDL_LockTexture()
1068 * \sa SDL_DirtyTexture() 1080 * \sa SDL_DirtyTexture()
1069 */ 1081 */
1070 extern DECLSPEC void SDLCALL SDL_UnlockTexture(SDL_TextureID textureID); 1082 extern DECLSPEC void SDLCALL SDL_UnlockTexture(SDL_Texture * texture);
1071 1083
1072 /** 1084 /**
1073 * \brief Mark the specified rectangles of the texture as dirty. 1085 * \brief Mark the specified rectangles of the texture as dirty.
1074 * 1086 *
1075 * \param textureID The texture to mark dirty, which was created with 1087 * \param texture The texture to mark dirty, which was created with
1076 * ::SDL_TEXTUREACCESS_STREAMING. 1088 * ::SDL_TEXTUREACCESS_STREAMING.
1077 * \param numrects The number of rectangles pointed to by rects. 1089 * \param numrects The number of rectangles pointed to by rects.
1078 * \param rects The pointer to an array of dirty rectangles. 1090 * \param rects The pointer to an array of dirty rectangles.
1079 * 1091 *
1080 * \sa SDL_LockTexture() 1092 * \sa SDL_LockTexture()
1081 * \sa SDL_UnlockTexture() 1093 * \sa SDL_UnlockTexture()
1082 */ 1094 */
1083 extern DECLSPEC void SDLCALL SDL_DirtyTexture(SDL_TextureID textureID, 1095 extern DECLSPEC void SDLCALL SDL_DirtyTexture(SDL_Texture * texture,
1084 int numrects, 1096 int numrects,
1085 const SDL_Rect * rects); 1097 const SDL_Rect * rects);
1086 1098
1087 /** 1099 /**
1088 * \brief Set the color used for drawing operations (Fill and Line). 1100 * \brief Set the color used for drawing operations (Fill and Line).
1226 extern DECLSPEC int SDLCALL SDL_RenderFillRects(const SDL_Rect ** rect, int count); 1238 extern DECLSPEC int SDLCALL SDL_RenderFillRects(const SDL_Rect ** rect, int count);
1227 1239
1228 /** 1240 /**
1229 * \brief Copy a portion of the texture to the current rendering target. 1241 * \brief Copy a portion of the texture to the current rendering target.
1230 * 1242 *
1231 * \param textureID The source texture. 1243 * \param texture The source texture.
1232 * \param srcrect A pointer to the source rectangle, or NULL for the entire 1244 * \param srcrect A pointer to the source rectangle, or NULL for the entire
1233 * texture. 1245 * texture.
1234 * \param dstrect A pointer to the destination rectangle, or NULL for the 1246 * \param dstrect A pointer to the destination rectangle, or NULL for the
1235 * entire rendering target. 1247 * entire rendering target.
1236 * 1248 *
1237 * \return 0 on success, or -1 if there is no rendering context current, or the 1249 * \return 0 on success, or -1 if there is no rendering context current, or the
1238 * driver doesn't support the requested operation. 1250 * driver doesn't support the requested operation.
1239 */ 1251 */
1240 extern DECLSPEC int SDLCALL SDL_RenderCopy(SDL_TextureID textureID, 1252 extern DECLSPEC int SDLCALL SDL_RenderCopy(SDL_Texture * texture,
1241 const SDL_Rect * srcrect, 1253 const SDL_Rect * srcrect,
1242 const SDL_Rect * dstrect); 1254 const SDL_Rect * dstrect);
1243 1255
1244 /** 1256 /**
1245 * \brief Read pixels from the current rendering target. 1257 * \brief Read pixels from the current rendering target.
1287 * \brief Destroy the specified texture. 1299 * \brief Destroy the specified texture.
1288 * 1300 *
1289 * \sa SDL_CreateTexture() 1301 * \sa SDL_CreateTexture()
1290 * \sa SDL_CreateTextureFromSurface() 1302 * \sa SDL_CreateTextureFromSurface()
1291 */ 1303 */
1292 extern DECLSPEC void SDLCALL SDL_DestroyTexture(SDL_TextureID textureID); 1304 extern DECLSPEC void SDLCALL SDL_DestroyTexture(SDL_Texture * texture);
1293 1305
1294 /** 1306 /**
1295 * \brief Destroy the rendering context for a window and free associated 1307 * \brief Destroy the rendering context for a window and free associated
1296 * textures. 1308 * textures.
1297 * 1309 *
1298 * \sa SDL_CreateRenderer() 1310 * \sa SDL_CreateRenderer()
1299 */ 1311 */
1300 extern DECLSPEC void SDLCALL SDL_DestroyRenderer(SDL_WindowID windowID); 1312 extern DECLSPEC void SDLCALL SDL_DestroyRenderer(SDL_Window * window);
1301 1313
1302 /** 1314 /**
1303 * \brief Returns whether the screensaver is currently enabled (default off). 1315 * \brief Returns whether the screensaver is currently enabled (default off).
1304 * 1316 *
1305 * \sa SDL_EnableScreenSaver() 1317 * \sa SDL_EnableScreenSaver()
1382 * \brief Create an OpenGL context for use with an OpenGL window, and make it 1394 * \brief Create an OpenGL context for use with an OpenGL window, and make it
1383 * current. 1395 * current.
1384 * 1396 *
1385 * \sa SDL_GL_DeleteContext() 1397 * \sa SDL_GL_DeleteContext()
1386 */ 1398 */
1387 extern DECLSPEC SDL_GLContext SDLCALL SDL_GL_CreateContext(SDL_WindowID 1399 extern DECLSPEC SDL_GLContext SDLCALL SDL_GL_CreateContext(SDL_Window *
1388 windowID); 1400 window);
1389 1401
1390 /** 1402 /**
1391 * \brief Set up an OpenGL context for rendering into an OpenGL window. 1403 * \brief Set up an OpenGL context for rendering into an OpenGL window.
1392 * 1404 *
1393 * \note The context must have been created with a compatible window. 1405 * \note The context must have been created with a compatible window.
1394 */ 1406 */
1395 extern DECLSPEC int SDLCALL SDL_GL_MakeCurrent(SDL_WindowID windowID, 1407 extern DECLSPEC int SDLCALL SDL_GL_MakeCurrent(SDL_Window * window,
1396 SDL_GLContext context); 1408 SDL_GLContext context);
1397 1409
1398 /** 1410 /**
1399 * \brief Set the swap interval for the current OpenGL context. 1411 * \brief Set the swap interval for the current OpenGL context.
1400 * 1412 *
1420 1432
1421 /** 1433 /**
1422 * \brief Swap the OpenGL buffers for the window, if double-buffering is 1434 * \brief Swap the OpenGL buffers for the window, if double-buffering is
1423 * supported. 1435 * supported.
1424 */ 1436 */
1425 extern DECLSPEC void SDLCALL SDL_GL_SwapWindow(SDL_WindowID windowID); 1437 extern DECLSPEC void SDLCALL SDL_GL_SwapWindow(SDL_Window * window);
1426 1438
1427 /** 1439 /**
1428 * \brief Delete an OpenGL context. 1440 * \brief Delete an OpenGL context.
1429 * 1441 *
1430 * \sa SDL_GL_CreateContext() 1442 * \sa SDL_GL_CreateContext()