Nuevo sistema de escenas mediante el uso de un SceneBuilder polimófico. De esta forma sólo habrá una escena cargada en cada momento.
Actualización de las librerías Vendor Dear ImGui y SDL2 a sus últimas versiones. (Es posible que actualicemos ImGui al "Docking Branch" en un futuro). Preparación inicial para el renderizado mediante ImGui (SDL+SDL_Renderer). (Hará falta un pequeño rediseño al renderer para hacer posible el renderizado de ImGui fuera de UE).
This commit is contained in:
@@ -4,6 +4,7 @@
|
|||||||
#include "Logging\Logger.h"
|
#include "Logging\Logger.h"
|
||||||
#include "Assets\AssetManager.h"
|
#include "Assets\AssetManager.h"
|
||||||
|
|
||||||
|
|
||||||
#include "SDL_rect.h"
|
#include "SDL_rect.h"
|
||||||
|
|
||||||
namespace UE
|
namespace UE
|
||||||
|
|||||||
@@ -15,6 +15,7 @@
|
|||||||
/*UberEngine Includes*/
|
/*UberEngine Includes*/
|
||||||
#include "Assets\Asset.h"
|
#include "Assets\Asset.h"
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// TODO:
|
/// TODO:
|
||||||
/// - Modificar las funciones de Carga para quitar la queue o implementar una que tenga sentido.
|
/// - Modificar las funciones de Carga para quitar la queue o implementar una que tenga sentido.
|
||||||
@@ -28,6 +29,7 @@
|
|||||||
|
|
||||||
namespace UE
|
namespace UE
|
||||||
{
|
{
|
||||||
|
|
||||||
enum class LoadMethod
|
enum class LoadMethod
|
||||||
{
|
{
|
||||||
//Añade los Assets a una cola, que será procesada poco a poco mediante ProcessAssetQueue().
|
//Añade los Assets a una cola, que será procesada poco a poco mediante ProcessAssetQueue().
|
||||||
|
|||||||
@@ -1,144 +0,0 @@
|
|||||||
#include <iostream>
|
|
||||||
|
|
||||||
#include "Game.h"
|
|
||||||
#include "Render\Renderer.h"
|
|
||||||
|
|
||||||
#include "Drawables\Sprite.h"
|
|
||||||
|
|
||||||
int UE::Game::GameInit()
|
|
||||||
{
|
|
||||||
|
|
||||||
renderer = new Renderer(640, 480);
|
|
||||||
renderer->InitRenderer();
|
|
||||||
|
|
||||||
assetManager = new AssetManager(renderer->GetSDLRenderer());
|
|
||||||
assetManager->InitAssetManager();
|
|
||||||
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int UE::Game::GameLoad()
|
|
||||||
{
|
|
||||||
//Asset as1("bg1", "resources\\Sprites\\bc.png", AssetType::Texture);
|
|
||||||
//assetManager->AddAssetToQueue(as1);
|
|
||||||
assetManager->LoadAssetsFromFile("resources\\AssetList\\MainAssets.json");
|
|
||||||
assetManager->ProcessAssetQueue();
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int UE::Game::GameLoop()
|
|
||||||
{
|
|
||||||
|
|
||||||
#pragma region TEMP_REDERING
|
|
||||||
|
|
||||||
//SDL_Surface* loaderSurface;
|
|
||||||
SDL_Texture* background;
|
|
||||||
SDL_Texture* test1;
|
|
||||||
|
|
||||||
|
|
||||||
SDL_Rect DestR;
|
|
||||||
DestR.x = 0;
|
|
||||||
DestR.y = 0;
|
|
||||||
DestR.w = 640;
|
|
||||||
DestR.h = 480;
|
|
||||||
|
|
||||||
SDL_Rect DestR2;
|
|
||||||
DestR2.x = 48;
|
|
||||||
DestR2.y = 48;
|
|
||||||
DestR2.w = 128;
|
|
||||||
DestR2.h = 128;
|
|
||||||
|
|
||||||
background = assetManager->getTexture("bg1");
|
|
||||||
test1 = assetManager->getTexture("test1");
|
|
||||||
|
|
||||||
glm::vec2 sp1_pos(48, 48);
|
|
||||||
glm::vec2 sp1_size(145, 145);
|
|
||||||
//Sprite sp1("test1", assetManager, 5, sp1_pos, sp1_size);
|
|
||||||
//Sprite sp2("test1", assetManager, 7, sp1_pos);
|
|
||||||
Sprite sp3(test1);
|
|
||||||
|
|
||||||
|
|
||||||
#pragma endregion
|
|
||||||
|
|
||||||
#pragma region TEMP_FPS_Timer
|
|
||||||
|
|
||||||
Uint32 startTime = SDL_GetTicks();
|
|
||||||
Uint16 countedFrames = 0;
|
|
||||||
double deltaTime = 0;
|
|
||||||
const int FPS = 60;
|
|
||||||
const int MS_PER_FRAME = 1000 / FPS;
|
|
||||||
|
|
||||||
#pragma endregion
|
|
||||||
|
|
||||||
|
|
||||||
while (!_quit)
|
|
||||||
{
|
|
||||||
startTime = SDL_GetTicks();
|
|
||||||
//TEMP Event Handler:
|
|
||||||
SDL_Event eventHandler;
|
|
||||||
while (SDL_PollEvent(&eventHandler) != 0)
|
|
||||||
{
|
|
||||||
if (eventHandler.type == SDL_QUIT)
|
|
||||||
{
|
|
||||||
_quit = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const Uint8* keyStates = SDL_GetKeyboardState(NULL);
|
|
||||||
if (keyStates[SDL_SCANCODE_W])
|
|
||||||
{
|
|
||||||
DestR2.y -= (25 * deltaTime);
|
|
||||||
}
|
|
||||||
if(keyStates[SDL_SCANCODE_S])
|
|
||||||
{
|
|
||||||
DestR2.y -= (50 * deltaTime);
|
|
||||||
//std::cout << "S PRESS" << std::endl;
|
|
||||||
}
|
|
||||||
if (keyStates[SDL_SCANCODE_ESCAPE])
|
|
||||||
{
|
|
||||||
_quit = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
//FRAME PHYSICS
|
|
||||||
//TICK ALL OBJECTS.
|
|
||||||
renderer->QueueDrawCall(6, DestR2, test1);
|
|
||||||
renderer->QueueDrawCall(1, DestR, background);
|
|
||||||
|
|
||||||
//renderer->Render(sp1);
|
|
||||||
//sp2.Draw(renderer);
|
|
||||||
//sp3.Draw(renderer);
|
|
||||||
|
|
||||||
renderer->RenderFrame();
|
|
||||||
Uint32 frameTime = SDL_GetTicks() - startTime;
|
|
||||||
deltaTime = frameTime / 1000.f;
|
|
||||||
//Frames totales / segundos totales.
|
|
||||||
float avgFPS = countedFrames / (SDL_GetTicks() / 1000.f);
|
|
||||||
std::cout << "FPS: " << avgFPS << " / " << "dT: " << deltaTime << std::endl;
|
|
||||||
|
|
||||||
//FPS CAP
|
|
||||||
if (frameTime < MS_PER_FRAME)
|
|
||||||
{
|
|
||||||
SDL_Delay(MS_PER_FRAME - frameTime);
|
|
||||||
}
|
|
||||||
|
|
||||||
++countedFrames;
|
|
||||||
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int UE::Game::GameClean()
|
|
||||||
{
|
|
||||||
|
|
||||||
assetManager->CleanAssetManager();
|
|
||||||
delete assetManager;
|
|
||||||
|
|
||||||
renderer->CleanRenderer();
|
|
||||||
delete renderer;
|
|
||||||
|
|
||||||
SDL_Quit();
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
@@ -1,71 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
//#include <iostream>
|
|
||||||
|
|
||||||
/*LIB Includes*/
|
|
||||||
#include <ImGui\imgui.h>
|
|
||||||
|
|
||||||
/*UE Includes*/
|
|
||||||
#include "Render\Renderer.h"
|
|
||||||
#include "Assets\AssetManager.h"
|
|
||||||
|
|
||||||
|
|
||||||
///
|
|
||||||
/// TODO:
|
|
||||||
/// - Convertir los ptrs de los sistema UE a smart_pointers.
|
|
||||||
/// - Probablemente, eliminar el Singleton y hacer los ptrs static.
|
|
||||||
///
|
|
||||||
|
|
||||||
namespace UE
|
|
||||||
{
|
|
||||||
class Game
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
#pragma region Singleton
|
|
||||||
|
|
||||||
private:
|
|
||||||
Game()
|
|
||||||
: renderer(NULL), assetManager(NULL) {}
|
|
||||||
//static Game* instance;
|
|
||||||
|
|
||||||
public:
|
|
||||||
static Game& getInstance()
|
|
||||||
{
|
|
||||||
static Game instance;
|
|
||||||
return instance;
|
|
||||||
}
|
|
||||||
Game(Game const&) = delete;
|
|
||||||
void operator=(Game const&) = delete;
|
|
||||||
|
|
||||||
#pragma endregion
|
|
||||||
|
|
||||||
/* Game Stages */
|
|
||||||
int GameInit(); //Inicia todos los componentes necesarios para el funcionamiento del motor.
|
|
||||||
|
|
||||||
int GameLoad(); //Carga los elementos del juego.
|
|
||||||
|
|
||||||
int GameLoop(); //Loop del juego.
|
|
||||||
|
|
||||||
int GameClean(); //Deja todo limpio y brillante por parte del motor.
|
|
||||||
//Suponemos que con eso limpia también el juego.
|
|
||||||
|
|
||||||
|
|
||||||
/*----Métodos del GameLoop----
|
|
||||||
// Conjunto de métodos que se ejecutan en el GameLoop.
|
|
||||||
*/
|
|
||||||
|
|
||||||
void GameLoopRender();
|
|
||||||
void GameLoopEvents();
|
|
||||||
|
|
||||||
/* UE Elements */
|
|
||||||
Renderer* renderer; // To get SDL Renderer use: renderer.getSDLRenderer();
|
|
||||||
AssetManager* assetManager;
|
|
||||||
|
|
||||||
/* TEMP STUFF */
|
|
||||||
bool _quit = false;
|
|
||||||
|
|
||||||
//SceneManager SM;
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,6 +1,15 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
|
#include <ImGui\imgui.h>
|
||||||
|
#include <ImGui\imgui_impl_sdl.h>
|
||||||
|
#include <ImGui\imgui_impl_sdlrenderer.h>
|
||||||
|
//#include <ImGui\imgui_impl_opengl3.h>
|
||||||
|
|
||||||
|
#include <SDL\include\SDL_opengl.h>
|
||||||
|
|
||||||
|
|
||||||
#include "Renderer.h"
|
#include "Renderer.h"
|
||||||
|
#include "Logging\Logger.h"
|
||||||
|
|
||||||
namespace UE
|
namespace UE
|
||||||
{
|
{
|
||||||
@@ -8,32 +17,51 @@ namespace UE
|
|||||||
|
|
||||||
int Renderer::InitRenderer()
|
int Renderer::InitRenderer()
|
||||||
{
|
{
|
||||||
|
//Iniciamos SDL.
|
||||||
|
SDL_HINT_RENDER_DRIVER "opengl";
|
||||||
|
|
||||||
if (SDL_Init(SDL_INIT_VIDEO) < 0)
|
Uint32 SDL_Flags = SDL_INIT_TIMER | SDL_INIT_VIDEO | SDL_INIT_EVENTS;
|
||||||
|
if (SDL_Init(SDL_Flags) < 0)
|
||||||
{
|
{
|
||||||
printf("SDL could not initialize! SDL_Error: %s\n", SDL_GetError());
|
UE_LOG_CRITICAL("No se ha podido iniciar SDL, sufre mamón: {0}", SDL_GetError());
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
_window = SDL_CreateWindow("UberGame1", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, SCREEN_WIDTH, SCREEN_HEIGHT, SDL_WINDOW_SHOWN);
|
//Configuramos los parámetros de la ventana de SDL.
|
||||||
|
SDL_WindowFlags windowFlags = (SDL_WindowFlags)(SDL_WINDOW_SHOWN | SDL_WINDOW_OPENGL | SDL_WINDOW_ALLOW_HIGHDPI | SDL_WINDOW_RESIZABLE);
|
||||||
|
|
||||||
|
//Creamos la ventana de SDL.
|
||||||
|
_window = SDL_CreateWindow("UberGame1", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, SCREEN_WIDTH, SCREEN_HEIGHT, windowFlags);
|
||||||
if (_window == NULL)
|
if (_window == NULL)
|
||||||
{
|
{
|
||||||
printf("Window could not be created! SDL_Error: %s\n", SDL_GetError());
|
UE_LOG_CRITICAL("No se ha podido crear la ventana de SDL con OpenGL y esas mierdas: {0}", SDL_GetError());
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Creamos el Renderer de SDL.
|
||||||
main_Renderer = SDL_CreateRenderer(_window, -1, SDL_RENDERER_ACCELERATED);
|
main_Renderer = SDL_CreateRenderer(_window, -1, SDL_RENDERER_ACCELERATED);
|
||||||
if (main_Renderer == NULL)
|
if (main_Renderer == NULL)
|
||||||
{
|
{
|
||||||
printf("Unable to create renderer %s \n", SDL_GetError());
|
UE_LOG_CRITICAL("No se ha podido crear el Renderer de SDL: {0}", SDL_GetError());
|
||||||
}
|
}
|
||||||
|
|
||||||
//screenSurface = SDL_GetWindowSurface(window);
|
|
||||||
//SDL_FillRect(screenSurface, NULL, SDL_MapRGB(screenSurface->format, 78, 124, 232));
|
|
||||||
//SDL_UpdateWindowSurface(window);
|
|
||||||
SDL_SetRenderDrawColor(main_Renderer, 0xFF, 0xFF, 0xFF, 0xFF);
|
SDL_SetRenderDrawColor(main_Renderer, 0xFF, 0xFF, 0xFF, 0xFF);
|
||||||
|
|
||||||
|
|
||||||
|
#pragma region ImGui.
|
||||||
|
|
||||||
|
IMGUI_CHECKVERSION();
|
||||||
|
ImGui::CreateContext();
|
||||||
|
ImGuiIO& io = ImGui::GetIO();
|
||||||
|
(void)io; //Evita que de un Warning por variable no usada.
|
||||||
|
|
||||||
|
ImGui::StyleColorsDark();
|
||||||
|
|
||||||
|
ImGui_ImplSDL2_InitForSDLRenderer(_window);
|
||||||
|
ImGui_ImplSDLRenderer_Init(main_Renderer);
|
||||||
|
|
||||||
|
#pragma endregion
|
||||||
|
|
||||||
|
|
||||||
//Init layers.
|
//Init layers.
|
||||||
for (int i = 0; i < LAYER_AMOUNT; i++)
|
for (int i = 0; i < LAYER_AMOUNT; i++)
|
||||||
{
|
{
|
||||||
@@ -45,6 +73,10 @@ namespace UE
|
|||||||
{
|
{
|
||||||
renderQueue.empty();
|
renderQueue.empty();
|
||||||
|
|
||||||
|
ImGui_ImplSDLRenderer_Shutdown();
|
||||||
|
ImGui_ImplSDL2_Shutdown();
|
||||||
|
ImGui::DestroyContext();
|
||||||
|
|
||||||
SDL_DestroyRenderer(main_Renderer);
|
SDL_DestroyRenderer(main_Renderer);
|
||||||
SDL_DestroyWindow(_window);
|
SDL_DestroyWindow(_window);
|
||||||
}
|
}
|
||||||
@@ -55,6 +87,7 @@ namespace UE
|
|||||||
{
|
{
|
||||||
StartRender();
|
StartRender();
|
||||||
RenderQueue();
|
RenderQueue();
|
||||||
|
RenderIMGUI();
|
||||||
FinishRender();
|
FinishRender();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -63,6 +96,10 @@ namespace UE
|
|||||||
{
|
{
|
||||||
SDL_RenderClear(main_Renderer);
|
SDL_RenderClear(main_Renderer);
|
||||||
|
|
||||||
|
ImGui_ImplSDLRenderer_NewFrame();
|
||||||
|
ImGui_ImplSDL2_NewFrame();
|
||||||
|
ImGui::NewFrame();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Renderer::RenderQueue()
|
void Renderer::RenderQueue()
|
||||||
@@ -98,17 +135,40 @@ namespace UE
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Renderer::RenderIMGUI()
|
||||||
|
{
|
||||||
|
bool show = true;
|
||||||
|
ImGui::ShowDemoWindow(&show);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void Renderer::FinishRender()
|
void Renderer::FinishRender()
|
||||||
{
|
{
|
||||||
//SDL_UpdateWindowSurface(window);
|
//SDL_UpdateWindowSurface(window);
|
||||||
SDL_RenderPresent(main_Renderer);
|
//SDL_RenderPresent(main_Renderer);
|
||||||
//SDL_RenderClear(main_Renderer);
|
//SDL_RenderClear(main_Renderer);
|
||||||
|
ImGui::Render();
|
||||||
|
|
||||||
|
ImGui_ImplSDLRenderer_RenderDrawData(ImGui::GetDrawData());
|
||||||
|
|
||||||
|
SDL_RenderPresent(main_Renderer);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void Renderer::SetScreenSize(Sint32 newWidth, Sint32 newHeight)
|
||||||
|
{
|
||||||
|
SCREEN_WIDTH = newWidth;
|
||||||
|
SCREEN_HEIGHT = newHeight;
|
||||||
|
SDL_SetWindowSize(_window, newWidth, newHeight);
|
||||||
|
glViewport(0, 0, newWidth, newHeight);
|
||||||
|
}
|
||||||
|
|
||||||
void Renderer::DrawObject(SDL_Rect* position, SDL_Rect* texture_pos, SDL_Texture* texture)
|
void Renderer::DrawObject(SDL_Rect* position, SDL_Rect* texture_pos, SDL_Texture* texture)
|
||||||
{
|
{
|
||||||
SDL_RenderCopy(main_Renderer, texture, texture_pos, position);
|
SDL_RenderCopy(main_Renderer, texture, texture_pos, position);
|
||||||
|
|||||||
@@ -1,18 +1,18 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <SDL.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#include <SDL.h>
|
||||||
#include <glm\vec2.hpp>
|
#include <glm\vec2.hpp>
|
||||||
|
|
||||||
#include "Drawable.h"
|
#include "Drawable.h"
|
||||||
#include "Logging\Logger.h"
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// TODO:
|
// TODO:
|
||||||
// - Optimizar RenderDraw moviendo la ordenación por capas a Queue, quitando renderQueue.
|
// - Optimizar RenderDraw moviendo la ordenación por capas a Queue, quitando renderQueue.
|
||||||
//
|
// - Limpiar las funciones moviendo código a otras funciones.
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
|
|
||||||
@@ -33,7 +33,7 @@ namespace UE
|
|||||||
|
|
||||||
: SCREEN_WIDTH(windowWidth), SCREEN_HEIGHT(windowHeight), LAYER_AMOUNT(renderingLayers)
|
: SCREEN_WIDTH(windowWidth), SCREEN_HEIGHT(windowHeight), LAYER_AMOUNT(renderingLayers)
|
||||||
{
|
{
|
||||||
UE_LOG_INFO("Game Renderer Created.");
|
//UE_LOG_INFO("Game Renderer Created.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -67,6 +67,7 @@ namespace UE
|
|||||||
SDL_Renderer* GetSDLRenderer() { return main_Renderer; }
|
SDL_Renderer* GetSDLRenderer() { return main_Renderer; }
|
||||||
|
|
||||||
inline glm::ivec2 GetScreenSize() { return glm::ivec2(SCREEN_WIDTH, SCREEN_HEIGHT); }
|
inline glm::ivec2 GetScreenSize() { return glm::ivec2(SCREEN_WIDTH, SCREEN_HEIGHT); }
|
||||||
|
void SetScreenSize(Sint32 newWidth, Sint32 newHeight);
|
||||||
|
|
||||||
|
|
||||||
//DEBUG
|
//DEBUG
|
||||||
@@ -82,6 +83,8 @@ namespace UE
|
|||||||
//Se puede mover el proceso de ordenado a otra función, con el objeto de ir vaciando la Queue.
|
//Se puede mover el proceso de ordenado a otra función, con el objeto de ir vaciando la Queue.
|
||||||
void RenderQueue();
|
void RenderQueue();
|
||||||
|
|
||||||
|
void RenderIMGUI();
|
||||||
|
|
||||||
//Hace el swap del render buffer (tras dibujar todos los objetos). Termina el renderizado.
|
//Hace el swap del render buffer (tras dibujar todos los objetos). Termina el renderizado.
|
||||||
void FinishRender();
|
void FinishRender();
|
||||||
|
|
||||||
@@ -89,9 +92,11 @@ namespace UE
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
/* Objetos de SDL para el rendering. */
|
/* Objetos de SDL para el rendering. */
|
||||||
SDL_Window* _window = NULL;
|
SDL_Window* _window = nullptr;
|
||||||
SDL_Surface* screenSurface = NULL;
|
SDL_Surface* screenSurface = nullptr;
|
||||||
SDL_Renderer* main_Renderer = NULL;
|
SDL_Renderer* main_Renderer = nullptr;
|
||||||
|
|
||||||
|
//SDL_GLContext _glContext = nullptr;
|
||||||
|
|
||||||
//Almacena todas las "draw calls" para luego ordenar los objetos por layers y dibujarlos.
|
//Almacena todas las "draw calls" para luego ordenar los objetos por layers y dibujarlos.
|
||||||
//Se podría sustituir por un std::queue o std::deque si fuera necesario.
|
//Se podría sustituir por un std::queue o std::deque si fuera necesario.
|
||||||
@@ -103,8 +108,8 @@ namespace UE
|
|||||||
std::vector<std::vector<DrawCall>> renderLayers;
|
std::vector<std::vector<DrawCall>> renderLayers;
|
||||||
|
|
||||||
|
|
||||||
const int SCREEN_WIDTH = 640;
|
int SCREEN_WIDTH = 640;
|
||||||
const int SCREEN_HEIGHT = 480;
|
int SCREEN_HEIGHT = 480;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,18 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
namespace UE
|
||||||
|
{
|
||||||
|
class Scene;
|
||||||
|
|
||||||
|
/*
|
||||||
|
Será sobrecargado por el juego, de tal forma que cuando se le pida crear una escena, sepa qué objeto crear.
|
||||||
|
*/
|
||||||
|
class SceneBuilder
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual inline Scene* InstanciateScene(int sceneID) { return nullptr; }
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,5 +1,8 @@
|
|||||||
#include "SceneManager.h"
|
#include "SceneManager.h"
|
||||||
|
|
||||||
|
#include "Scene.h"
|
||||||
|
#include "SceneBuilder.h"
|
||||||
|
|
||||||
#include "Logging\Logger.h"
|
#include "Logging\Logger.h"
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
@@ -7,8 +10,10 @@
|
|||||||
namespace UE
|
namespace UE
|
||||||
{
|
{
|
||||||
|
|
||||||
void SceneManager::InitSceneManager()
|
void SceneManager::InitSceneManager(SceneBuilder* sceneBuilder)
|
||||||
{
|
{
|
||||||
|
_sceneBuilder = sceneBuilder;
|
||||||
|
|
||||||
UE_LOG_INFO("Se ha inicializado el SceneManager.");
|
UE_LOG_INFO("Se ha inicializado el SceneManager.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -17,50 +22,72 @@ namespace UE
|
|||||||
if (_currentScene != nullptr)
|
if (_currentScene != nullptr)
|
||||||
{
|
{
|
||||||
_currentScene->SceneUnload();
|
_currentScene->SceneUnload();
|
||||||
|
delete _currentScene;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto& it : _scenes)
|
//for (auto& it : _scenes)
|
||||||
|
//{
|
||||||
|
// Scene* sc = it.second;
|
||||||
|
// sc->SceneClean();
|
||||||
|
// delete sc;
|
||||||
|
//}
|
||||||
|
|
||||||
|
//_scenes.clear();
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//void SceneManager::AddScene(Scene* sceneToAdd)
|
||||||
|
//{
|
||||||
|
// _scenes.insert(std::make_pair(sceneToAdd->GetName(), sceneToAdd));
|
||||||
|
// sceneToAdd->SceneInit();
|
||||||
|
|
||||||
|
// UE_LOG_INFO("Se ha añadido la escena {0} al SceneManager.", sceneToAdd->GetName());
|
||||||
|
//}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//Scene* SceneManager::GetScenePtr(std::string sceneName)
|
||||||
|
//{
|
||||||
|
// if (_scenes.find(sceneName) == _scenes.end())
|
||||||
|
// {
|
||||||
|
// UE_LOG_ERROR("No se ha encontrado la escena indicada.");
|
||||||
|
// return nullptr;
|
||||||
|
// }
|
||||||
|
// return _scenes.at(sceneName);
|
||||||
|
//}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
std::string SceneManager::GetActiveSceneName()
|
||||||
{
|
{
|
||||||
Scene* sc = it.second;
|
return _currentScene->GetName();
|
||||||
sc->SceneClean();
|
|
||||||
delete sc;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_scenes.clear();
|
//void SceneManager::LoadScene(std::string sceneName)
|
||||||
}
|
//{
|
||||||
|
// if (_currentScene != nullptr)
|
||||||
|
// {
|
||||||
|
// _currentScene->SceneUnload();
|
||||||
|
// delete _currentScene;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// _currentScene = _scenes.at(sceneName);
|
||||||
|
|
||||||
|
// _currentScene->SceneLoad();
|
||||||
|
//}
|
||||||
|
|
||||||
void SceneManager::AddScene(Scene* sceneToAdd)
|
void SceneManager::NewLoadScene(int sceneID)
|
||||||
{
|
|
||||||
_scenes.insert(std::make_pair(sceneToAdd->GetName(), sceneToAdd));
|
|
||||||
sceneToAdd->SceneInit();
|
|
||||||
|
|
||||||
UE_LOG_INFO("Se ha añadido la escena {0} al SceneManager.", sceneToAdd->GetName());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Scene* SceneManager::GetScenePtr(std::string sceneName)
|
|
||||||
{
|
|
||||||
if (_scenes.find(sceneName) == _scenes.end())
|
|
||||||
{
|
|
||||||
UE_LOG_ERROR("No se ha encontrado la escena indicada.");
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
return _scenes.at(sceneName);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void SceneManager::LoadScene(std::string sceneName)
|
|
||||||
{
|
{
|
||||||
if (_currentScene != nullptr)
|
if (_currentScene != nullptr)
|
||||||
{
|
{
|
||||||
_currentScene->SceneUnload();
|
_currentScene->SceneUnload();
|
||||||
|
delete _currentScene;
|
||||||
}
|
}
|
||||||
_currentScene = _scenes.at(sceneName);
|
|
||||||
|
_currentScene = _sceneBuilder->InstanciateScene(sceneID);
|
||||||
|
|
||||||
_currentScene->SceneLoad();
|
_currentScene->SceneLoad();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
#include "Scene.h"
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Habría que implemetar un sistema para cambiar de escena.
|
// Habría que implemetar un sistema para cambiar de escena.
|
||||||
@@ -18,6 +17,9 @@
|
|||||||
|
|
||||||
namespace UE
|
namespace UE
|
||||||
{
|
{
|
||||||
|
class Scene;
|
||||||
|
class SceneBuilder;
|
||||||
|
|
||||||
/* Gestiona todas escenas. Las carga, descargar y ejecuta. */
|
/* Gestiona todas escenas. Las carga, descargar y ejecuta. */
|
||||||
class SceneManager
|
class SceneManager
|
||||||
{
|
{
|
||||||
@@ -26,21 +28,24 @@ namespace UE
|
|||||||
/* Constructor */
|
/* Constructor */
|
||||||
SceneManager() {}
|
SceneManager() {}
|
||||||
|
|
||||||
void InitSceneManager();
|
void InitSceneManager(SceneBuilder* sceneBuilder);
|
||||||
void CleanSceneManager();
|
void CleanSceneManager();
|
||||||
|
|
||||||
//Añade una escena a la lista y retorna su ID. Son Ptrs, por lo que poco importa donde los almacenamos.
|
//Añade una escena a la lista y retorna su ID. Son Ptrs, por lo que poco importa donde los almacenamos.
|
||||||
void AddScene(Scene* sceneToAdd);
|
//void AddScene(Scene* sceneToAdd);
|
||||||
|
|
||||||
//Devuelve un ptr a la escena del ID especificado.
|
//Devuelve un ptr a la escena del ID especificado.
|
||||||
Scene* GetScenePtr(std::string sceneName);
|
//Scene* GetScenePtr(std::string sceneName);
|
||||||
|
std::string GetActiveSceneName();
|
||||||
|
|
||||||
//Devuelve la escena activa.
|
//Devuelve la escena activa.
|
||||||
inline std::string GetActiveSceneName() { return _currentScene->GetName(); }
|
|
||||||
inline Scene* GetActiveScenePtr() { return _currentScene; }
|
inline Scene* GetActiveScenePtr() { return _currentScene; }
|
||||||
|
|
||||||
//Descarga la escena activa y carga la escena indicada.
|
//Descarga la escena activa y carga la escena indicada.
|
||||||
void LoadScene(std::string sceneName);
|
//void LoadScene(std::string sceneName);
|
||||||
|
|
||||||
|
//Descarga la escena activa y carga la escena indicada. Para ello llama al builder que tiene y este le devuelve un ptr a la nueva escena.
|
||||||
|
void NewLoadScene(int sceneID);
|
||||||
|
|
||||||
//Pasa el Update a la escena actual.
|
//Pasa el Update a la escena actual.
|
||||||
//¿Necesita hacer algo más?
|
//¿Necesita hacer algo más?
|
||||||
@@ -53,10 +58,12 @@ namespace UE
|
|||||||
private:
|
private:
|
||||||
Scene* _currentScene = nullptr;
|
Scene* _currentScene = nullptr;
|
||||||
|
|
||||||
|
SceneBuilder* _sceneBuilder = nullptr;
|
||||||
|
|
||||||
//Almacenamos un ptr a las diferentes escenas disponibles.
|
//Almacenamos un ptr a las diferentes escenas disponibles.
|
||||||
//Otra opción es trabajar con Templates para instanciar la clase pretinente sin necesidad de almacenar nada.
|
//Otra opción es trabajar con Templates para instanciar la clase pretinente sin necesidad de almacenar nada.
|
||||||
//De cualquier forma, son ptr en el Stack y deberían de eliminar todo al hacer scene.Unload().
|
//De cualquier forma, son ptr en el Stack y deberían de eliminar todo al hacer scene.Unload().
|
||||||
std::unordered_map<std::string, Scene*> _scenes;
|
//std::unordered_map<std::string, Scene*> _scenes;
|
||||||
//std::vector<Scene*> _scenes;
|
//std::vector<Scene*> _scenes;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Vendored
+1
-1
@@ -33,7 +33,7 @@
|
|||||||
// It is very strongly recommended to NOT disable the demo windows during development. Please read comments in imgui_demo.cpp.
|
// It is very strongly recommended to NOT disable the demo windows during development. Please read comments in imgui_demo.cpp.
|
||||||
//#define IMGUI_DISABLE // Disable everything: all headers and source files will be empty.
|
//#define IMGUI_DISABLE // Disable everything: all headers and source files will be empty.
|
||||||
//#define IMGUI_DISABLE_DEMO_WINDOWS // Disable demo windows: ShowDemoWindow()/ShowStyleEditor() will be empty. Not recommended.
|
//#define IMGUI_DISABLE_DEMO_WINDOWS // Disable demo windows: ShowDemoWindow()/ShowStyleEditor() will be empty. Not recommended.
|
||||||
//#define IMGUI_DISABLE_METRICS_WINDOW // Disable metrics/debugger window: ShowMetricsWindow() will be empty.
|
//#define IMGUI_DISABLE_METRICS_WINDOW // Disable metrics/debugger and other debug tools: ShowMetricsWindow() and ShowStackToolWindow() will be empty.
|
||||||
|
|
||||||
//---- Don't implement some functions to reduce linkage requirements.
|
//---- Don't implement some functions to reduce linkage requirements.
|
||||||
//#define IMGUI_DISABLE_WIN32_DEFAULT_CLIPBOARD_FUNCTIONS // [Win32] Don't implement default clipboard handler. Won't use and link with OpenClipboard/GetClipboardData/CloseClipboard etc. (user32.lib/.a, kernel32.lib/.a)
|
//#define IMGUI_DISABLE_WIN32_DEFAULT_CLIPBOARD_FUNCTIONS // [Win32] Don't implement default clipboard handler. Won't use and link with OpenClipboard/GetClipboardData/CloseClipboard etc. (user32.lib/.a, kernel32.lib/.a)
|
||||||
|
|||||||
Vendored
+1694
-878
File diff suppressed because it is too large
Load Diff
Vendored
+67
-48
@@ -1,4 +1,4 @@
|
|||||||
// dear imgui, v1.84
|
// dear imgui, v1.86
|
||||||
// (headers)
|
// (headers)
|
||||||
|
|
||||||
// Help:
|
// Help:
|
||||||
@@ -15,7 +15,10 @@
|
|||||||
// - Wiki https://github.com/ocornut/imgui/wiki (lots of good stuff there)
|
// - Wiki https://github.com/ocornut/imgui/wiki (lots of good stuff there)
|
||||||
// - Glossary https://github.com/ocornut/imgui/wiki/Glossary
|
// - Glossary https://github.com/ocornut/imgui/wiki/Glossary
|
||||||
// - Issues & support https://github.com/ocornut/imgui/issues
|
// - Issues & support https://github.com/ocornut/imgui/issues
|
||||||
// - Discussions https://github.com/ocornut/imgui/discussions
|
|
||||||
|
// Getting Started?
|
||||||
|
// - For first-time users having issues compiling/linking/running or issues loading fonts:
|
||||||
|
// please post in https://github.com/ocornut/imgui/discussions if you cannot find a solution in resources above.
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
||||||
@@ -60,8 +63,8 @@ Index of this file:
|
|||||||
|
|
||||||
// Version
|
// Version
|
||||||
// (Integer encoded as XYYZZ for use in #if preprocessor conditionals. Work in progress versions typically starts at XYY99 then bounce up to XYY00, XYY01 etc. when release tagging happens)
|
// (Integer encoded as XYYZZ for use in #if preprocessor conditionals. Work in progress versions typically starts at XYY99 then bounce up to XYY00, XYY01 etc. when release tagging happens)
|
||||||
#define IMGUI_VERSION "1.84.2"
|
#define IMGUI_VERSION "1.86"
|
||||||
#define IMGUI_VERSION_NUM 18405
|
#define IMGUI_VERSION_NUM 18600
|
||||||
#define IMGUI_CHECKVERSION() ImGui::DebugCheckVersionAndDataLayout(IMGUI_VERSION, sizeof(ImGuiIO), sizeof(ImGuiStyle), sizeof(ImVec2), sizeof(ImVec4), sizeof(ImDrawVert), sizeof(ImDrawIdx))
|
#define IMGUI_CHECKVERSION() ImGui::DebugCheckVersionAndDataLayout(IMGUI_VERSION, sizeof(ImGuiIO), sizeof(ImGuiStyle), sizeof(ImVec2), sizeof(ImVec4), sizeof(ImDrawVert), sizeof(ImDrawIdx))
|
||||||
#define IMGUI_HAS_TABLE
|
#define IMGUI_HAS_TABLE
|
||||||
|
|
||||||
@@ -89,7 +92,7 @@ Index of this file:
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Helper Macros - IM_FMTARGS, IM_FMTLIST: Apply printf-style warnings to our formatting functions.
|
// Helper Macros - IM_FMTARGS, IM_FMTLIST: Apply printf-style warnings to our formatting functions.
|
||||||
#if !defined(IMGUI_USE_STB_SPRINTF) && defined(__MINGW32__)
|
#if !defined(IMGUI_USE_STB_SPRINTF) && defined(__MINGW32__) && !defined(__clang__)
|
||||||
#define IM_FMTARGS(FMT) __attribute__((format(gnu_printf, FMT, FMT+1)))
|
#define IM_FMTARGS(FMT) __attribute__((format(gnu_printf, FMT, FMT+1)))
|
||||||
#define IM_FMTLIST(FMT) __attribute__((format(gnu_printf, FMT, 0)))
|
#define IM_FMTLIST(FMT) __attribute__((format(gnu_printf, FMT, 0)))
|
||||||
#elif !defined(IMGUI_USE_STB_SPRINTF) && (defined(__clang__) || defined(__GNUC__))
|
#elif !defined(IMGUI_USE_STB_SPRINTF) && (defined(__clang__) || defined(__GNUC__))
|
||||||
@@ -149,7 +152,7 @@ struct ImGuiContext; // Dear ImGui context (opaque structure, unl
|
|||||||
struct ImGuiIO; // Main configuration and I/O between your application and ImGui
|
struct ImGuiIO; // Main configuration and I/O between your application and ImGui
|
||||||
struct ImGuiInputTextCallbackData; // Shared state of InputText() when using custom ImGuiInputTextCallback (rare/advanced use)
|
struct ImGuiInputTextCallbackData; // Shared state of InputText() when using custom ImGuiInputTextCallback (rare/advanced use)
|
||||||
struct ImGuiListClipper; // Helper to manually clip large list of items
|
struct ImGuiListClipper; // Helper to manually clip large list of items
|
||||||
struct ImGuiOnceUponAFrame; // Helper for running a block of code not more than once a frame, used by IMGUI_ONCE_UPON_A_FRAME macro
|
struct ImGuiOnceUponAFrame; // Helper for running a block of code not more than once a frame
|
||||||
struct ImGuiPayload; // User data payload for drag and drop operations
|
struct ImGuiPayload; // User data payload for drag and drop operations
|
||||||
struct ImGuiSizeCallbackData; // Callback data when using SetNextWindowSizeConstraints() (rare/advanced use)
|
struct ImGuiSizeCallbackData; // Callback data when using SetNextWindowSizeConstraints() (rare/advanced use)
|
||||||
struct ImGuiStorage; // Helper for key->value storage
|
struct ImGuiStorage; // Helper for key->value storage
|
||||||
@@ -304,6 +307,7 @@ namespace ImGui
|
|||||||
// Demo, Debug, Information
|
// Demo, Debug, Information
|
||||||
IMGUI_API void ShowDemoWindow(bool* p_open = NULL); // create Demo window. demonstrate most ImGui features. call this to learn about the library! try to make it always available in your application!
|
IMGUI_API void ShowDemoWindow(bool* p_open = NULL); // create Demo window. demonstrate most ImGui features. call this to learn about the library! try to make it always available in your application!
|
||||||
IMGUI_API void ShowMetricsWindow(bool* p_open = NULL); // create Metrics/Debugger window. display Dear ImGui internals: windows, draw commands, various internal state, etc.
|
IMGUI_API void ShowMetricsWindow(bool* p_open = NULL); // create Metrics/Debugger window. display Dear ImGui internals: windows, draw commands, various internal state, etc.
|
||||||
|
IMGUI_API void ShowStackToolWindow(bool* p_open = NULL); // create Stack Tool window. hover items with mouse to query information about the source of their unique ID.
|
||||||
IMGUI_API void ShowAboutWindow(bool* p_open = NULL); // create About window. display Dear ImGui version, credits and build/system information.
|
IMGUI_API void ShowAboutWindow(bool* p_open = NULL); // create About window. display Dear ImGui version, credits and build/system information.
|
||||||
IMGUI_API void ShowStyleEditor(ImGuiStyle* ref = NULL); // add style editor block (not a window). you can pass in a reference ImGuiStyle structure to compare to, revert to and save to (else it uses the default style)
|
IMGUI_API void ShowStyleEditor(ImGuiStyle* ref = NULL); // add style editor block (not a window). you can pass in a reference ImGuiStyle structure to compare to, revert to and save to (else it uses the default style)
|
||||||
IMGUI_API bool ShowStyleSelector(const char* label); // add style selector block (not a window), essentially a combo listing the default styles.
|
IMGUI_API bool ShowStyleSelector(const char* label); // add style selector block (not a window), essentially a combo listing the default styles.
|
||||||
@@ -379,9 +383,8 @@ namespace ImGui
|
|||||||
// - Those functions are bound to be redesigned (they are confusing, incomplete and the Min/Max return values are in local window coordinates which increases confusion)
|
// - Those functions are bound to be redesigned (they are confusing, incomplete and the Min/Max return values are in local window coordinates which increases confusion)
|
||||||
IMGUI_API ImVec2 GetContentRegionAvail(); // == GetContentRegionMax() - GetCursorPos()
|
IMGUI_API ImVec2 GetContentRegionAvail(); // == GetContentRegionMax() - GetCursorPos()
|
||||||
IMGUI_API ImVec2 GetContentRegionMax(); // current content boundaries (typically window boundaries including scrolling, or current column boundaries), in windows coordinates
|
IMGUI_API ImVec2 GetContentRegionMax(); // current content boundaries (typically window boundaries including scrolling, or current column boundaries), in windows coordinates
|
||||||
IMGUI_API ImVec2 GetWindowContentRegionMin(); // content boundaries min (roughly (0,0)-Scroll), in window coordinates
|
IMGUI_API ImVec2 GetWindowContentRegionMin(); // content boundaries min for the full window (roughly (0,0)-Scroll), in window coordinates
|
||||||
IMGUI_API ImVec2 GetWindowContentRegionMax(); // content boundaries max (roughly (0,0)+Size-Scroll) where Size can be override with SetNextWindowContentSize(), in window coordinates
|
IMGUI_API ImVec2 GetWindowContentRegionMax(); // content boundaries max for the full window (roughly (0,0)+Size-Scroll) where Size can be override with SetNextWindowContentSize(), in window coordinates
|
||||||
IMGUI_API float GetWindowContentRegionWidth(); //
|
|
||||||
|
|
||||||
// Windows Scrolling
|
// Windows Scrolling
|
||||||
IMGUI_API float GetScrollX(); // get scrolling amount [0 .. GetScrollMaxX()]
|
IMGUI_API float GetScrollX(); // get scrolling amount [0 .. GetScrollMaxX()]
|
||||||
@@ -520,12 +523,12 @@ namespace ImGui
|
|||||||
IMGUI_API bool Combo(const char* label, int* current_item, bool(*items_getter)(void* data, int idx, const char** out_text), void* data, int items_count, int popup_max_height_in_items = -1);
|
IMGUI_API bool Combo(const char* label, int* current_item, bool(*items_getter)(void* data, int idx, const char** out_text), void* data, int items_count, int popup_max_height_in_items = -1);
|
||||||
|
|
||||||
// Widgets: Drag Sliders
|
// Widgets: Drag Sliders
|
||||||
// - CTRL+Click on any drag box to turn them into an input box. Manually input values aren't clamped and can go off-bounds.
|
// - CTRL+Click on any drag box to turn them into an input box. Manually input values aren't clamped by default and can go off-bounds. Use ImGuiSliderFlags_AlwaysClamp to always clamp.
|
||||||
// - For all the Float2/Float3/Float4/Int2/Int3/Int4 versions of every functions, note that a 'float v[X]' function argument is the same as 'float* v', the array syntax is just a way to document the number of elements that are expected to be accessible. You can pass address of your first element out of a contiguous set, e.g. &myvector.x
|
// - For all the Float2/Float3/Float4/Int2/Int3/Int4 versions of every functions, note that a 'float v[X]' function argument is the same as 'float* v', the array syntax is just a way to document the number of elements that are expected to be accessible. You can pass address of your first element out of a contiguous set, e.g. &myvector.x
|
||||||
// - Adjust format string to decorate the value with a prefix, a suffix, or adapt the editing and display precision e.g. "%.3f" -> 1.234; "%5.2f secs" -> 01.23 secs; "Biscuit: %.0f" -> Biscuit: 1; etc.
|
// - Adjust format string to decorate the value with a prefix, a suffix, or adapt the editing and display precision e.g. "%.3f" -> 1.234; "%5.2f secs" -> 01.23 secs; "Biscuit: %.0f" -> Biscuit: 1; etc.
|
||||||
// - Format string may also be set to NULL or use the default format ("%f" or "%d").
|
// - Format string may also be set to NULL or use the default format ("%f" or "%d").
|
||||||
// - Speed are per-pixel of mouse movement (v_speed=0.2f: mouse needs to move by 5 pixels to increase value by 1). For gamepad/keyboard navigation, minimum speed is Max(v_speed, minimum_step_at_given_precision).
|
// - Speed are per-pixel of mouse movement (v_speed=0.2f: mouse needs to move by 5 pixels to increase value by 1). For gamepad/keyboard navigation, minimum speed is Max(v_speed, minimum_step_at_given_precision).
|
||||||
// - Use v_min < v_max to clamp edits to given limits. Note that CTRL+Click manual input can override those limits.
|
// - Use v_min < v_max to clamp edits to given limits. Note that CTRL+Click manual input can override those limits if ImGuiSliderFlags_AlwaysClamp is not used.
|
||||||
// - Use v_max = FLT_MAX / INT_MAX etc to avoid clamping to a maximum, same with v_min = -FLT_MAX / INT_MIN to avoid clamping to a minimum.
|
// - Use v_max = FLT_MAX / INT_MAX etc to avoid clamping to a maximum, same with v_min = -FLT_MAX / INT_MIN to avoid clamping to a minimum.
|
||||||
// - We use the same sets of flags for DragXXX() and SliderXXX() functions as the features are the same and it makes it easier to swap them.
|
// - We use the same sets of flags for DragXXX() and SliderXXX() functions as the features are the same and it makes it easier to swap them.
|
||||||
// - Legacy: Pre-1.78 there are DragXXX() function signatures that takes a final `float power=1.0f' argument instead of the `ImGuiSliderFlags flags=0' argument.
|
// - Legacy: Pre-1.78 there are DragXXX() function signatures that takes a final `float power=1.0f' argument instead of the `ImGuiSliderFlags flags=0' argument.
|
||||||
@@ -544,7 +547,7 @@ namespace ImGui
|
|||||||
IMGUI_API bool DragScalarN(const char* label, ImGuiDataType data_type, void* p_data, int components, float v_speed = 1.0f, const void* p_min = NULL, const void* p_max = NULL, const char* format = NULL, ImGuiSliderFlags flags = 0);
|
IMGUI_API bool DragScalarN(const char* label, ImGuiDataType data_type, void* p_data, int components, float v_speed = 1.0f, const void* p_min = NULL, const void* p_max = NULL, const char* format = NULL, ImGuiSliderFlags flags = 0);
|
||||||
|
|
||||||
// Widgets: Regular Sliders
|
// Widgets: Regular Sliders
|
||||||
// - CTRL+Click on any slider to turn them into an input box. Manually input values aren't clamped and can go off-bounds.
|
// - CTRL+Click on any slider to turn them into an input box. Manually input values aren't clamped by default and can go off-bounds. Use ImGuiSliderFlags_AlwaysClamp to always clamp.
|
||||||
// - Adjust format string to decorate the value with a prefix, a suffix, or adapt the editing and display precision e.g. "%.3f" -> 1.234; "%5.2f secs" -> 01.23 secs; "Biscuit: %.0f" -> Biscuit: 1; etc.
|
// - Adjust format string to decorate the value with a prefix, a suffix, or adapt the editing and display precision e.g. "%.3f" -> 1.234; "%5.2f secs" -> 01.23 secs; "Biscuit: %.0f" -> Biscuit: 1; etc.
|
||||||
// - Format string may also be set to NULL or use the default format ("%f" or "%d").
|
// - Format string may also be set to NULL or use the default format ("%f" or "%d").
|
||||||
// - Legacy: Pre-1.78 there are SliderXXX() function signatures that takes a final `float power=1.0f' argument instead of the `ImGuiSliderFlags flags=0' argument.
|
// - Legacy: Pre-1.78 there are SliderXXX() function signatures that takes a final `float power=1.0f' argument instead of the `ImGuiSliderFlags flags=0' argument.
|
||||||
@@ -813,6 +816,7 @@ namespace ImGui
|
|||||||
|
|
||||||
// Disabling [BETA API]
|
// Disabling [BETA API]
|
||||||
// - Disable all user interactions and dim items visuals (applying style.DisabledAlpha over current colors)
|
// - Disable all user interactions and dim items visuals (applying style.DisabledAlpha over current colors)
|
||||||
|
// - Those can be nested but it cannot be used to enable an already disabled section (a single BeginDisabled(true) in the stack is enough to keep everything disabled)
|
||||||
// - BeginDisabled(false) essentially does nothing useful but is provided to facilitate use of boolean expressions. If you can avoid calling BeginDisabled(False)/EndDisabled() best to avoid it.
|
// - BeginDisabled(false) essentially does nothing useful but is provided to facilitate use of boolean expressions. If you can avoid calling BeginDisabled(False)/EndDisabled() best to avoid it.
|
||||||
IMGUI_API void BeginDisabled(bool disabled = true);
|
IMGUI_API void BeginDisabled(bool disabled = true);
|
||||||
IMGUI_API void EndDisabled();
|
IMGUI_API void EndDisabled();
|
||||||
@@ -865,7 +869,6 @@ namespace ImGui
|
|||||||
IMGUI_API const char* GetStyleColorName(ImGuiCol idx); // get a string corresponding to the enum value (for display, saving, etc.).
|
IMGUI_API const char* GetStyleColorName(ImGuiCol idx); // get a string corresponding to the enum value (for display, saving, etc.).
|
||||||
IMGUI_API void SetStateStorage(ImGuiStorage* storage); // replace current window storage with our own (if you want to manipulate it yourself, typically clear subsection of it)
|
IMGUI_API void SetStateStorage(ImGuiStorage* storage); // replace current window storage with our own (if you want to manipulate it yourself, typically clear subsection of it)
|
||||||
IMGUI_API ImGuiStorage* GetStateStorage();
|
IMGUI_API ImGuiStorage* GetStateStorage();
|
||||||
IMGUI_API void CalcListClipping(int items_count, float items_height, int* out_items_display_start, int* out_items_display_end); // calculate coarse clipping for large list of evenly sized items. Prefer using the ImGuiListClipper higher-level helper if you can.
|
|
||||||
IMGUI_API bool BeginChildFrame(ImGuiID id, const ImVec2& size, ImGuiWindowFlags flags = 0); // helper to create a child window / scrolling region that looks like a normal widget frame
|
IMGUI_API bool BeginChildFrame(ImGuiID id, const ImVec2& size, ImGuiWindowFlags flags = 0); // helper to create a child window / scrolling region that looks like a normal widget frame
|
||||||
IMGUI_API void EndChildFrame(); // always call EndChildFrame() regardless of BeginChildFrame() return values (which indicates a collapsed/clipped window)
|
IMGUI_API void EndChildFrame(); // always call EndChildFrame() regardless of BeginChildFrame() return values (which indicates a collapsed/clipped window)
|
||||||
|
|
||||||
@@ -893,9 +896,10 @@ namespace ImGui
|
|||||||
// - You can also use regular integer: it is forever guaranteed that 0=Left, 1=Right, 2=Middle.
|
// - You can also use regular integer: it is forever guaranteed that 0=Left, 1=Right, 2=Middle.
|
||||||
// - Dragging operations are only reported after mouse has moved a certain distance away from the initial clicking position (see 'lock_threshold' and 'io.MouseDraggingThreshold')
|
// - Dragging operations are only reported after mouse has moved a certain distance away from the initial clicking position (see 'lock_threshold' and 'io.MouseDraggingThreshold')
|
||||||
IMGUI_API bool IsMouseDown(ImGuiMouseButton button); // is mouse button held?
|
IMGUI_API bool IsMouseDown(ImGuiMouseButton button); // is mouse button held?
|
||||||
IMGUI_API bool IsMouseClicked(ImGuiMouseButton button, bool repeat = false); // did mouse button clicked? (went from !Down to Down)
|
IMGUI_API bool IsMouseClicked(ImGuiMouseButton button, bool repeat = false); // did mouse button clicked? (went from !Down to Down). Same as GetMouseClickedCount() == 1.
|
||||||
IMGUI_API bool IsMouseReleased(ImGuiMouseButton button); // did mouse button released? (went from Down to !Down)
|
IMGUI_API bool IsMouseReleased(ImGuiMouseButton button); // did mouse button released? (went from Down to !Down)
|
||||||
IMGUI_API bool IsMouseDoubleClicked(ImGuiMouseButton button); // did mouse button double-clicked? (note that a double-click will also report IsMouseClicked() == true)
|
IMGUI_API bool IsMouseDoubleClicked(ImGuiMouseButton button); // did mouse button double-clicked? Same as GetMouseClickedCount() == 2. (note that a double-click will also report IsMouseClicked() == true)
|
||||||
|
IMGUI_API int GetMouseClickedCount(ImGuiMouseButton button); // return the number of successive mouse-clicks at the time where a click happen (otherwise 0).
|
||||||
IMGUI_API bool IsMouseHoveringRect(const ImVec2& r_min, const ImVec2& r_max, bool clip = true);// is mouse hovering given bounding rect (in screen space). clipped by current clipping settings, but disregarding of other consideration of focus/window ordering/popup-block.
|
IMGUI_API bool IsMouseHoveringRect(const ImVec2& r_min, const ImVec2& r_max, bool clip = true);// is mouse hovering given bounding rect (in screen space). clipped by current clipping settings, but disregarding of other consideration of focus/window ordering/popup-block.
|
||||||
IMGUI_API bool IsMousePosValid(const ImVec2* mouse_pos = NULL); // by convention we use (-FLT_MAX,-FLT_MAX) to denote that there is no mouse available
|
IMGUI_API bool IsMousePosValid(const ImVec2* mouse_pos = NULL); // by convention we use (-FLT_MAX,-FLT_MAX) to denote that there is no mouse available
|
||||||
IMGUI_API bool IsAnyMouseDown(); // is any mouse button held?
|
IMGUI_API bool IsAnyMouseDown(); // is any mouse button held?
|
||||||
@@ -950,7 +954,7 @@ enum ImGuiWindowFlags_
|
|||||||
ImGuiWindowFlags_NoMove = 1 << 2, // Disable user moving the window
|
ImGuiWindowFlags_NoMove = 1 << 2, // Disable user moving the window
|
||||||
ImGuiWindowFlags_NoScrollbar = 1 << 3, // Disable scrollbars (window can still scroll with mouse or programmatically)
|
ImGuiWindowFlags_NoScrollbar = 1 << 3, // Disable scrollbars (window can still scroll with mouse or programmatically)
|
||||||
ImGuiWindowFlags_NoScrollWithMouse = 1 << 4, // Disable user vertically scrolling with mouse wheel. On child window, mouse wheel will be forwarded to the parent unless NoScrollbar is also set.
|
ImGuiWindowFlags_NoScrollWithMouse = 1 << 4, // Disable user vertically scrolling with mouse wheel. On child window, mouse wheel will be forwarded to the parent unless NoScrollbar is also set.
|
||||||
ImGuiWindowFlags_NoCollapse = 1 << 5, // Disable user collapsing window by double-clicking on it
|
ImGuiWindowFlags_NoCollapse = 1 << 5, // Disable user collapsing window by double-clicking on it. Also referred to as Window Menu Button (e.g. within a docking node).
|
||||||
ImGuiWindowFlags_AlwaysAutoResize = 1 << 6, // Resize every window to its content every frame
|
ImGuiWindowFlags_AlwaysAutoResize = 1 << 6, // Resize every window to its content every frame
|
||||||
ImGuiWindowFlags_NoBackground = 1 << 7, // Disable drawing background color (WindowBg, etc.) and outside border. Similar as using SetNextWindowBgAlpha(0.0f).
|
ImGuiWindowFlags_NoBackground = 1 << 7, // Disable drawing background color (WindowBg, etc.) and outside border. Similar as using SetNextWindowBgAlpha(0.0f).
|
||||||
ImGuiWindowFlags_NoSavedSettings = 1 << 8, // Never load/save settings in .ini file
|
ImGuiWindowFlags_NoSavedSettings = 1 << 8, // Never load/save settings in .ini file
|
||||||
@@ -970,7 +974,7 @@ enum ImGuiWindowFlags_
|
|||||||
ImGuiWindowFlags_NoInputs = ImGuiWindowFlags_NoMouseInputs | ImGuiWindowFlags_NoNavInputs | ImGuiWindowFlags_NoNavFocus,
|
ImGuiWindowFlags_NoInputs = ImGuiWindowFlags_NoMouseInputs | ImGuiWindowFlags_NoNavInputs | ImGuiWindowFlags_NoNavFocus,
|
||||||
|
|
||||||
// [Internal]
|
// [Internal]
|
||||||
ImGuiWindowFlags_NavFlattened = 1 << 23, // [BETA] Allow gamepad/keyboard navigation to cross over parent border to this child (only use on child that have no scrolling!)
|
ImGuiWindowFlags_NavFlattened = 1 << 23, // [BETA] On child window: allow gamepad/keyboard navigation to cross over parent border to this child or between sibling child windows.
|
||||||
ImGuiWindowFlags_ChildWindow = 1 << 24, // Don't use! For internal use by BeginChild()
|
ImGuiWindowFlags_ChildWindow = 1 << 24, // Don't use! For internal use by BeginChild()
|
||||||
ImGuiWindowFlags_Tooltip = 1 << 25, // Don't use! For internal use by BeginTooltip()
|
ImGuiWindowFlags_Tooltip = 1 << 25, // Don't use! For internal use by BeginTooltip()
|
||||||
ImGuiWindowFlags_Popup = 1 << 26, // Don't use! For internal use by BeginPopup()
|
ImGuiWindowFlags_Popup = 1 << 26, // Don't use! For internal use by BeginPopup()
|
||||||
@@ -1261,9 +1265,11 @@ enum ImGuiTableBgTarget_
|
|||||||
enum ImGuiFocusedFlags_
|
enum ImGuiFocusedFlags_
|
||||||
{
|
{
|
||||||
ImGuiFocusedFlags_None = 0,
|
ImGuiFocusedFlags_None = 0,
|
||||||
ImGuiFocusedFlags_ChildWindows = 1 << 0, // IsWindowFocused(): Return true if any children of the window is focused
|
ImGuiFocusedFlags_ChildWindows = 1 << 0, // Return true if any children of the window is focused
|
||||||
ImGuiFocusedFlags_RootWindow = 1 << 1, // IsWindowFocused(): Test from root window (top most parent of the current hierarchy)
|
ImGuiFocusedFlags_RootWindow = 1 << 1, // Test from root window (top most parent of the current hierarchy)
|
||||||
ImGuiFocusedFlags_AnyWindow = 1 << 2, // IsWindowFocused(): Return true if any window is focused. Important: If you are trying to tell how to dispatch your low-level inputs, do NOT use this. Use 'io.WantCaptureMouse' instead! Please read the FAQ!
|
ImGuiFocusedFlags_AnyWindow = 1 << 2, // Return true if any window is focused. Important: If you are trying to tell how to dispatch your low-level inputs, do NOT use this. Use 'io.WantCaptureMouse' instead! Please read the FAQ!
|
||||||
|
ImGuiFocusedFlags_NoPopupHierarchy = 1 << 3, // Do not consider popup hierarchy (do not treat popup emitter as parent of popup) (when used with _ChildWindows or _RootWindow)
|
||||||
|
//ImGuiFocusedFlags_DockHierarchy = 1 << 4, // Consider docking hierarchy (treat dockspace host as parent of docked window) (when used with _ChildWindows or _RootWindow)
|
||||||
ImGuiFocusedFlags_RootAndChildWindows = ImGuiFocusedFlags_RootWindow | ImGuiFocusedFlags_ChildWindows
|
ImGuiFocusedFlags_RootAndChildWindows = ImGuiFocusedFlags_RootWindow | ImGuiFocusedFlags_ChildWindows
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -1276,11 +1282,13 @@ enum ImGuiHoveredFlags_
|
|||||||
ImGuiHoveredFlags_ChildWindows = 1 << 0, // IsWindowHovered() only: Return true if any children of the window is hovered
|
ImGuiHoveredFlags_ChildWindows = 1 << 0, // IsWindowHovered() only: Return true if any children of the window is hovered
|
||||||
ImGuiHoveredFlags_RootWindow = 1 << 1, // IsWindowHovered() only: Test from root window (top most parent of the current hierarchy)
|
ImGuiHoveredFlags_RootWindow = 1 << 1, // IsWindowHovered() only: Test from root window (top most parent of the current hierarchy)
|
||||||
ImGuiHoveredFlags_AnyWindow = 1 << 2, // IsWindowHovered() only: Return true if any window is hovered
|
ImGuiHoveredFlags_AnyWindow = 1 << 2, // IsWindowHovered() only: Return true if any window is hovered
|
||||||
ImGuiHoveredFlags_AllowWhenBlockedByPopup = 1 << 3, // Return true even if a popup window is normally blocking access to this item/window
|
ImGuiHoveredFlags_NoPopupHierarchy = 1 << 3, // IsWindowHovered() only: Do not consider popup hierarchy (do not treat popup emitter as parent of popup) (when used with _ChildWindows or _RootWindow)
|
||||||
//ImGuiHoveredFlags_AllowWhenBlockedByModal = 1 << 4, // Return true even if a modal popup window is normally blocking access to this item/window. FIXME-TODO: Unavailable yet.
|
//ImGuiHoveredFlags_DockHierarchy = 1 << 4, // IsWindowHovered() only: Consider docking hierarchy (treat dockspace host as parent of docked window) (when used with _ChildWindows or _RootWindow)
|
||||||
ImGuiHoveredFlags_AllowWhenBlockedByActiveItem = 1 << 5, // Return true even if an active item is blocking access to this item/window. Useful for Drag and Drop patterns.
|
ImGuiHoveredFlags_AllowWhenBlockedByPopup = 1 << 5, // Return true even if a popup window is normally blocking access to this item/window
|
||||||
ImGuiHoveredFlags_AllowWhenOverlapped = 1 << 6, // Return true even if the position is obstructed or overlapped by another window
|
//ImGuiHoveredFlags_AllowWhenBlockedByModal = 1 << 6, // Return true even if a modal popup window is normally blocking access to this item/window. FIXME-TODO: Unavailable yet.
|
||||||
ImGuiHoveredFlags_AllowWhenDisabled = 1 << 7, // Return true even if the item is disabled
|
ImGuiHoveredFlags_AllowWhenBlockedByActiveItem = 1 << 7, // Return true even if an active item is blocking access to this item/window. Useful for Drag and Drop patterns.
|
||||||
|
ImGuiHoveredFlags_AllowWhenOverlapped = 1 << 8, // IsItemHovered() only: Return true even if the position is obstructed or overlapped by another window
|
||||||
|
ImGuiHoveredFlags_AllowWhenDisabled = 1 << 9, // IsItemHovered() only: Return true even if the item is disabled
|
||||||
ImGuiHoveredFlags_RectOnly = ImGuiHoveredFlags_AllowWhenBlockedByPopup | ImGuiHoveredFlags_AllowWhenBlockedByActiveItem | ImGuiHoveredFlags_AllowWhenOverlapped,
|
ImGuiHoveredFlags_RectOnly = ImGuiHoveredFlags_AllowWhenBlockedByPopup | ImGuiHoveredFlags_AllowWhenBlockedByActiveItem | ImGuiHoveredFlags_AllowWhenOverlapped,
|
||||||
ImGuiHoveredFlags_RootAndChildWindows = ImGuiHoveredFlags_RootWindow | ImGuiHoveredFlags_ChildWindows
|
ImGuiHoveredFlags_RootAndChildWindows = ImGuiHoveredFlags_RootWindow | ImGuiHoveredFlags_ChildWindows
|
||||||
};
|
};
|
||||||
@@ -1734,7 +1742,7 @@ struct ImVector
|
|||||||
inline void pop_back() { IM_ASSERT(Size > 0); Size--; }
|
inline void pop_back() { IM_ASSERT(Size > 0); Size--; }
|
||||||
inline void push_front(const T& v) { if (Size == 0) push_back(v); else insert(Data, v); }
|
inline void push_front(const T& v) { if (Size == 0) push_back(v); else insert(Data, v); }
|
||||||
inline T* erase(const T* it) { IM_ASSERT(it >= Data && it < Data + Size); const ptrdiff_t off = it - Data; memmove(Data + off, Data + off + 1, ((size_t)Size - (size_t)off - 1) * sizeof(T)); Size--; return Data + off; }
|
inline T* erase(const T* it) { IM_ASSERT(it >= Data && it < Data + Size); const ptrdiff_t off = it - Data; memmove(Data + off, Data + off + 1, ((size_t)Size - (size_t)off - 1) * sizeof(T)); Size--; return Data + off; }
|
||||||
inline T* erase(const T* it, const T* it_last){ IM_ASSERT(it >= Data && it < Data + Size && it_last > it && it_last <= Data + Size); const ptrdiff_t count = it_last - it; const ptrdiff_t off = it - Data; memmove(Data + off, Data + off + count, ((size_t)Size - (size_t)off - count) * sizeof(T)); Size -= (int)count; return Data + off; }
|
inline T* erase(const T* it, const T* it_last){ IM_ASSERT(it >= Data && it < Data + Size && it_last > it && it_last <= Data + Size); const ptrdiff_t count = it_last - it; const ptrdiff_t off = it - Data; memmove(Data + off, Data + off + count, ((size_t)Size - (size_t)off - (size_t)count) * sizeof(T)); Size -= (int)count; return Data + off; }
|
||||||
inline T* erase_unsorted(const T* it) { IM_ASSERT(it >= Data && it < Data + Size); const ptrdiff_t off = it - Data; if (it < Data + Size - 1) memcpy(Data + off, Data + Size - 1, sizeof(T)); Size--; return Data + off; }
|
inline T* erase_unsorted(const T* it) { IM_ASSERT(it >= Data && it < Data + Size); const ptrdiff_t off = it - Data; if (it < Data + Size - 1) memcpy(Data + off, Data + Size - 1, sizeof(T)); Size--; return Data + off; }
|
||||||
inline T* insert(const T* it, const T& v) { IM_ASSERT(it >= Data && it <= Data + Size); const ptrdiff_t off = it - Data; if (Size == Capacity) reserve(_grow_capacity(Size + 1)); if (off < (int)Size) memmove(Data + off + 1, Data + off, ((size_t)Size - (size_t)off) * sizeof(T)); memcpy(&Data[off], &v, sizeof(v)); Size++; return Data + off; }
|
inline T* insert(const T* it, const T& v) { IM_ASSERT(it >= Data && it <= Data + Size); const ptrdiff_t off = it - Data; if (Size == Capacity) reserve(_grow_capacity(Size + 1)); if (off < (int)Size) memmove(Data + off + 1, Data + off, ((size_t)Size - (size_t)off) * sizeof(T)); memcpy(&Data[off], &v, sizeof(v)); Size++; return Data + off; }
|
||||||
inline bool contains(const T& v) const { const T* data = Data; const T* data_end = Data + Size; while (data < data_end) if (*data++ == v) return true; return false; }
|
inline bool contains(const T& v) const { const T* data = Data; const T* data_end = Data + Size; while (data < data_end) if (*data++ == v) return true; return false; }
|
||||||
@@ -1887,8 +1895,9 @@ struct ImGuiIO
|
|||||||
IMGUI_API void AddInputCharacter(unsigned int c); // Queue new character input
|
IMGUI_API void AddInputCharacter(unsigned int c); // Queue new character input
|
||||||
IMGUI_API void AddInputCharacterUTF16(ImWchar16 c); // Queue new character input from an UTF-16 character, it can be a surrogate
|
IMGUI_API void AddInputCharacterUTF16(ImWchar16 c); // Queue new character input from an UTF-16 character, it can be a surrogate
|
||||||
IMGUI_API void AddInputCharactersUTF8(const char* str); // Queue new characters input from an UTF-8 string
|
IMGUI_API void AddInputCharactersUTF8(const char* str); // Queue new characters input from an UTF-8 string
|
||||||
IMGUI_API void ClearInputCharacters(); // Clear the text input buffer manually
|
|
||||||
IMGUI_API void AddFocusEvent(bool focused); // Notifies Dear ImGui when hosting platform windows lose or gain input focus
|
IMGUI_API void AddFocusEvent(bool focused); // Notifies Dear ImGui when hosting platform windows lose or gain input focus
|
||||||
|
IMGUI_API void ClearInputCharacters(); // [Internal] Clear the text input buffer manually
|
||||||
|
IMGUI_API void ClearInputKeys(); // [Internal] Release all keys
|
||||||
|
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
// Output - Updated by NewFrame() or EndFrame()/Render()
|
// Output - Updated by NewFrame() or EndFrame()/Render()
|
||||||
@@ -1915,16 +1924,19 @@ struct ImGuiIO
|
|||||||
// [Internal] Dear ImGui will maintain those fields. Forward compatibility not guaranteed!
|
// [Internal] Dear ImGui will maintain those fields. Forward compatibility not guaranteed!
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
|
|
||||||
|
bool WantCaptureMouseUnlessPopupClose;// Alternative to WantCaptureMouse: (WantCaptureMouse == true && WantCaptureMouseUnlessPopupClose == false) when a click over void is expected to close a popup.
|
||||||
ImGuiKeyModFlags KeyMods; // Key mods flags (same as io.KeyCtrl/KeyShift/KeyAlt/KeySuper but merged into flags), updated by NewFrame()
|
ImGuiKeyModFlags KeyMods; // Key mods flags (same as io.KeyCtrl/KeyShift/KeyAlt/KeySuper but merged into flags), updated by NewFrame()
|
||||||
ImGuiKeyModFlags KeyModsPrev; // Previous key mods
|
ImGuiKeyModFlags KeyModsPrev; // Previous key mods
|
||||||
ImVec2 MousePosPrev; // Previous mouse position (note that MouseDelta is not necessary == MousePos-MousePosPrev, in case either position is invalid)
|
ImVec2 MousePosPrev; // Previous mouse position (note that MouseDelta is not necessary == MousePos-MousePosPrev, in case either position is invalid)
|
||||||
ImVec2 MouseClickedPos[5]; // Position at time of clicking
|
ImVec2 MouseClickedPos[5]; // Position at time of clicking
|
||||||
double MouseClickedTime[5]; // Time of last click (used to figure out double-click)
|
double MouseClickedTime[5]; // Time of last click (used to figure out double-click)
|
||||||
bool MouseClicked[5]; // Mouse button went from !Down to Down
|
bool MouseClicked[5]; // Mouse button went from !Down to Down (same as MouseClickedCount[x] != 0)
|
||||||
bool MouseDoubleClicked[5]; // Has mouse button been double-clicked?
|
bool MouseDoubleClicked[5]; // Has mouse button been double-clicked? (same as MouseClickedCount[x] == 2)
|
||||||
|
ImU16 MouseClickedCount[5]; // == 0 (not clicked), == 1 (same as MouseClicked[]), == 2 (double-clicked), == 3 (triple-clicked) etc. when going from !Down to Down
|
||||||
|
ImU16 MouseClickedLastCount[5]; // Count successive number of clicks. Stays valid after mouse release. Reset after another click is done.
|
||||||
bool MouseReleased[5]; // Mouse button went from Down to !Down
|
bool MouseReleased[5]; // Mouse button went from Down to !Down
|
||||||
bool MouseDownOwned[5]; // Track if button was clicked inside a dear imgui window. We don't request mouse capture from the application if click started outside ImGui bounds.
|
bool MouseDownOwned[5]; // Track if button was clicked inside a dear imgui window or over void blocked by a popup. We don't request mouse capture from the application if click started outside ImGui bounds.
|
||||||
bool MouseDownWasDoubleClick[5]; // Track if button down was a double-click
|
bool MouseDownOwnedUnlessPopupClose[5];//Track if button was clicked inside a dear imgui window.
|
||||||
float MouseDownDuration[5]; // Duration the mouse button has been down (0.0f == just clicked)
|
float MouseDownDuration[5]; // Duration the mouse button has been down (0.0f == just clicked)
|
||||||
float MouseDownDurationPrev[5]; // Previous time the mouse button has been down
|
float MouseDownDurationPrev[5]; // Previous time the mouse button has been down
|
||||||
ImVec2 MouseDragMaxDistanceAbs[5]; // Maximum distance, absolute, on each axis, of how much mouse has traveled from the clicking point
|
ImVec2 MouseDragMaxDistanceAbs[5]; // Maximum distance, absolute, on each axis, of how much mouse has traveled from the clicking point
|
||||||
@@ -1934,6 +1946,7 @@ struct ImGuiIO
|
|||||||
float NavInputsDownDuration[ImGuiNavInput_COUNT];
|
float NavInputsDownDuration[ImGuiNavInput_COUNT];
|
||||||
float NavInputsDownDurationPrev[ImGuiNavInput_COUNT];
|
float NavInputsDownDurationPrev[ImGuiNavInput_COUNT];
|
||||||
float PenPressure; // Touch/Pen pressure (0.0f to 1.0f, should be >0.0f only when MouseDown[0] == true). Helper storage currently unused by Dear ImGui.
|
float PenPressure; // Touch/Pen pressure (0.0f to 1.0f, should be >0.0f only when MouseDown[0] == true). Helper storage currently unused by Dear ImGui.
|
||||||
|
bool AppFocusLost;
|
||||||
ImWchar16 InputQueueSurrogate; // For AddInputCharacterUTF16
|
ImWchar16 InputQueueSurrogate; // For AddInputCharacterUTF16
|
||||||
ImVector<ImWchar> InputQueueCharacters; // Queue of _characters_ input (obtained by platform backend). Fill using AddInputCharacter() helper.
|
ImVector<ImWchar> InputQueueCharacters; // Queue of _characters_ input (obtained by platform backend). Fill using AddInputCharacter() helper.
|
||||||
|
|
||||||
@@ -2158,10 +2171,12 @@ struct ImGuiStorage
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Helper: Manually clip large list of items.
|
// Helper: Manually clip large list of items.
|
||||||
// If you are submitting lots of evenly spaced items and you have a random access to the list, you can perform coarse
|
// If you have lots evenly spaced items and you have a random access to the list, you can perform coarse
|
||||||
// clipping based on visibility to save yourself from processing those items at all.
|
// clipping based on visibility to only submit items that are in view.
|
||||||
// The clipper calculates the range of visible items and advance the cursor to compensate for the non-visible items we have skipped.
|
// The clipper calculates the range of visible items and advance the cursor to compensate for the non-visible items we have skipped.
|
||||||
// (Dear ImGui already clip items based on their bounds but it needs to measure text size to do so, whereas manual coarse clipping before submission makes this cost and your own data fetching/submission cost almost null)
|
// (Dear ImGui already clip items based on their bounds but: it needs to first layout the item to do so, and generally
|
||||||
|
// fetching/submitting your own data incurs additional cost. Coarse clipping using ImGuiListClipper allows you to easily
|
||||||
|
// scale using lists with tens of thousands of items without a problem)
|
||||||
// Usage:
|
// Usage:
|
||||||
// ImGuiListClipper clipper;
|
// ImGuiListClipper clipper;
|
||||||
// clipper.Begin(1000); // We have 1000 elements, evenly spaced.
|
// clipper.Begin(1000); // We have 1000 elements, evenly spaced.
|
||||||
@@ -2170,31 +2185,31 @@ struct ImGuiStorage
|
|||||||
// ImGui::Text("line number %d", i);
|
// ImGui::Text("line number %d", i);
|
||||||
// Generally what happens is:
|
// Generally what happens is:
|
||||||
// - Clipper lets you process the first element (DisplayStart = 0, DisplayEnd = 1) regardless of it being visible or not.
|
// - Clipper lets you process the first element (DisplayStart = 0, DisplayEnd = 1) regardless of it being visible or not.
|
||||||
// - User code submit one element.
|
// - User code submit that one element.
|
||||||
// - Clipper can measure the height of the first element
|
// - Clipper can measure the height of the first element
|
||||||
// - Clipper calculate the actual range of elements to display based on the current clipping rectangle, position the cursor before the first visible element.
|
// - Clipper calculate the actual range of elements to display based on the current clipping rectangle, position the cursor before the first visible element.
|
||||||
// - User code submit visible elements.
|
// - User code submit visible elements.
|
||||||
|
// - The clipper also handles various subtleties related to keyboard/gamepad navigation, wrapping etc.
|
||||||
struct ImGuiListClipper
|
struct ImGuiListClipper
|
||||||
{
|
{
|
||||||
int DisplayStart;
|
int DisplayStart; // First item to display, updated by each call to Step()
|
||||||
int DisplayEnd;
|
int DisplayEnd; // End of items to display (exclusive)
|
||||||
|
int ItemsCount; // [Internal] Number of items
|
||||||
// [Internal]
|
float ItemsHeight; // [Internal] Height of item after a first step and item submission can calculate it
|
||||||
int ItemsCount;
|
float StartPosY; // [Internal] Cursor position at the time of Begin() or after table frozen rows are all processed
|
||||||
int StepNo;
|
void* TempData; // [Internal] Internal data
|
||||||
int ItemsFrozen;
|
|
||||||
float ItemsHeight;
|
|
||||||
float StartPosY;
|
|
||||||
|
|
||||||
IMGUI_API ImGuiListClipper();
|
|
||||||
IMGUI_API ~ImGuiListClipper();
|
|
||||||
|
|
||||||
// items_count: Use INT_MAX if you don't know how many items you have (in which case the cursor won't be advanced in the final step)
|
// items_count: Use INT_MAX if you don't know how many items you have (in which case the cursor won't be advanced in the final step)
|
||||||
// items_height: Use -1.0f to be calculated automatically on first step. Otherwise pass in the distance between your items, typically GetTextLineHeightWithSpacing() or GetFrameHeightWithSpacing().
|
// items_height: Use -1.0f to be calculated automatically on first step. Otherwise pass in the distance between your items, typically GetTextLineHeightWithSpacing() or GetFrameHeightWithSpacing().
|
||||||
IMGUI_API void Begin(int items_count, float items_height = -1.0f); // Automatically called by constructor if you passed 'items_count' or by Step() in Step 1.
|
IMGUI_API ImGuiListClipper();
|
||||||
|
IMGUI_API ~ImGuiListClipper();
|
||||||
|
IMGUI_API void Begin(int items_count, float items_height = -1.0f);
|
||||||
IMGUI_API void End(); // Automatically called on the last call of Step() that returns false.
|
IMGUI_API void End(); // Automatically called on the last call of Step() that returns false.
|
||||||
IMGUI_API bool Step(); // Call until it returns false. The DisplayStart/DisplayEnd fields will be set and you can process/draw those items.
|
IMGUI_API bool Step(); // Call until it returns false. The DisplayStart/DisplayEnd fields will be set and you can process/draw those items.
|
||||||
|
|
||||||
|
// Call ForceDisplayRangeByIndices() before first call to Step() if you need a range of items to be displayed regardless of visibility.
|
||||||
|
IMGUI_API void ForceDisplayRangeByIndices(int item_min, int item_max); // item_max is exclusive e.g. use (42, 42+1) to make item 42 always visible BUT due to alignment/padding of certain items it is likely that an extra item may be included on either end of the display range.
|
||||||
|
|
||||||
#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
|
#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
|
||||||
inline ImGuiListClipper(int items_count, float items_height = -1.0f) { memset(this, 0, sizeof(*this)); ItemsCount = -1; Begin(items_count, items_height); } // [removed in 1.79]
|
inline ImGuiListClipper(int items_count, float items_height = -1.0f) { memset(this, 0, sizeof(*this)); ItemsCount = -1; Begin(items_count, items_height); } // [removed in 1.79]
|
||||||
#endif
|
#endif
|
||||||
@@ -2816,6 +2831,10 @@ struct ImGuiViewport
|
|||||||
#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
|
#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
|
||||||
namespace ImGui
|
namespace ImGui
|
||||||
{
|
{
|
||||||
|
// OBSOLETED in 1.86 (from November 2021)
|
||||||
|
IMGUI_API void CalcListClipping(int items_count, float items_height, int* out_items_display_start, int* out_items_display_end); // Calculate coarse clipping for large list of evenly sized items. Prefer using ImGuiListClipper.
|
||||||
|
// OBSOLETED in 1.85 (from August 2021)
|
||||||
|
static inline float GetWindowContentRegionWidth() { return GetWindowContentRegionMax().x - GetWindowContentRegionMin().x; }
|
||||||
// OBSOLETED in 1.81 (from February 2021)
|
// OBSOLETED in 1.81 (from February 2021)
|
||||||
IMGUI_API bool ListBoxHeader(const char* label, int items_count, int height_in_items = -1); // Helper to calculate size from items_count and height_in_items
|
IMGUI_API bool ListBoxHeader(const char* label, int items_count, int height_in_items = -1); // Helper to calculate size from items_count and height_in_items
|
||||||
static inline bool ListBoxHeader(const char* label, const ImVec2& size = ImVec2(0, 0)) { return BeginListBox(label, size); }
|
static inline bool ListBoxHeader(const char* label, const ImVec2& size = ImVec2(0, 0)) { return BeginListBox(label, size); }
|
||||||
|
|||||||
+246
-37
File diff suppressed because it is too large
Load Diff
+39
-32
@@ -1,4 +1,4 @@
|
|||||||
// dear imgui, v1.84
|
// dear imgui, v1.86
|
||||||
// (drawing and font code)
|
// (drawing and font code)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -473,6 +473,7 @@ void ImDrawList::_PopUnusedDrawCmd()
|
|||||||
|
|
||||||
void ImDrawList::AddCallback(ImDrawCallback callback, void* callback_data)
|
void ImDrawList::AddCallback(ImDrawCallback callback, void* callback_data)
|
||||||
{
|
{
|
||||||
|
IM_ASSERT_PARANOID(CmdBuffer.Size > 0);
|
||||||
ImDrawCmd* curr_cmd = &CmdBuffer.Data[CmdBuffer.Size - 1];
|
ImDrawCmd* curr_cmd = &CmdBuffer.Data[CmdBuffer.Size - 1];
|
||||||
IM_ASSERT(curr_cmd->UserCallback == NULL);
|
IM_ASSERT(curr_cmd->UserCallback == NULL);
|
||||||
if (curr_cmd->ElemCount != 0)
|
if (curr_cmd->ElemCount != 0)
|
||||||
@@ -494,6 +495,7 @@ void ImDrawList::AddCallback(ImDrawCallback callback, void* callback_data)
|
|||||||
// Try to merge two last draw commands
|
// Try to merge two last draw commands
|
||||||
void ImDrawList::_TryMergeDrawCmds()
|
void ImDrawList::_TryMergeDrawCmds()
|
||||||
{
|
{
|
||||||
|
IM_ASSERT_PARANOID(CmdBuffer.Size > 0);
|
||||||
ImDrawCmd* curr_cmd = &CmdBuffer.Data[CmdBuffer.Size - 1];
|
ImDrawCmd* curr_cmd = &CmdBuffer.Data[CmdBuffer.Size - 1];
|
||||||
ImDrawCmd* prev_cmd = curr_cmd - 1;
|
ImDrawCmd* prev_cmd = curr_cmd - 1;
|
||||||
if (ImDrawCmd_HeaderCompare(curr_cmd, prev_cmd) == 0 && curr_cmd->UserCallback == NULL && prev_cmd->UserCallback == NULL)
|
if (ImDrawCmd_HeaderCompare(curr_cmd, prev_cmd) == 0 && curr_cmd->UserCallback == NULL && prev_cmd->UserCallback == NULL)
|
||||||
@@ -508,6 +510,7 @@ void ImDrawList::_TryMergeDrawCmds()
|
|||||||
void ImDrawList::_OnChangedClipRect()
|
void ImDrawList::_OnChangedClipRect()
|
||||||
{
|
{
|
||||||
// If current command is used with different settings we need to add a new command
|
// If current command is used with different settings we need to add a new command
|
||||||
|
IM_ASSERT_PARANOID(CmdBuffer.Size > 0);
|
||||||
ImDrawCmd* curr_cmd = &CmdBuffer.Data[CmdBuffer.Size - 1];
|
ImDrawCmd* curr_cmd = &CmdBuffer.Data[CmdBuffer.Size - 1];
|
||||||
if (curr_cmd->ElemCount != 0 && memcmp(&curr_cmd->ClipRect, &_CmdHeader.ClipRect, sizeof(ImVec4)) != 0)
|
if (curr_cmd->ElemCount != 0 && memcmp(&curr_cmd->ClipRect, &_CmdHeader.ClipRect, sizeof(ImVec4)) != 0)
|
||||||
{
|
{
|
||||||
@@ -530,6 +533,7 @@ void ImDrawList::_OnChangedClipRect()
|
|||||||
void ImDrawList::_OnChangedTextureID()
|
void ImDrawList::_OnChangedTextureID()
|
||||||
{
|
{
|
||||||
// If current command is used with different settings we need to add a new command
|
// If current command is used with different settings we need to add a new command
|
||||||
|
IM_ASSERT_PARANOID(CmdBuffer.Size > 0);
|
||||||
ImDrawCmd* curr_cmd = &CmdBuffer.Data[CmdBuffer.Size - 1];
|
ImDrawCmd* curr_cmd = &CmdBuffer.Data[CmdBuffer.Size - 1];
|
||||||
if (curr_cmd->ElemCount != 0 && curr_cmd->TextureId != _CmdHeader.TextureId)
|
if (curr_cmd->ElemCount != 0 && curr_cmd->TextureId != _CmdHeader.TextureId)
|
||||||
{
|
{
|
||||||
@@ -553,6 +557,7 @@ void ImDrawList::_OnChangedVtxOffset()
|
|||||||
{
|
{
|
||||||
// We don't need to compare curr_cmd->VtxOffset != _CmdHeader.VtxOffset because we know it'll be different at the time we call this.
|
// We don't need to compare curr_cmd->VtxOffset != _CmdHeader.VtxOffset because we know it'll be different at the time we call this.
|
||||||
_VtxCurrentIdx = 0;
|
_VtxCurrentIdx = 0;
|
||||||
|
IM_ASSERT_PARANOID(CmdBuffer.Size > 0);
|
||||||
ImDrawCmd* curr_cmd = &CmdBuffer.Data[CmdBuffer.Size - 1];
|
ImDrawCmd* curr_cmd = &CmdBuffer.Data[CmdBuffer.Size - 1];
|
||||||
//IM_ASSERT(curr_cmd->VtxOffset != _CmdHeader.VtxOffset); // See #3349
|
//IM_ASSERT(curr_cmd->VtxOffset != _CmdHeader.VtxOffset); // See #3349
|
||||||
if (curr_cmd->ElemCount != 0)
|
if (curr_cmd->ElemCount != 0)
|
||||||
@@ -1919,33 +1924,34 @@ ImFontConfig::ImFontConfig()
|
|||||||
|
|
||||||
// A work of art lies ahead! (. = white layer, X = black layer, others are blank)
|
// A work of art lies ahead! (. = white layer, X = black layer, others are blank)
|
||||||
// The 2x2 white texels on the top left are the ones we'll use everywhere in Dear ImGui to render filled shapes.
|
// The 2x2 white texels on the top left are the ones we'll use everywhere in Dear ImGui to render filled shapes.
|
||||||
const int FONT_ATLAS_DEFAULT_TEX_DATA_W = 108; // Actual texture will be 2 times that + 1 spacing.
|
// (This is used when io.MouseDrawCursor = true)
|
||||||
|
const int FONT_ATLAS_DEFAULT_TEX_DATA_W = 122; // Actual texture will be 2 times that + 1 spacing.
|
||||||
const int FONT_ATLAS_DEFAULT_TEX_DATA_H = 27;
|
const int FONT_ATLAS_DEFAULT_TEX_DATA_H = 27;
|
||||||
static const char FONT_ATLAS_DEFAULT_TEX_DATA_PIXELS[FONT_ATLAS_DEFAULT_TEX_DATA_W * FONT_ATLAS_DEFAULT_TEX_DATA_H + 1] =
|
static const char FONT_ATLAS_DEFAULT_TEX_DATA_PIXELS[FONT_ATLAS_DEFAULT_TEX_DATA_W * FONT_ATLAS_DEFAULT_TEX_DATA_H + 1] =
|
||||||
{
|
{
|
||||||
"..- -XXXXXXX- X - X -XXXXXXX - XXXXXXX- XX "
|
"..- -XXXXXXX- X - X -XXXXXXX - XXXXXXX- XX - XX XX "
|
||||||
"..- -X.....X- X.X - X.X -X.....X - X.....X- X..X "
|
"..- -X.....X- X.X - X.X -X.....X - X.....X- X..X -X..X X..X"
|
||||||
"--- -XXX.XXX- X...X - X...X -X....X - X....X- X..X "
|
"--- -XXX.XXX- X...X - X...X -X....X - X....X- X..X -X...X X...X"
|
||||||
"X - X.X - X.....X - X.....X -X...X - X...X- X..X "
|
"X - X.X - X.....X - X.....X -X...X - X...X- X..X - X...X X...X "
|
||||||
"XX - X.X -X.......X- X.......X -X..X.X - X.X..X- X..X "
|
"XX - X.X -X.......X- X.......X -X..X.X - X.X..X- X..X - X...X...X "
|
||||||
"X.X - X.X -XXXX.XXXX- XXXX.XXXX -X.X X.X - X.X X.X- X..XXX "
|
"X.X - X.X -XXXX.XXXX- XXXX.XXXX -X.X X.X - X.X X.X- X..XXX - X.....X "
|
||||||
"X..X - X.X - X.X - X.X -XX X.X - X.X XX- X..X..XXX "
|
"X..X - X.X - X.X - X.X -XX X.X - X.X XX- X..X..XXX - X...X "
|
||||||
"X...X - X.X - X.X - XX X.X XX - X.X - X.X - X..X..X..XX "
|
"X...X - X.X - X.X - XX X.X XX - X.X - X.X - X..X..X..XX - X.X "
|
||||||
"X....X - X.X - X.X - X.X X.X X.X - X.X - X.X - X..X..X..X.X "
|
"X....X - X.X - X.X - X.X X.X X.X - X.X - X.X - X..X..X..X.X - X...X "
|
||||||
"X.....X - X.X - X.X - X..X X.X X..X - X.X - X.X -XXX X..X..X..X..X"
|
"X.....X - X.X - X.X - X..X X.X X..X - X.X - X.X -XXX X..X..X..X..X- X.....X "
|
||||||
"X......X - X.X - X.X - X...XXXXXX.XXXXXX...X - X.X XX-XX X.X -X..XX........X..X"
|
"X......X - X.X - X.X - X...XXXXXX.XXXXXX...X - X.X XX-XX X.X -X..XX........X..X- X...X...X "
|
||||||
"X.......X - X.X - X.X -X.....................X- X.X X.X-X.X X.X -X...X...........X"
|
"X.......X - X.X - X.X -X.....................X- X.X X.X-X.X X.X -X...X...........X- X...X X...X "
|
||||||
"X........X - X.X - X.X - X...XXXXXX.XXXXXX...X - X.X..X-X..X.X - X..............X"
|
"X........X - X.X - X.X - X...XXXXXX.XXXXXX...X - X.X..X-X..X.X - X..............X-X...X X...X"
|
||||||
"X.........X -XXX.XXX- X.X - X..X X.X X..X - X...X-X...X - X.............X"
|
"X.........X -XXX.XXX- X.X - X..X X.X X..X - X...X-X...X - X.............X-X..X X..X"
|
||||||
"X..........X-X.....X- X.X - X.X X.X X.X - X....X-X....X - X.............X"
|
"X..........X-X.....X- X.X - X.X X.X X.X - X....X-X....X - X.............X- XX XX "
|
||||||
"X......XXXXX-XXXXXXX- X.X - XX X.X XX - X.....X-X.....X - X............X"
|
"X......XXXXX-XXXXXXX- X.X - XX X.X XX - X.....X-X.....X - X............X--------------"
|
||||||
"X...X..X --------- X.X - X.X - XXXXXXX-XXXXXXX - X...........X "
|
"X...X..X --------- X.X - X.X - XXXXXXX-XXXXXXX - X...........X - "
|
||||||
"X..X X..X - -XXXX.XXXX- XXXX.XXXX ------------------------------------- X..........X "
|
"X..X X..X - -XXXX.XXXX- XXXX.XXXX ------------------------------------- X..........X - "
|
||||||
"X.X X..X - -X.......X- X.......X - XX XX - - X..........X "
|
"X.X X..X - -X.......X- X.......X - XX XX - - X..........X - "
|
||||||
"XX X..X - - X.....X - X.....X - X.X X.X - - X........X "
|
"XX X..X - - X.....X - X.....X - X.X X.X - - X........X - "
|
||||||
" X..X - X...X - X...X - X..X X..X - - X........X "
|
" X..X - - X...X - X...X - X..X X..X - - X........X - "
|
||||||
" XX - X.X - X.X - X...XXXXXXXXXXXXX...X - - XXXXXXXXXX "
|
" XX - - X.X - X.X - X...XXXXXXXXXXXXX...X - - XXXXXXXXXX - "
|
||||||
"------------ - X - X -X.....................X- ------------------"
|
"------------- - X - X -X.....................X- ------------------- "
|
||||||
" ----------------------------------- X...XXXXXXXXXXXXX...X - "
|
" ----------------------------------- X...XXXXXXXXXXXXX...X - "
|
||||||
" - X..X X..X - "
|
" - X..X X..X - "
|
||||||
" - X.X X.X - "
|
" - X.X X.X - "
|
||||||
@@ -1963,6 +1969,7 @@ static const ImVec2 FONT_ATLAS_DEFAULT_TEX_CURSOR_DATA[ImGuiMouseCursor_COUNT][3
|
|||||||
{ ImVec2(73,0), ImVec2(17,17), ImVec2( 8, 8) }, // ImGuiMouseCursor_ResizeNESW
|
{ ImVec2(73,0), ImVec2(17,17), ImVec2( 8, 8) }, // ImGuiMouseCursor_ResizeNESW
|
||||||
{ ImVec2(55,0), ImVec2(17,17), ImVec2( 8, 8) }, // ImGuiMouseCursor_ResizeNWSE
|
{ ImVec2(55,0), ImVec2(17,17), ImVec2( 8, 8) }, // ImGuiMouseCursor_ResizeNWSE
|
||||||
{ ImVec2(91,0), ImVec2(17,22), ImVec2( 5, 0) }, // ImGuiMouseCursor_Hand
|
{ ImVec2(91,0), ImVec2(17,22), ImVec2( 5, 0) }, // ImGuiMouseCursor_Hand
|
||||||
|
{ ImVec2(109,0),ImVec2(13,15), ImVec2( 6, 7) }, // ImGuiMouseCursor_NotAllowed
|
||||||
};
|
};
|
||||||
|
|
||||||
ImFontAtlas::ImFontAtlas()
|
ImFontAtlas::ImFontAtlas()
|
||||||
@@ -1998,7 +2005,7 @@ void ImFontAtlas::ClearInputData()
|
|||||||
ConfigData.clear();
|
ConfigData.clear();
|
||||||
CustomRects.clear();
|
CustomRects.clear();
|
||||||
PackIdMouseCursors = PackIdLines = -1;
|
PackIdMouseCursors = PackIdLines = -1;
|
||||||
TexReady = false;
|
// Important: we leave TexReady untouched
|
||||||
}
|
}
|
||||||
|
|
||||||
void ImFontAtlas::ClearTexData()
|
void ImFontAtlas::ClearTexData()
|
||||||
@@ -3073,8 +3080,8 @@ void ImFontGlyphRangesBuilder::AddText(const char* text, const char* text_end)
|
|||||||
void ImFontGlyphRangesBuilder::AddRanges(const ImWchar* ranges)
|
void ImFontGlyphRangesBuilder::AddRanges(const ImWchar* ranges)
|
||||||
{
|
{
|
||||||
for (; ranges[0]; ranges += 2)
|
for (; ranges[0]; ranges += 2)
|
||||||
for (ImWchar c = ranges[0]; c <= ranges[1]; c++)
|
for (unsigned int c = ranges[0]; c <= ranges[1] && c <= IM_UNICODE_CODEPOINT_MAX; c++) //-V560
|
||||||
AddChar(c);
|
AddChar((ImWchar)c);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ImFontGlyphRangesBuilder::BuildRanges(ImVector<ImWchar>* out_ranges)
|
void ImFontGlyphRangesBuilder::BuildRanges(ImVector<ImWchar>* out_ranges)
|
||||||
@@ -3899,10 +3906,10 @@ void ImGui::RenderRectFilledWithHole(ImDrawList* draw_list, ImRect outer, ImRect
|
|||||||
const bool fill_R = (inner.Max.x < outer.Max.x);
|
const bool fill_R = (inner.Max.x < outer.Max.x);
|
||||||
const bool fill_U = (inner.Min.y > outer.Min.y);
|
const bool fill_U = (inner.Min.y > outer.Min.y);
|
||||||
const bool fill_D = (inner.Max.y < outer.Max.y);
|
const bool fill_D = (inner.Max.y < outer.Max.y);
|
||||||
if (fill_L) draw_list->AddRectFilled(ImVec2(outer.Min.x, inner.Min.y), ImVec2(inner.Min.x, inner.Max.y), col, rounding, (fill_U ? 0 : ImDrawFlags_RoundCornersTopLeft) | (fill_D ? 0 : ImDrawFlags_RoundCornersBottomLeft));
|
if (fill_L) draw_list->AddRectFilled(ImVec2(outer.Min.x, inner.Min.y), ImVec2(inner.Min.x, inner.Max.y), col, rounding, ImDrawFlags_RoundCornersNone | (fill_U ? 0 : ImDrawFlags_RoundCornersTopLeft) | (fill_D ? 0 : ImDrawFlags_RoundCornersBottomLeft));
|
||||||
if (fill_R) draw_list->AddRectFilled(ImVec2(inner.Max.x, inner.Min.y), ImVec2(outer.Max.x, inner.Max.y), col, rounding, (fill_U ? 0 : ImDrawFlags_RoundCornersTopRight) | (fill_D ? 0 : ImDrawFlags_RoundCornersBottomRight));
|
if (fill_R) draw_list->AddRectFilled(ImVec2(inner.Max.x, inner.Min.y), ImVec2(outer.Max.x, inner.Max.y), col, rounding, ImDrawFlags_RoundCornersNone | (fill_U ? 0 : ImDrawFlags_RoundCornersTopRight) | (fill_D ? 0 : ImDrawFlags_RoundCornersBottomRight));
|
||||||
if (fill_U) draw_list->AddRectFilled(ImVec2(inner.Min.x, outer.Min.y), ImVec2(inner.Max.x, inner.Min.y), col, rounding, (fill_L ? 0 : ImDrawFlags_RoundCornersTopLeft) | (fill_R ? 0 : ImDrawFlags_RoundCornersTopRight));
|
if (fill_U) draw_list->AddRectFilled(ImVec2(inner.Min.x, outer.Min.y), ImVec2(inner.Max.x, inner.Min.y), col, rounding, ImDrawFlags_RoundCornersNone | (fill_L ? 0 : ImDrawFlags_RoundCornersTopLeft) | (fill_R ? 0 : ImDrawFlags_RoundCornersTopRight));
|
||||||
if (fill_D) draw_list->AddRectFilled(ImVec2(inner.Min.x, inner.Max.y), ImVec2(inner.Max.x, outer.Max.y), col, rounding, (fill_L ? 0 : ImDrawFlags_RoundCornersBottomLeft) | (fill_R ? 0 : ImDrawFlags_RoundCornersBottomRight));
|
if (fill_D) draw_list->AddRectFilled(ImVec2(inner.Min.x, inner.Max.y), ImVec2(inner.Max.x, outer.Max.y), col, rounding, ImDrawFlags_RoundCornersNone | (fill_L ? 0 : ImDrawFlags_RoundCornersBottomLeft) | (fill_R ? 0 : ImDrawFlags_RoundCornersBottomRight));
|
||||||
if (fill_L && fill_U) draw_list->AddRectFilled(ImVec2(outer.Min.x, outer.Min.y), ImVec2(inner.Min.x, inner.Min.y), col, rounding, ImDrawFlags_RoundCornersTopLeft);
|
if (fill_L && fill_U) draw_list->AddRectFilled(ImVec2(outer.Min.x, outer.Min.y), ImVec2(inner.Min.x, inner.Min.y), col, rounding, ImDrawFlags_RoundCornersTopLeft);
|
||||||
if (fill_R && fill_U) draw_list->AddRectFilled(ImVec2(inner.Max.x, outer.Min.y), ImVec2(outer.Max.x, inner.Min.y), col, rounding, ImDrawFlags_RoundCornersTopRight);
|
if (fill_R && fill_U) draw_list->AddRectFilled(ImVec2(inner.Max.x, outer.Min.y), ImVec2(outer.Max.x, inner.Min.y), col, rounding, ImDrawFlags_RoundCornersTopRight);
|
||||||
if (fill_L && fill_D) draw_list->AddRectFilled(ImVec2(outer.Min.x, inner.Max.y), ImVec2(inner.Min.x, outer.Max.y), col, rounding, ImDrawFlags_RoundCornersBottomLeft);
|
if (fill_L && fill_D) draw_list->AddRectFilled(ImVec2(outer.Min.x, inner.Max.y), ImVec2(inner.Min.x, outer.Max.y), col, rounding, ImDrawFlags_RoundCornersBottomLeft);
|
||||||
|
|||||||
+793
@@ -0,0 +1,793 @@
|
|||||||
|
// dear imgui: Renderer Backend for modern OpenGL with shaders / programmatic pipeline
|
||||||
|
// - Desktop GL: 2.x 3.x 4.x
|
||||||
|
// - Embedded GL: ES 2.0 (WebGL 1.0), ES 3.0 (WebGL 2.0)
|
||||||
|
// This needs to be used along with a Platform Backend (e.g. GLFW, SDL, Win32, custom..)
|
||||||
|
|
||||||
|
// Implemented features:
|
||||||
|
// [X] Renderer: User texture binding. Use 'GLuint' OpenGL texture identifier as void*/ImTextureID. Read the FAQ about ImTextureID!
|
||||||
|
// [x] Renderer: Desktop GL only: Support for large meshes (64k+ vertices) with 16-bit indices.
|
||||||
|
|
||||||
|
// You can use unmodified imgui_impl_* files in your project. See examples/ folder for examples of using this.
|
||||||
|
// Prefer including the entire imgui/ repository into your project (either as a copy or as a submodule), and only build the backends you need.
|
||||||
|
// If you are new to Dear ImGui, read documentation from the docs/ folder + read the top of imgui.cpp.
|
||||||
|
// Read online: https://github.com/ocornut/imgui/tree/master/docs
|
||||||
|
|
||||||
|
// CHANGELOG
|
||||||
|
// (minor and older changes stripped away, please see git history for details)
|
||||||
|
// 2021-12-15: OpenGL: Using buffer orphaning + glBufferSubData(), seems to fix leaks with multi-viewports with some Intel HD drivers.
|
||||||
|
// 2021-08-23: OpenGL: Fixed ES 3.0 shader ("#version 300 es") use normal precision floats to avoid wobbly rendering at HD resolutions.
|
||||||
|
// 2021-08-19: OpenGL: Embed and use our own minimal GL loader (imgui_impl_opengl3_loader.h), removing requirement and support for third-party loader.
|
||||||
|
// 2021-06-29: Reorganized backend to pull data from a single structure to facilitate usage with multiple-contexts (all g_XXXX access changed to bd->XXXX).
|
||||||
|
// 2021-06-25: OpenGL: Use OES_vertex_array extension on Emscripten + backup/restore current state.
|
||||||
|
// 2021-06-21: OpenGL: Destroy individual vertex/fragment shader objects right after they are linked into the main shader.
|
||||||
|
// 2021-05-24: OpenGL: Access GL_CLIP_ORIGIN when "GL_ARB_clip_control" extension is detected, inside of just OpenGL 4.5 version.
|
||||||
|
// 2021-05-19: OpenGL: Replaced direct access to ImDrawCmd::TextureId with a call to ImDrawCmd::GetTexID(). (will become a requirement)
|
||||||
|
// 2021-04-06: OpenGL: Don't try to read GL_CLIP_ORIGIN unless we're OpenGL 4.5 or greater.
|
||||||
|
// 2021-02-18: OpenGL: Change blending equation to preserve alpha in output buffer.
|
||||||
|
// 2021-01-03: OpenGL: Backup, setup and restore GL_STENCIL_TEST state.
|
||||||
|
// 2020-10-23: OpenGL: Backup, setup and restore GL_PRIMITIVE_RESTART state.
|
||||||
|
// 2020-10-15: OpenGL: Use glGetString(GL_VERSION) instead of glGetIntegerv(GL_MAJOR_VERSION, ...) when the later returns zero (e.g. Desktop GL 2.x)
|
||||||
|
// 2020-09-17: OpenGL: Fix to avoid compiling/calling glBindSampler() on ES or pre 3.3 context which have the defines set by a loader.
|
||||||
|
// 2020-07-10: OpenGL: Added support for glad2 OpenGL loader.
|
||||||
|
// 2020-05-08: OpenGL: Made default GLSL version 150 (instead of 130) on OSX.
|
||||||
|
// 2020-04-21: OpenGL: Fixed handling of glClipControl(GL_UPPER_LEFT) by inverting projection matrix.
|
||||||
|
// 2020-04-12: OpenGL: Fixed context version check mistakenly testing for 4.0+ instead of 3.2+ to enable ImGuiBackendFlags_RendererHasVtxOffset.
|
||||||
|
// 2020-03-24: OpenGL: Added support for glbinding 2.x OpenGL loader.
|
||||||
|
// 2020-01-07: OpenGL: Added support for glbinding 3.x OpenGL loader.
|
||||||
|
// 2019-10-25: OpenGL: Using a combination of GL define and runtime GL version to decide whether to use glDrawElementsBaseVertex(). Fix building with pre-3.2 GL loaders.
|
||||||
|
// 2019-09-22: OpenGL: Detect default GL loader using __has_include compiler facility.
|
||||||
|
// 2019-09-16: OpenGL: Tweak initialization code to allow application calling ImGui_ImplOpenGL3_CreateFontsTexture() before the first NewFrame() call.
|
||||||
|
// 2019-05-29: OpenGL: Desktop GL only: Added support for large mesh (64K+ vertices), enable ImGuiBackendFlags_RendererHasVtxOffset flag.
|
||||||
|
// 2019-04-30: OpenGL: Added support for special ImDrawCallback_ResetRenderState callback to reset render state.
|
||||||
|
// 2019-03-29: OpenGL: Not calling glBindBuffer more than necessary in the render loop.
|
||||||
|
// 2019-03-15: OpenGL: Added a GL call + comments in ImGui_ImplOpenGL3_Init() to detect uninitialized GL function loaders early.
|
||||||
|
// 2019-03-03: OpenGL: Fix support for ES 2.0 (WebGL 1.0).
|
||||||
|
// 2019-02-20: OpenGL: Fix for OSX not supporting OpenGL 4.5, we don't try to read GL_CLIP_ORIGIN even if defined by the headers/loader.
|
||||||
|
// 2019-02-11: OpenGL: Projecting clipping rectangles correctly using draw_data->FramebufferScale to allow multi-viewports for retina display.
|
||||||
|
// 2019-02-01: OpenGL: Using GLSL 410 shaders for any version over 410 (e.g. 430, 450).
|
||||||
|
// 2018-11-30: Misc: Setting up io.BackendRendererName so it can be displayed in the About Window.
|
||||||
|
// 2018-11-13: OpenGL: Support for GL 4.5's glClipControl(GL_UPPER_LEFT) / GL_CLIP_ORIGIN.
|
||||||
|
// 2018-08-29: OpenGL: Added support for more OpenGL loaders: glew and glad, with comments indicative that any loader can be used.
|
||||||
|
// 2018-08-09: OpenGL: Default to OpenGL ES 3 on iOS and Android. GLSL version default to "#version 300 ES".
|
||||||
|
// 2018-07-30: OpenGL: Support for GLSL 300 ES and 410 core. Fixes for Emscripten compilation.
|
||||||
|
// 2018-07-10: OpenGL: Support for more GLSL versions (based on the GLSL version string). Added error output when shaders fail to compile/link.
|
||||||
|
// 2018-06-08: Misc: Extracted imgui_impl_opengl3.cpp/.h away from the old combined GLFW/SDL+OpenGL3 examples.
|
||||||
|
// 2018-06-08: OpenGL: Use draw_data->DisplayPos and draw_data->DisplaySize to setup projection matrix and clipping rectangle.
|
||||||
|
// 2018-05-25: OpenGL: Removed unnecessary backup/restore of GL_ELEMENT_ARRAY_BUFFER_BINDING since this is part of the VAO state.
|
||||||
|
// 2018-05-14: OpenGL: Making the call to glBindSampler() optional so 3.2 context won't fail if the function is a NULL pointer.
|
||||||
|
// 2018-03-06: OpenGL: Added const char* glsl_version parameter to ImGui_ImplOpenGL3_Init() so user can override the GLSL version e.g. "#version 150".
|
||||||
|
// 2018-02-23: OpenGL: Create the VAO in the render function so the setup can more easily be used with multiple shared GL context.
|
||||||
|
// 2018-02-16: Misc: Obsoleted the io.RenderDrawListsFn callback and exposed ImGui_ImplSdlGL3_RenderDrawData() in the .h file so you can call it yourself.
|
||||||
|
// 2018-01-07: OpenGL: Changed GLSL shader version from 330 to 150.
|
||||||
|
// 2017-09-01: OpenGL: Save and restore current bound sampler. Save and restore current polygon mode.
|
||||||
|
// 2017-05-01: OpenGL: Fixed save and restore of current blend func state.
|
||||||
|
// 2017-05-01: OpenGL: Fixed save and restore of current GL_ACTIVE_TEXTURE.
|
||||||
|
// 2016-09-05: OpenGL: Fixed save and restore of current scissor rectangle.
|
||||||
|
// 2016-07-29: OpenGL: Explicitly setting GL_UNPACK_ROW_LENGTH to reduce issues because SDL changes it. (#752)
|
||||||
|
|
||||||
|
//----------------------------------------
|
||||||
|
// OpenGL GLSL GLSL
|
||||||
|
// version version string
|
||||||
|
//----------------------------------------
|
||||||
|
// 2.0 110 "#version 110"
|
||||||
|
// 2.1 120 "#version 120"
|
||||||
|
// 3.0 130 "#version 130"
|
||||||
|
// 3.1 140 "#version 140"
|
||||||
|
// 3.2 150 "#version 150"
|
||||||
|
// 3.3 330 "#version 330 core"
|
||||||
|
// 4.0 400 "#version 400 core"
|
||||||
|
// 4.1 410 "#version 410 core"
|
||||||
|
// 4.2 420 "#version 410 core"
|
||||||
|
// 4.3 430 "#version 430 core"
|
||||||
|
// ES 2.0 100 "#version 100" = WebGL 1.0
|
||||||
|
// ES 3.0 300 "#version 300 es" = WebGL 2.0
|
||||||
|
//----------------------------------------
|
||||||
|
|
||||||
|
#if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_WARNINGS)
|
||||||
|
#define _CRT_SECURE_NO_WARNINGS
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "imgui.h"
|
||||||
|
#include "imgui_impl_opengl3.h"
|
||||||
|
#include <stdio.h>
|
||||||
|
#if defined(_MSC_VER) && _MSC_VER <= 1500 // MSVC 2008 or earlier
|
||||||
|
#include <stddef.h> // intptr_t
|
||||||
|
#else
|
||||||
|
#include <stdint.h> // intptr_t
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// GL includes
|
||||||
|
#if defined(IMGUI_IMPL_OPENGL_ES2)
|
||||||
|
#include <GLES2/gl2.h>
|
||||||
|
#if defined(__EMSCRIPTEN__)
|
||||||
|
#ifndef GL_GLEXT_PROTOTYPES
|
||||||
|
#define GL_GLEXT_PROTOTYPES
|
||||||
|
#endif
|
||||||
|
#include <GLES2/gl2ext.h>
|
||||||
|
#endif
|
||||||
|
#elif defined(IMGUI_IMPL_OPENGL_ES3)
|
||||||
|
#if defined(__APPLE__)
|
||||||
|
#include <TargetConditionals.h>
|
||||||
|
#endif
|
||||||
|
#if (defined(__APPLE__) && (TARGET_OS_IOS || TARGET_OS_TV))
|
||||||
|
#include <OpenGLES/ES3/gl.h> // Use GL ES 3
|
||||||
|
#else
|
||||||
|
#include <GLES3/gl3.h> // Use GL ES 3
|
||||||
|
#endif
|
||||||
|
#elif !defined(IMGUI_IMPL_OPENGL_LOADER_CUSTOM)
|
||||||
|
// Modern desktop OpenGL doesn't have a standard portable header file to load OpenGL function pointers.
|
||||||
|
// Helper libraries are often used for this purpose! Here we are using our own minimal custom loader based on gl3w.
|
||||||
|
// In the rest of your app/engine, you can use another loader of your choice (gl3w, glew, glad, glbinding, glext, glLoadGen, etc.).
|
||||||
|
// If you happen to be developing a new feature for this backend (imgui_impl_opengl3.cpp):
|
||||||
|
// - You may need to regenerate imgui_impl_opengl3_loader.h to add new symbols. See https://github.com/dearimgui/gl3w_stripped
|
||||||
|
// - You can temporarily use an unstripped version. See https://github.com/dearimgui/gl3w_stripped/releases
|
||||||
|
// Changes to this backend using new APIs should be accompanied by a regenerated stripped loader version.
|
||||||
|
#define IMGL3W_IMPL
|
||||||
|
#include "imgui_impl_opengl3_loader.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Vertex arrays are not supported on ES2/WebGL1 unless Emscripten which uses an extension
|
||||||
|
#ifndef IMGUI_IMPL_OPENGL_ES2
|
||||||
|
#define IMGUI_IMPL_OPENGL_USE_VERTEX_ARRAY
|
||||||
|
#elif defined(__EMSCRIPTEN__)
|
||||||
|
#define IMGUI_IMPL_OPENGL_USE_VERTEX_ARRAY
|
||||||
|
#define glBindVertexArray glBindVertexArrayOES
|
||||||
|
#define glGenVertexArrays glGenVertexArraysOES
|
||||||
|
#define glDeleteVertexArrays glDeleteVertexArraysOES
|
||||||
|
#define GL_VERTEX_ARRAY_BINDING GL_VERTEX_ARRAY_BINDING_OES
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Desktop GL 2.0+ has glPolygonMode() which GL ES and WebGL don't have.
|
||||||
|
#ifdef GL_POLYGON_MODE
|
||||||
|
#define IMGUI_IMPL_HAS_POLYGON_MODE
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Desktop GL 3.2+ has glDrawElementsBaseVertex() which GL ES and WebGL don't have.
|
||||||
|
#if !defined(IMGUI_IMPL_OPENGL_ES2) && !defined(IMGUI_IMPL_OPENGL_ES3) && defined(GL_VERSION_3_2)
|
||||||
|
#define IMGUI_IMPL_OPENGL_MAY_HAVE_VTX_OFFSET
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Desktop GL 3.3+ has glBindSampler()
|
||||||
|
#if !defined(IMGUI_IMPL_OPENGL_ES2) && !defined(IMGUI_IMPL_OPENGL_ES3) && defined(GL_VERSION_3_3)
|
||||||
|
#define IMGUI_IMPL_OPENGL_MAY_HAVE_BIND_SAMPLER
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Desktop GL 3.1+ has GL_PRIMITIVE_RESTART state
|
||||||
|
#if !defined(IMGUI_IMPL_OPENGL_ES2) && !defined(IMGUI_IMPL_OPENGL_ES3) && defined(GL_VERSION_3_1)
|
||||||
|
#define IMGUI_IMPL_OPENGL_MAY_HAVE_PRIMITIVE_RESTART
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Desktop GL use extension detection
|
||||||
|
#if !defined(IMGUI_IMPL_OPENGL_ES2) && !defined(IMGUI_IMPL_OPENGL_ES3)
|
||||||
|
#define IMGUI_IMPL_OPENGL_MAY_HAVE_EXTENSIONS
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// OpenGL Data
|
||||||
|
struct ImGui_ImplOpenGL3_Data
|
||||||
|
{
|
||||||
|
GLuint GlVersion; // Extracted at runtime using GL_MAJOR_VERSION, GL_MINOR_VERSION queries (e.g. 320 for GL 3.2)
|
||||||
|
char GlslVersionString[32]; // Specified by user or detected based on compile time GL settings.
|
||||||
|
GLuint FontTexture;
|
||||||
|
GLuint ShaderHandle;
|
||||||
|
GLint AttribLocationTex; // Uniforms location
|
||||||
|
GLint AttribLocationProjMtx;
|
||||||
|
GLuint AttribLocationVtxPos; // Vertex attributes location
|
||||||
|
GLuint AttribLocationVtxUV;
|
||||||
|
GLuint AttribLocationVtxColor;
|
||||||
|
unsigned int VboHandle, ElementsHandle;
|
||||||
|
GLsizeiptr VertexBufferSize;
|
||||||
|
GLsizeiptr IndexBufferSize;
|
||||||
|
bool HasClipOrigin;
|
||||||
|
|
||||||
|
ImGui_ImplOpenGL3_Data() { memset(this, 0, sizeof(*this)); }
|
||||||
|
};
|
||||||
|
|
||||||
|
// Backend data stored in io.BackendRendererUserData to allow support for multiple Dear ImGui contexts
|
||||||
|
// It is STRONGLY preferred that you use docking branch with multi-viewports (== single Dear ImGui context + multiple windows) instead of multiple Dear ImGui contexts.
|
||||||
|
static ImGui_ImplOpenGL3_Data* ImGui_ImplOpenGL3_GetBackendData()
|
||||||
|
{
|
||||||
|
return ImGui::GetCurrentContext() ? (ImGui_ImplOpenGL3_Data*)ImGui::GetIO().BackendRendererUserData : NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Functions
|
||||||
|
bool ImGui_ImplOpenGL3_Init(const char* glsl_version)
|
||||||
|
{
|
||||||
|
ImGuiIO& io = ImGui::GetIO();
|
||||||
|
IM_ASSERT(io.BackendRendererUserData == NULL && "Already initialized a renderer backend!");
|
||||||
|
|
||||||
|
// Initialize our loader
|
||||||
|
#if !defined(IMGUI_IMPL_OPENGL_ES2) && !defined(IMGUI_IMPL_OPENGL_ES3) && !defined(IMGUI_IMPL_OPENGL_LOADER_CUSTOM)
|
||||||
|
if (imgl3wInit() != 0)
|
||||||
|
{
|
||||||
|
fprintf(stderr, "Failed to initialize OpenGL loader!\n");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Setup backend capabilities flags
|
||||||
|
ImGui_ImplOpenGL3_Data* bd = IM_NEW(ImGui_ImplOpenGL3_Data)();
|
||||||
|
io.BackendRendererUserData = (void*)bd;
|
||||||
|
io.BackendRendererName = "imgui_impl_opengl3";
|
||||||
|
|
||||||
|
// Query for GL version (e.g. 320 for GL 3.2)
|
||||||
|
#if !defined(IMGUI_IMPL_OPENGL_ES2)
|
||||||
|
GLint major = 0;
|
||||||
|
GLint minor = 0;
|
||||||
|
glGetIntegerv(GL_MAJOR_VERSION, &major);
|
||||||
|
glGetIntegerv(GL_MINOR_VERSION, &minor);
|
||||||
|
if (major == 0 && minor == 0)
|
||||||
|
{
|
||||||
|
// Query GL_VERSION in desktop GL 2.x, the string will start with "<major>.<minor>"
|
||||||
|
const char* gl_version = (const char*)glGetString(GL_VERSION);
|
||||||
|
sscanf(gl_version, "%d.%d", &major, &minor);
|
||||||
|
}
|
||||||
|
bd->GlVersion = (GLuint)(major * 100 + minor * 10);
|
||||||
|
#else
|
||||||
|
bd->GlVersion = 200; // GLES 2
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef IMGUI_IMPL_OPENGL_MAY_HAVE_VTX_OFFSET
|
||||||
|
if (bd->GlVersion >= 320)
|
||||||
|
io.BackendFlags |= ImGuiBackendFlags_RendererHasVtxOffset; // We can honor the ImDrawCmd::VtxOffset field, allowing for large meshes.
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Store GLSL version string so we can refer to it later in case we recreate shaders.
|
||||||
|
// Note: GLSL version is NOT the same as GL version. Leave this to NULL if unsure.
|
||||||
|
if (glsl_version == NULL)
|
||||||
|
{
|
||||||
|
#if defined(IMGUI_IMPL_OPENGL_ES2)
|
||||||
|
glsl_version = "#version 100";
|
||||||
|
#elif defined(IMGUI_IMPL_OPENGL_ES3)
|
||||||
|
glsl_version = "#version 300 es";
|
||||||
|
#elif defined(__APPLE__)
|
||||||
|
glsl_version = "#version 150";
|
||||||
|
#else
|
||||||
|
glsl_version = "#version 130";
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
IM_ASSERT((int)strlen(glsl_version) + 2 < IM_ARRAYSIZE(bd->GlslVersionString));
|
||||||
|
strcpy(bd->GlslVersionString, glsl_version);
|
||||||
|
strcat(bd->GlslVersionString, "\n");
|
||||||
|
|
||||||
|
// Make an arbitrary GL call (we don't actually need the result)
|
||||||
|
// IF YOU GET A CRASH HERE: it probably means the OpenGL function loader didn't do its job. Let us know!
|
||||||
|
GLint current_texture;
|
||||||
|
glGetIntegerv(GL_TEXTURE_BINDING_2D, ¤t_texture);
|
||||||
|
|
||||||
|
// Detect extensions we support
|
||||||
|
bd->HasClipOrigin = (bd->GlVersion >= 450);
|
||||||
|
#ifdef IMGUI_IMPL_OPENGL_MAY_HAVE_EXTENSIONS
|
||||||
|
GLint num_extensions = 0;
|
||||||
|
glGetIntegerv(GL_NUM_EXTENSIONS, &num_extensions);
|
||||||
|
for (GLint i = 0; i < num_extensions; i++)
|
||||||
|
{
|
||||||
|
const char* extension = (const char*)glGetStringi(GL_EXTENSIONS, i);
|
||||||
|
if (extension != NULL && strcmp(extension, "GL_ARB_clip_control") == 0)
|
||||||
|
bd->HasClipOrigin = true;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ImGui_ImplOpenGL3_Shutdown()
|
||||||
|
{
|
||||||
|
ImGui_ImplOpenGL3_Data* bd = ImGui_ImplOpenGL3_GetBackendData();
|
||||||
|
IM_ASSERT(bd != NULL && "No renderer backend to shutdown, or already shutdown?");
|
||||||
|
ImGuiIO& io = ImGui::GetIO();
|
||||||
|
|
||||||
|
ImGui_ImplOpenGL3_DestroyDeviceObjects();
|
||||||
|
io.BackendRendererName = NULL;
|
||||||
|
io.BackendRendererUserData = NULL;
|
||||||
|
IM_DELETE(bd);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ImGui_ImplOpenGL3_NewFrame()
|
||||||
|
{
|
||||||
|
ImGui_ImplOpenGL3_Data* bd = ImGui_ImplOpenGL3_GetBackendData();
|
||||||
|
IM_ASSERT(bd != NULL && "Did you call ImGui_ImplOpenGL3_Init()?");
|
||||||
|
|
||||||
|
if (!bd->ShaderHandle)
|
||||||
|
ImGui_ImplOpenGL3_CreateDeviceObjects();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void ImGui_ImplOpenGL3_SetupRenderState(ImDrawData* draw_data, int fb_width, int fb_height, GLuint vertex_array_object)
|
||||||
|
{
|
||||||
|
ImGui_ImplOpenGL3_Data* bd = ImGui_ImplOpenGL3_GetBackendData();
|
||||||
|
|
||||||
|
// Setup render state: alpha-blending enabled, no face culling, no depth testing, scissor enabled, polygon fill
|
||||||
|
glEnable(GL_BLEND);
|
||||||
|
glBlendEquation(GL_FUNC_ADD);
|
||||||
|
glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
|
glDisable(GL_CULL_FACE);
|
||||||
|
glDisable(GL_DEPTH_TEST);
|
||||||
|
glDisable(GL_STENCIL_TEST);
|
||||||
|
glEnable(GL_SCISSOR_TEST);
|
||||||
|
#ifdef IMGUI_IMPL_OPENGL_MAY_HAVE_PRIMITIVE_RESTART
|
||||||
|
if (bd->GlVersion >= 310)
|
||||||
|
glDisable(GL_PRIMITIVE_RESTART);
|
||||||
|
#endif
|
||||||
|
#ifdef IMGUI_IMPL_HAS_POLYGON_MODE
|
||||||
|
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Support for GL 4.5 rarely used glClipControl(GL_UPPER_LEFT)
|
||||||
|
#if defined(GL_CLIP_ORIGIN)
|
||||||
|
bool clip_origin_lower_left = true;
|
||||||
|
if (bd->HasClipOrigin)
|
||||||
|
{
|
||||||
|
GLenum current_clip_origin = 0; glGetIntegerv(GL_CLIP_ORIGIN, (GLint*)¤t_clip_origin);
|
||||||
|
if (current_clip_origin == GL_UPPER_LEFT)
|
||||||
|
clip_origin_lower_left = false;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Setup viewport, orthographic projection matrix
|
||||||
|
// Our visible imgui space lies from draw_data->DisplayPos (top left) to draw_data->DisplayPos+data_data->DisplaySize (bottom right). DisplayPos is (0,0) for single viewport apps.
|
||||||
|
glViewport(0, 0, (GLsizei)fb_width, (GLsizei)fb_height);
|
||||||
|
float L = draw_data->DisplayPos.x;
|
||||||
|
float R = draw_data->DisplayPos.x + draw_data->DisplaySize.x;
|
||||||
|
float T = draw_data->DisplayPos.y;
|
||||||
|
float B = draw_data->DisplayPos.y + draw_data->DisplaySize.y;
|
||||||
|
#if defined(GL_CLIP_ORIGIN)
|
||||||
|
if (!clip_origin_lower_left) { float tmp = T; T = B; B = tmp; } // Swap top and bottom if origin is upper left
|
||||||
|
#endif
|
||||||
|
const float ortho_projection[4][4] =
|
||||||
|
{
|
||||||
|
{ 2.0f/(R-L), 0.0f, 0.0f, 0.0f },
|
||||||
|
{ 0.0f, 2.0f/(T-B), 0.0f, 0.0f },
|
||||||
|
{ 0.0f, 0.0f, -1.0f, 0.0f },
|
||||||
|
{ (R+L)/(L-R), (T+B)/(B-T), 0.0f, 1.0f },
|
||||||
|
};
|
||||||
|
glUseProgram(bd->ShaderHandle);
|
||||||
|
glUniform1i(bd->AttribLocationTex, 0);
|
||||||
|
glUniformMatrix4fv(bd->AttribLocationProjMtx, 1, GL_FALSE, &ortho_projection[0][0]);
|
||||||
|
|
||||||
|
#ifdef IMGUI_IMPL_OPENGL_MAY_HAVE_BIND_SAMPLER
|
||||||
|
if (bd->GlVersion >= 330)
|
||||||
|
glBindSampler(0, 0); // We use combined texture/sampler state. Applications using GL 3.3 may set that otherwise.
|
||||||
|
#endif
|
||||||
|
|
||||||
|
(void)vertex_array_object;
|
||||||
|
#ifdef IMGUI_IMPL_OPENGL_USE_VERTEX_ARRAY
|
||||||
|
glBindVertexArray(vertex_array_object);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Bind vertex/index buffers and setup attributes for ImDrawVert
|
||||||
|
glBindBuffer(GL_ARRAY_BUFFER, bd->VboHandle);
|
||||||
|
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, bd->ElementsHandle);
|
||||||
|
glEnableVertexAttribArray(bd->AttribLocationVtxPos);
|
||||||
|
glEnableVertexAttribArray(bd->AttribLocationVtxUV);
|
||||||
|
glEnableVertexAttribArray(bd->AttribLocationVtxColor);
|
||||||
|
glVertexAttribPointer(bd->AttribLocationVtxPos, 2, GL_FLOAT, GL_FALSE, sizeof(ImDrawVert), (GLvoid*)IM_OFFSETOF(ImDrawVert, pos));
|
||||||
|
glVertexAttribPointer(bd->AttribLocationVtxUV, 2, GL_FLOAT, GL_FALSE, sizeof(ImDrawVert), (GLvoid*)IM_OFFSETOF(ImDrawVert, uv));
|
||||||
|
glVertexAttribPointer(bd->AttribLocationVtxColor, 4, GL_UNSIGNED_BYTE, GL_TRUE, sizeof(ImDrawVert), (GLvoid*)IM_OFFSETOF(ImDrawVert, col));
|
||||||
|
}
|
||||||
|
|
||||||
|
// OpenGL3 Render function.
|
||||||
|
// Note that this implementation is little overcomplicated because we are saving/setting up/restoring every OpenGL state explicitly.
|
||||||
|
// This is in order to be able to run within an OpenGL engine that doesn't do so.
|
||||||
|
void ImGui_ImplOpenGL3_RenderDrawData(ImDrawData* draw_data)
|
||||||
|
{
|
||||||
|
// Avoid rendering when minimized, scale coordinates for retina displays (screen coordinates != framebuffer coordinates)
|
||||||
|
int fb_width = (int)(draw_data->DisplaySize.x * draw_data->FramebufferScale.x);
|
||||||
|
int fb_height = (int)(draw_data->DisplaySize.y * draw_data->FramebufferScale.y);
|
||||||
|
if (fb_width <= 0 || fb_height <= 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
ImGui_ImplOpenGL3_Data* bd = ImGui_ImplOpenGL3_GetBackendData();
|
||||||
|
|
||||||
|
// Backup GL state
|
||||||
|
GLenum last_active_texture; glGetIntegerv(GL_ACTIVE_TEXTURE, (GLint*)&last_active_texture);
|
||||||
|
glActiveTexture(GL_TEXTURE0);
|
||||||
|
GLuint last_program; glGetIntegerv(GL_CURRENT_PROGRAM, (GLint*)&last_program);
|
||||||
|
GLuint last_texture; glGetIntegerv(GL_TEXTURE_BINDING_2D, (GLint*)&last_texture);
|
||||||
|
#ifdef IMGUI_IMPL_OPENGL_MAY_HAVE_BIND_SAMPLER
|
||||||
|
GLuint last_sampler; if (bd->GlVersion >= 330) { glGetIntegerv(GL_SAMPLER_BINDING, (GLint*)&last_sampler); } else { last_sampler = 0; }
|
||||||
|
#endif
|
||||||
|
GLuint last_array_buffer; glGetIntegerv(GL_ARRAY_BUFFER_BINDING, (GLint*)&last_array_buffer);
|
||||||
|
#ifdef IMGUI_IMPL_OPENGL_USE_VERTEX_ARRAY
|
||||||
|
GLuint last_vertex_array_object; glGetIntegerv(GL_VERTEX_ARRAY_BINDING, (GLint*)&last_vertex_array_object);
|
||||||
|
#endif
|
||||||
|
#ifdef IMGUI_IMPL_HAS_POLYGON_MODE
|
||||||
|
GLint last_polygon_mode[2]; glGetIntegerv(GL_POLYGON_MODE, last_polygon_mode);
|
||||||
|
#endif
|
||||||
|
GLint last_viewport[4]; glGetIntegerv(GL_VIEWPORT, last_viewport);
|
||||||
|
GLint last_scissor_box[4]; glGetIntegerv(GL_SCISSOR_BOX, last_scissor_box);
|
||||||
|
GLenum last_blend_src_rgb; glGetIntegerv(GL_BLEND_SRC_RGB, (GLint*)&last_blend_src_rgb);
|
||||||
|
GLenum last_blend_dst_rgb; glGetIntegerv(GL_BLEND_DST_RGB, (GLint*)&last_blend_dst_rgb);
|
||||||
|
GLenum last_blend_src_alpha; glGetIntegerv(GL_BLEND_SRC_ALPHA, (GLint*)&last_blend_src_alpha);
|
||||||
|
GLenum last_blend_dst_alpha; glGetIntegerv(GL_BLEND_DST_ALPHA, (GLint*)&last_blend_dst_alpha);
|
||||||
|
GLenum last_blend_equation_rgb; glGetIntegerv(GL_BLEND_EQUATION_RGB, (GLint*)&last_blend_equation_rgb);
|
||||||
|
GLenum last_blend_equation_alpha; glGetIntegerv(GL_BLEND_EQUATION_ALPHA, (GLint*)&last_blend_equation_alpha);
|
||||||
|
GLboolean last_enable_blend = glIsEnabled(GL_BLEND);
|
||||||
|
GLboolean last_enable_cull_face = glIsEnabled(GL_CULL_FACE);
|
||||||
|
GLboolean last_enable_depth_test = glIsEnabled(GL_DEPTH_TEST);
|
||||||
|
GLboolean last_enable_stencil_test = glIsEnabled(GL_STENCIL_TEST);
|
||||||
|
GLboolean last_enable_scissor_test = glIsEnabled(GL_SCISSOR_TEST);
|
||||||
|
#ifdef IMGUI_IMPL_OPENGL_MAY_HAVE_PRIMITIVE_RESTART
|
||||||
|
GLboolean last_enable_primitive_restart = (bd->GlVersion >= 310) ? glIsEnabled(GL_PRIMITIVE_RESTART) : GL_FALSE;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Setup desired GL state
|
||||||
|
// Recreate the VAO every time (this is to easily allow multiple GL contexts to be rendered to. VAO are not shared among GL contexts)
|
||||||
|
// The renderer would actually work without any VAO bound, but then our VertexAttrib calls would overwrite the default one currently bound.
|
||||||
|
GLuint vertex_array_object = 0;
|
||||||
|
#ifdef IMGUI_IMPL_OPENGL_USE_VERTEX_ARRAY
|
||||||
|
glGenVertexArrays(1, &vertex_array_object);
|
||||||
|
#endif
|
||||||
|
ImGui_ImplOpenGL3_SetupRenderState(draw_data, fb_width, fb_height, vertex_array_object);
|
||||||
|
|
||||||
|
// Will project scissor/clipping rectangles into framebuffer space
|
||||||
|
ImVec2 clip_off = draw_data->DisplayPos; // (0,0) unless using multi-viewports
|
||||||
|
ImVec2 clip_scale = draw_data->FramebufferScale; // (1,1) unless using retina display which are often (2,2)
|
||||||
|
|
||||||
|
// Render command lists
|
||||||
|
for (int n = 0; n < draw_data->CmdListsCount; n++)
|
||||||
|
{
|
||||||
|
const ImDrawList* cmd_list = draw_data->CmdLists[n];
|
||||||
|
|
||||||
|
// Upload vertex/index buffers
|
||||||
|
GLsizeiptr vtx_buffer_size = (GLsizeiptr)cmd_list->VtxBuffer.Size * (int)sizeof(ImDrawVert);
|
||||||
|
GLsizeiptr idx_buffer_size = (GLsizeiptr)cmd_list->IdxBuffer.Size * (int)sizeof(ImDrawIdx);
|
||||||
|
if (bd->VertexBufferSize < vtx_buffer_size)
|
||||||
|
{
|
||||||
|
bd->VertexBufferSize = vtx_buffer_size;
|
||||||
|
glBufferData(GL_ARRAY_BUFFER, bd->VertexBufferSize, NULL, GL_STREAM_DRAW);
|
||||||
|
}
|
||||||
|
if (bd->IndexBufferSize < idx_buffer_size)
|
||||||
|
{
|
||||||
|
bd->IndexBufferSize = idx_buffer_size;
|
||||||
|
glBufferData(GL_ELEMENT_ARRAY_BUFFER, bd->IndexBufferSize, NULL, GL_STREAM_DRAW);
|
||||||
|
}
|
||||||
|
glBufferSubData(GL_ARRAY_BUFFER, 0, vtx_buffer_size, (const GLvoid*)cmd_list->VtxBuffer.Data);
|
||||||
|
glBufferSubData(GL_ELEMENT_ARRAY_BUFFER, 0, idx_buffer_size, (const GLvoid*)cmd_list->IdxBuffer.Data);
|
||||||
|
|
||||||
|
for (int cmd_i = 0; cmd_i < cmd_list->CmdBuffer.Size; cmd_i++)
|
||||||
|
{
|
||||||
|
const ImDrawCmd* pcmd = &cmd_list->CmdBuffer[cmd_i];
|
||||||
|
if (pcmd->UserCallback != NULL)
|
||||||
|
{
|
||||||
|
// User callback, registered via ImDrawList::AddCallback()
|
||||||
|
// (ImDrawCallback_ResetRenderState is a special callback value used by the user to request the renderer to reset render state.)
|
||||||
|
if (pcmd->UserCallback == ImDrawCallback_ResetRenderState)
|
||||||
|
ImGui_ImplOpenGL3_SetupRenderState(draw_data, fb_width, fb_height, vertex_array_object);
|
||||||
|
else
|
||||||
|
pcmd->UserCallback(cmd_list, pcmd);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Project scissor/clipping rectangles into framebuffer space
|
||||||
|
ImVec2 clip_min((pcmd->ClipRect.x - clip_off.x) * clip_scale.x, (pcmd->ClipRect.y - clip_off.y) * clip_scale.y);
|
||||||
|
ImVec2 clip_max((pcmd->ClipRect.z - clip_off.x) * clip_scale.x, (pcmd->ClipRect.w - clip_off.y) * clip_scale.y);
|
||||||
|
if (clip_max.x <= clip_min.x || clip_max.y <= clip_min.y)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
// Apply scissor/clipping rectangle (Y is inverted in OpenGL)
|
||||||
|
glScissor((int)clip_min.x, (int)(fb_height - clip_max.y), (int)(clip_max.x - clip_min.x), (int)(clip_max.y - clip_min.y));
|
||||||
|
|
||||||
|
// Bind texture, Draw
|
||||||
|
glBindTexture(GL_TEXTURE_2D, (GLuint)(intptr_t)pcmd->GetTexID());
|
||||||
|
#ifdef IMGUI_IMPL_OPENGL_MAY_HAVE_VTX_OFFSET
|
||||||
|
if (bd->GlVersion >= 320)
|
||||||
|
glDrawElementsBaseVertex(GL_TRIANGLES, (GLsizei)pcmd->ElemCount, sizeof(ImDrawIdx) == 2 ? GL_UNSIGNED_SHORT : GL_UNSIGNED_INT, (void*)(intptr_t)(pcmd->IdxOffset * sizeof(ImDrawIdx)), (GLint)pcmd->VtxOffset);
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
glDrawElements(GL_TRIANGLES, (GLsizei)pcmd->ElemCount, sizeof(ImDrawIdx) == 2 ? GL_UNSIGNED_SHORT : GL_UNSIGNED_INT, (void*)(intptr_t)(pcmd->IdxOffset * sizeof(ImDrawIdx)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Destroy the temporary VAO
|
||||||
|
#ifdef IMGUI_IMPL_OPENGL_USE_VERTEX_ARRAY
|
||||||
|
glDeleteVertexArrays(1, &vertex_array_object);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Restore modified GL state
|
||||||
|
glUseProgram(last_program);
|
||||||
|
glBindTexture(GL_TEXTURE_2D, last_texture);
|
||||||
|
#ifdef IMGUI_IMPL_OPENGL_MAY_HAVE_BIND_SAMPLER
|
||||||
|
if (bd->GlVersion >= 330)
|
||||||
|
glBindSampler(0, last_sampler);
|
||||||
|
#endif
|
||||||
|
glActiveTexture(last_active_texture);
|
||||||
|
#ifdef IMGUI_IMPL_OPENGL_USE_VERTEX_ARRAY
|
||||||
|
glBindVertexArray(last_vertex_array_object);
|
||||||
|
#endif
|
||||||
|
glBindBuffer(GL_ARRAY_BUFFER, last_array_buffer);
|
||||||
|
glBlendEquationSeparate(last_blend_equation_rgb, last_blend_equation_alpha);
|
||||||
|
glBlendFuncSeparate(last_blend_src_rgb, last_blend_dst_rgb, last_blend_src_alpha, last_blend_dst_alpha);
|
||||||
|
if (last_enable_blend) glEnable(GL_BLEND); else glDisable(GL_BLEND);
|
||||||
|
if (last_enable_cull_face) glEnable(GL_CULL_FACE); else glDisable(GL_CULL_FACE);
|
||||||
|
if (last_enable_depth_test) glEnable(GL_DEPTH_TEST); else glDisable(GL_DEPTH_TEST);
|
||||||
|
if (last_enable_stencil_test) glEnable(GL_STENCIL_TEST); else glDisable(GL_STENCIL_TEST);
|
||||||
|
if (last_enable_scissor_test) glEnable(GL_SCISSOR_TEST); else glDisable(GL_SCISSOR_TEST);
|
||||||
|
#ifdef IMGUI_IMPL_OPENGL_MAY_HAVE_PRIMITIVE_RESTART
|
||||||
|
if (bd->GlVersion >= 310) { if (last_enable_primitive_restart) glEnable(GL_PRIMITIVE_RESTART); else glDisable(GL_PRIMITIVE_RESTART); }
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef IMGUI_IMPL_HAS_POLYGON_MODE
|
||||||
|
glPolygonMode(GL_FRONT_AND_BACK, (GLenum)last_polygon_mode[0]);
|
||||||
|
#endif
|
||||||
|
glViewport(last_viewport[0], last_viewport[1], (GLsizei)last_viewport[2], (GLsizei)last_viewport[3]);
|
||||||
|
glScissor(last_scissor_box[0], last_scissor_box[1], (GLsizei)last_scissor_box[2], (GLsizei)last_scissor_box[3]);
|
||||||
|
(void)bd; // Not all compilation paths use this
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ImGui_ImplOpenGL3_CreateFontsTexture()
|
||||||
|
{
|
||||||
|
ImGuiIO& io = ImGui::GetIO();
|
||||||
|
ImGui_ImplOpenGL3_Data* bd = ImGui_ImplOpenGL3_GetBackendData();
|
||||||
|
|
||||||
|
// Build texture atlas
|
||||||
|
unsigned char* pixels;
|
||||||
|
int width, height;
|
||||||
|
io.Fonts->GetTexDataAsRGBA32(&pixels, &width, &height); // Load as RGBA 32-bit (75% of the memory is wasted, but default font is so small) because it is more likely to be compatible with user's existing shaders. If your ImTextureId represent a higher-level concept than just a GL texture id, consider calling GetTexDataAsAlpha8() instead to save on GPU memory.
|
||||||
|
|
||||||
|
// Upload texture to graphics system
|
||||||
|
GLint last_texture;
|
||||||
|
glGetIntegerv(GL_TEXTURE_BINDING_2D, &last_texture);
|
||||||
|
glGenTextures(1, &bd->FontTexture);
|
||||||
|
glBindTexture(GL_TEXTURE_2D, bd->FontTexture);
|
||||||
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||||
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||||
|
#ifdef GL_UNPACK_ROW_LENGTH // Not on WebGL/ES
|
||||||
|
glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
|
||||||
|
#endif
|
||||||
|
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, pixels);
|
||||||
|
|
||||||
|
// Store our identifier
|
||||||
|
io.Fonts->SetTexID((ImTextureID)(intptr_t)bd->FontTexture);
|
||||||
|
|
||||||
|
// Restore state
|
||||||
|
glBindTexture(GL_TEXTURE_2D, last_texture);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ImGui_ImplOpenGL3_DestroyFontsTexture()
|
||||||
|
{
|
||||||
|
ImGuiIO& io = ImGui::GetIO();
|
||||||
|
ImGui_ImplOpenGL3_Data* bd = ImGui_ImplOpenGL3_GetBackendData();
|
||||||
|
if (bd->FontTexture)
|
||||||
|
{
|
||||||
|
glDeleteTextures(1, &bd->FontTexture);
|
||||||
|
io.Fonts->SetTexID(0);
|
||||||
|
bd->FontTexture = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// If you get an error please report on github. You may try different GL context version or GLSL version. See GL<>GLSL version table at the top of this file.
|
||||||
|
static bool CheckShader(GLuint handle, const char* desc)
|
||||||
|
{
|
||||||
|
ImGui_ImplOpenGL3_Data* bd = ImGui_ImplOpenGL3_GetBackendData();
|
||||||
|
GLint status = 0, log_length = 0;
|
||||||
|
glGetShaderiv(handle, GL_COMPILE_STATUS, &status);
|
||||||
|
glGetShaderiv(handle, GL_INFO_LOG_LENGTH, &log_length);
|
||||||
|
if ((GLboolean)status == GL_FALSE)
|
||||||
|
fprintf(stderr, "ERROR: ImGui_ImplOpenGL3_CreateDeviceObjects: failed to compile %s! With GLSL: %s\n", desc, bd->GlslVersionString);
|
||||||
|
if (log_length > 1)
|
||||||
|
{
|
||||||
|
ImVector<char> buf;
|
||||||
|
buf.resize((int)(log_length + 1));
|
||||||
|
glGetShaderInfoLog(handle, log_length, NULL, (GLchar*)buf.begin());
|
||||||
|
fprintf(stderr, "%s\n", buf.begin());
|
||||||
|
}
|
||||||
|
return (GLboolean)status == GL_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If you get an error please report on GitHub. You may try different GL context version or GLSL version.
|
||||||
|
static bool CheckProgram(GLuint handle, const char* desc)
|
||||||
|
{
|
||||||
|
ImGui_ImplOpenGL3_Data* bd = ImGui_ImplOpenGL3_GetBackendData();
|
||||||
|
GLint status = 0, log_length = 0;
|
||||||
|
glGetProgramiv(handle, GL_LINK_STATUS, &status);
|
||||||
|
glGetProgramiv(handle, GL_INFO_LOG_LENGTH, &log_length);
|
||||||
|
if ((GLboolean)status == GL_FALSE)
|
||||||
|
fprintf(stderr, "ERROR: ImGui_ImplOpenGL3_CreateDeviceObjects: failed to link %s! With GLSL %s\n", desc, bd->GlslVersionString);
|
||||||
|
if (log_length > 1)
|
||||||
|
{
|
||||||
|
ImVector<char> buf;
|
||||||
|
buf.resize((int)(log_length + 1));
|
||||||
|
glGetProgramInfoLog(handle, log_length, NULL, (GLchar*)buf.begin());
|
||||||
|
fprintf(stderr, "%s\n", buf.begin());
|
||||||
|
}
|
||||||
|
return (GLboolean)status == GL_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ImGui_ImplOpenGL3_CreateDeviceObjects()
|
||||||
|
{
|
||||||
|
ImGui_ImplOpenGL3_Data* bd = ImGui_ImplOpenGL3_GetBackendData();
|
||||||
|
|
||||||
|
// Backup GL state
|
||||||
|
GLint last_texture, last_array_buffer;
|
||||||
|
glGetIntegerv(GL_TEXTURE_BINDING_2D, &last_texture);
|
||||||
|
glGetIntegerv(GL_ARRAY_BUFFER_BINDING, &last_array_buffer);
|
||||||
|
#ifdef IMGUI_IMPL_OPENGL_USE_VERTEX_ARRAY
|
||||||
|
GLint last_vertex_array;
|
||||||
|
glGetIntegerv(GL_VERTEX_ARRAY_BINDING, &last_vertex_array);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Parse GLSL version string
|
||||||
|
int glsl_version = 130;
|
||||||
|
sscanf(bd->GlslVersionString, "#version %d", &glsl_version);
|
||||||
|
|
||||||
|
const GLchar* vertex_shader_glsl_120 =
|
||||||
|
"uniform mat4 ProjMtx;\n"
|
||||||
|
"attribute vec2 Position;\n"
|
||||||
|
"attribute vec2 UV;\n"
|
||||||
|
"attribute vec4 Color;\n"
|
||||||
|
"varying vec2 Frag_UV;\n"
|
||||||
|
"varying vec4 Frag_Color;\n"
|
||||||
|
"void main()\n"
|
||||||
|
"{\n"
|
||||||
|
" Frag_UV = UV;\n"
|
||||||
|
" Frag_Color = Color;\n"
|
||||||
|
" gl_Position = ProjMtx * vec4(Position.xy,0,1);\n"
|
||||||
|
"}\n";
|
||||||
|
|
||||||
|
const GLchar* vertex_shader_glsl_130 =
|
||||||
|
"uniform mat4 ProjMtx;\n"
|
||||||
|
"in vec2 Position;\n"
|
||||||
|
"in vec2 UV;\n"
|
||||||
|
"in vec4 Color;\n"
|
||||||
|
"out vec2 Frag_UV;\n"
|
||||||
|
"out vec4 Frag_Color;\n"
|
||||||
|
"void main()\n"
|
||||||
|
"{\n"
|
||||||
|
" Frag_UV = UV;\n"
|
||||||
|
" Frag_Color = Color;\n"
|
||||||
|
" gl_Position = ProjMtx * vec4(Position.xy,0,1);\n"
|
||||||
|
"}\n";
|
||||||
|
|
||||||
|
const GLchar* vertex_shader_glsl_300_es =
|
||||||
|
"precision highp float;\n"
|
||||||
|
"layout (location = 0) in vec2 Position;\n"
|
||||||
|
"layout (location = 1) in vec2 UV;\n"
|
||||||
|
"layout (location = 2) in vec4 Color;\n"
|
||||||
|
"uniform mat4 ProjMtx;\n"
|
||||||
|
"out vec2 Frag_UV;\n"
|
||||||
|
"out vec4 Frag_Color;\n"
|
||||||
|
"void main()\n"
|
||||||
|
"{\n"
|
||||||
|
" Frag_UV = UV;\n"
|
||||||
|
" Frag_Color = Color;\n"
|
||||||
|
" gl_Position = ProjMtx * vec4(Position.xy,0,1);\n"
|
||||||
|
"}\n";
|
||||||
|
|
||||||
|
const GLchar* vertex_shader_glsl_410_core =
|
||||||
|
"layout (location = 0) in vec2 Position;\n"
|
||||||
|
"layout (location = 1) in vec2 UV;\n"
|
||||||
|
"layout (location = 2) in vec4 Color;\n"
|
||||||
|
"uniform mat4 ProjMtx;\n"
|
||||||
|
"out vec2 Frag_UV;\n"
|
||||||
|
"out vec4 Frag_Color;\n"
|
||||||
|
"void main()\n"
|
||||||
|
"{\n"
|
||||||
|
" Frag_UV = UV;\n"
|
||||||
|
" Frag_Color = Color;\n"
|
||||||
|
" gl_Position = ProjMtx * vec4(Position.xy,0,1);\n"
|
||||||
|
"}\n";
|
||||||
|
|
||||||
|
const GLchar* fragment_shader_glsl_120 =
|
||||||
|
"#ifdef GL_ES\n"
|
||||||
|
" precision mediump float;\n"
|
||||||
|
"#endif\n"
|
||||||
|
"uniform sampler2D Texture;\n"
|
||||||
|
"varying vec2 Frag_UV;\n"
|
||||||
|
"varying vec4 Frag_Color;\n"
|
||||||
|
"void main()\n"
|
||||||
|
"{\n"
|
||||||
|
" gl_FragColor = Frag_Color * texture2D(Texture, Frag_UV.st);\n"
|
||||||
|
"}\n";
|
||||||
|
|
||||||
|
const GLchar* fragment_shader_glsl_130 =
|
||||||
|
"uniform sampler2D Texture;\n"
|
||||||
|
"in vec2 Frag_UV;\n"
|
||||||
|
"in vec4 Frag_Color;\n"
|
||||||
|
"out vec4 Out_Color;\n"
|
||||||
|
"void main()\n"
|
||||||
|
"{\n"
|
||||||
|
" Out_Color = Frag_Color * texture(Texture, Frag_UV.st);\n"
|
||||||
|
"}\n";
|
||||||
|
|
||||||
|
const GLchar* fragment_shader_glsl_300_es =
|
||||||
|
"precision mediump float;\n"
|
||||||
|
"uniform sampler2D Texture;\n"
|
||||||
|
"in vec2 Frag_UV;\n"
|
||||||
|
"in vec4 Frag_Color;\n"
|
||||||
|
"layout (location = 0) out vec4 Out_Color;\n"
|
||||||
|
"void main()\n"
|
||||||
|
"{\n"
|
||||||
|
" Out_Color = Frag_Color * texture(Texture, Frag_UV.st);\n"
|
||||||
|
"}\n";
|
||||||
|
|
||||||
|
const GLchar* fragment_shader_glsl_410_core =
|
||||||
|
"in vec2 Frag_UV;\n"
|
||||||
|
"in vec4 Frag_Color;\n"
|
||||||
|
"uniform sampler2D Texture;\n"
|
||||||
|
"layout (location = 0) out vec4 Out_Color;\n"
|
||||||
|
"void main()\n"
|
||||||
|
"{\n"
|
||||||
|
" Out_Color = Frag_Color * texture(Texture, Frag_UV.st);\n"
|
||||||
|
"}\n";
|
||||||
|
|
||||||
|
// Select shaders matching our GLSL versions
|
||||||
|
const GLchar* vertex_shader = NULL;
|
||||||
|
const GLchar* fragment_shader = NULL;
|
||||||
|
if (glsl_version < 130)
|
||||||
|
{
|
||||||
|
vertex_shader = vertex_shader_glsl_120;
|
||||||
|
fragment_shader = fragment_shader_glsl_120;
|
||||||
|
}
|
||||||
|
else if (glsl_version >= 410)
|
||||||
|
{
|
||||||
|
vertex_shader = vertex_shader_glsl_410_core;
|
||||||
|
fragment_shader = fragment_shader_glsl_410_core;
|
||||||
|
}
|
||||||
|
else if (glsl_version == 300)
|
||||||
|
{
|
||||||
|
vertex_shader = vertex_shader_glsl_300_es;
|
||||||
|
fragment_shader = fragment_shader_glsl_300_es;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
vertex_shader = vertex_shader_glsl_130;
|
||||||
|
fragment_shader = fragment_shader_glsl_130;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create shaders
|
||||||
|
const GLchar* vertex_shader_with_version[2] = { bd->GlslVersionString, vertex_shader };
|
||||||
|
GLuint vert_handle = glCreateShader(GL_VERTEX_SHADER);
|
||||||
|
glShaderSource(vert_handle, 2, vertex_shader_with_version, NULL);
|
||||||
|
glCompileShader(vert_handle);
|
||||||
|
CheckShader(vert_handle, "vertex shader");
|
||||||
|
|
||||||
|
const GLchar* fragment_shader_with_version[2] = { bd->GlslVersionString, fragment_shader };
|
||||||
|
GLuint frag_handle = glCreateShader(GL_FRAGMENT_SHADER);
|
||||||
|
glShaderSource(frag_handle, 2, fragment_shader_with_version, NULL);
|
||||||
|
glCompileShader(frag_handle);
|
||||||
|
CheckShader(frag_handle, "fragment shader");
|
||||||
|
|
||||||
|
// Link
|
||||||
|
bd->ShaderHandle = glCreateProgram();
|
||||||
|
glAttachShader(bd->ShaderHandle, vert_handle);
|
||||||
|
glAttachShader(bd->ShaderHandle, frag_handle);
|
||||||
|
glLinkProgram(bd->ShaderHandle);
|
||||||
|
CheckProgram(bd->ShaderHandle, "shader program");
|
||||||
|
|
||||||
|
glDetachShader(bd->ShaderHandle, vert_handle);
|
||||||
|
glDetachShader(bd->ShaderHandle, frag_handle);
|
||||||
|
glDeleteShader(vert_handle);
|
||||||
|
glDeleteShader(frag_handle);
|
||||||
|
|
||||||
|
bd->AttribLocationTex = glGetUniformLocation(bd->ShaderHandle, "Texture");
|
||||||
|
bd->AttribLocationProjMtx = glGetUniformLocation(bd->ShaderHandle, "ProjMtx");
|
||||||
|
bd->AttribLocationVtxPos = (GLuint)glGetAttribLocation(bd->ShaderHandle, "Position");
|
||||||
|
bd->AttribLocationVtxUV = (GLuint)glGetAttribLocation(bd->ShaderHandle, "UV");
|
||||||
|
bd->AttribLocationVtxColor = (GLuint)glGetAttribLocation(bd->ShaderHandle, "Color");
|
||||||
|
|
||||||
|
// Create buffers
|
||||||
|
glGenBuffers(1, &bd->VboHandle);
|
||||||
|
glGenBuffers(1, &bd->ElementsHandle);
|
||||||
|
|
||||||
|
ImGui_ImplOpenGL3_CreateFontsTexture();
|
||||||
|
|
||||||
|
// Restore modified GL state
|
||||||
|
glBindTexture(GL_TEXTURE_2D, last_texture);
|
||||||
|
glBindBuffer(GL_ARRAY_BUFFER, last_array_buffer);
|
||||||
|
#ifdef IMGUI_IMPL_OPENGL_USE_VERTEX_ARRAY
|
||||||
|
glBindVertexArray(last_vertex_array);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ImGui_ImplOpenGL3_DestroyDeviceObjects()
|
||||||
|
{
|
||||||
|
ImGui_ImplOpenGL3_Data* bd = ImGui_ImplOpenGL3_GetBackendData();
|
||||||
|
if (bd->VboHandle) { glDeleteBuffers(1, &bd->VboHandle); bd->VboHandle = 0; }
|
||||||
|
if (bd->ElementsHandle) { glDeleteBuffers(1, &bd->ElementsHandle); bd->ElementsHandle = 0; }
|
||||||
|
if (bd->ShaderHandle) { glDeleteProgram(bd->ShaderHandle); bd->ShaderHandle = 0; }
|
||||||
|
ImGui_ImplOpenGL3_DestroyFontsTexture();
|
||||||
|
}
|
||||||
+55
@@ -0,0 +1,55 @@
|
|||||||
|
// dear imgui: Renderer Backend for modern OpenGL with shaders / programmatic pipeline
|
||||||
|
// - Desktop GL: 2.x 3.x 4.x
|
||||||
|
// - Embedded GL: ES 2.0 (WebGL 1.0), ES 3.0 (WebGL 2.0)
|
||||||
|
// This needs to be used along with a Platform Backend (e.g. GLFW, SDL, Win32, custom..)
|
||||||
|
|
||||||
|
// Implemented features:
|
||||||
|
// [X] Renderer: User texture binding. Use 'GLuint' OpenGL texture identifier as void*/ImTextureID. Read the FAQ about ImTextureID!
|
||||||
|
// [x] Renderer: Desktop GL only: Support for large meshes (64k+ vertices) with 16-bit indices.
|
||||||
|
|
||||||
|
// You can use unmodified imgui_impl_* files in your project. See examples/ folder for examples of using this.
|
||||||
|
// Prefer including the entire imgui/ repository into your project (either as a copy or as a submodule), and only build the backends you need.
|
||||||
|
// If you are new to Dear ImGui, read documentation from the docs/ folder + read the top of imgui.cpp.
|
||||||
|
// Read online: https://github.com/ocornut/imgui/tree/master/docs
|
||||||
|
|
||||||
|
// About GLSL version:
|
||||||
|
// The 'glsl_version' initialization parameter should be NULL (default) or a "#version XXX" string.
|
||||||
|
// On computer platform the GLSL version default to "#version 130". On OpenGL ES 3 platform it defaults to "#version 300 es"
|
||||||
|
// Only override if your GL version doesn't handle this GLSL version. See GLSL version table at the top of imgui_impl_opengl3.cpp.
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
#include "imgui.h" // IMGUI_IMPL_API
|
||||||
|
|
||||||
|
// Backend API
|
||||||
|
IMGUI_IMPL_API bool ImGui_ImplOpenGL3_Init(const char* glsl_version = NULL);
|
||||||
|
IMGUI_IMPL_API void ImGui_ImplOpenGL3_Shutdown();
|
||||||
|
IMGUI_IMPL_API void ImGui_ImplOpenGL3_NewFrame();
|
||||||
|
IMGUI_IMPL_API void ImGui_ImplOpenGL3_RenderDrawData(ImDrawData* draw_data);
|
||||||
|
|
||||||
|
// (Optional) Called by Init/NewFrame/Shutdown
|
||||||
|
IMGUI_IMPL_API bool ImGui_ImplOpenGL3_CreateFontsTexture();
|
||||||
|
IMGUI_IMPL_API void ImGui_ImplOpenGL3_DestroyFontsTexture();
|
||||||
|
IMGUI_IMPL_API bool ImGui_ImplOpenGL3_CreateDeviceObjects();
|
||||||
|
IMGUI_IMPL_API void ImGui_ImplOpenGL3_DestroyDeviceObjects();
|
||||||
|
|
||||||
|
// Specific OpenGL ES versions
|
||||||
|
//#define IMGUI_IMPL_OPENGL_ES2 // Auto-detected on Emscripten
|
||||||
|
//#define IMGUI_IMPL_OPENGL_ES3 // Auto-detected on iOS/Android
|
||||||
|
|
||||||
|
// You can explicitly select GLES2 or GLES3 API by using one of the '#define IMGUI_IMPL_OPENGL_LOADER_XXX' in imconfig.h or compiler command-line.
|
||||||
|
#if !defined(IMGUI_IMPL_OPENGL_ES2) \
|
||||||
|
&& !defined(IMGUI_IMPL_OPENGL_ES3)
|
||||||
|
|
||||||
|
// Try to detect GLES on matching platforms
|
||||||
|
#if defined(__APPLE__)
|
||||||
|
#include <TargetConditionals.h>
|
||||||
|
#endif
|
||||||
|
#if (defined(__APPLE__) && (TARGET_OS_IOS || TARGET_OS_TV)) || (defined(__ANDROID__))
|
||||||
|
#define IMGUI_IMPL_OPENGL_ES3 // iOS, Android -> GL ES 3, "#version 300 es"
|
||||||
|
#elif defined(__EMSCRIPTEN__)
|
||||||
|
#define IMGUI_IMPL_OPENGL_ES2 // Emscripten -> GL ES 2, "#version 100"
|
||||||
|
#else
|
||||||
|
// Otherwise imgui_impl_opengl3_loader.h will be used.
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
+757
@@ -0,0 +1,757 @@
|
|||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// About imgui_impl_opengl3_loader.h:
|
||||||
|
//
|
||||||
|
// We embed our own OpenGL loader to not require user to provide their own or to have to use ours,
|
||||||
|
// which proved to be endless problems for users.
|
||||||
|
// Our loader is custom-generated, based on gl3w but automatically filtered to only include
|
||||||
|
// enums/functions that we use in our imgui_impl_opengl3.cpp source file in order to be small.
|
||||||
|
//
|
||||||
|
// YOU SHOULD NOT NEED TO INCLUDE/USE THIS DIRECTLY. THIS IS USED BY imgui_impl_opengl3.cpp ONLY.
|
||||||
|
// THE REST OF YOUR APP SHOULD USE A DIFFERENT GL LOADER: ANY GL LOADER OF YOUR CHOICE.
|
||||||
|
//
|
||||||
|
// Regenerate with:
|
||||||
|
// python gl3w_gen.py --output ../imgui/backends/imgui_impl_opengl3_loader.h --ref ../imgui/backends/imgui_impl_opengl3.cpp ./extra_symbols.txt
|
||||||
|
//
|
||||||
|
// More info:
|
||||||
|
// https://github.com/dearimgui/gl3w_stripped
|
||||||
|
// https://github.com/ocornut/imgui/issues/4445
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file was generated with gl3w_gen.py, part of imgl3w
|
||||||
|
* (hosted at https://github.com/dearimgui/gl3w_stripped)
|
||||||
|
*
|
||||||
|
* This is free and unencumbered software released into the public domain.
|
||||||
|
*
|
||||||
|
* Anyone is free to copy, modify, publish, use, compile, sell, or
|
||||||
|
* distribute this software, either in source code form or as a compiled
|
||||||
|
* binary, for any purpose, commercial or non-commercial, and by any
|
||||||
|
* means.
|
||||||
|
*
|
||||||
|
* In jurisdictions that recognize copyright laws, the author or authors
|
||||||
|
* of this software dedicate any and all copyright interest in the
|
||||||
|
* software to the public domain. We make this dedication for the benefit
|
||||||
|
* of the public at large and to the detriment of our heirs and
|
||||||
|
* successors. We intend this dedication to be an overt act of
|
||||||
|
* relinquishment in perpetuity of all present and future rights to this
|
||||||
|
* software under copyright law.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||||
|
* IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||||
|
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||||
|
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||||
|
* OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __gl3w_h_
|
||||||
|
#define __gl3w_h_
|
||||||
|
|
||||||
|
// Adapted from KHR/khrplatform.h to avoid including entire file.
|
||||||
|
#ifndef __khrplatform_h_
|
||||||
|
typedef float khronos_float_t;
|
||||||
|
typedef signed char khronos_int8_t;
|
||||||
|
typedef unsigned char khronos_uint8_t;
|
||||||
|
typedef signed short int khronos_int16_t;
|
||||||
|
typedef unsigned short int khronos_uint16_t;
|
||||||
|
#ifdef _WIN64
|
||||||
|
typedef signed long long int khronos_intptr_t;
|
||||||
|
typedef signed long long int khronos_ssize_t;
|
||||||
|
#else
|
||||||
|
typedef signed long int khronos_intptr_t;
|
||||||
|
typedef signed long int khronos_ssize_t;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(_MSC_VER) && !defined(__clang__)
|
||||||
|
typedef signed __int64 khronos_int64_t;
|
||||||
|
typedef unsigned __int64 khronos_uint64_t;
|
||||||
|
#elif (defined(__clang__) || defined(__GNUC__)) && (__cplusplus < 201100)
|
||||||
|
#include <stdint.h>
|
||||||
|
typedef int64_t khronos_int64_t;
|
||||||
|
typedef uint64_t khronos_uint64_t;
|
||||||
|
#else
|
||||||
|
typedef signed long long khronos_int64_t;
|
||||||
|
typedef unsigned long long khronos_uint64_t;
|
||||||
|
#endif
|
||||||
|
#endif // __khrplatform_h_
|
||||||
|
|
||||||
|
#ifndef __gl_glcorearb_h_
|
||||||
|
#define __gl_glcorearb_h_ 1
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
/*
|
||||||
|
** Copyright 2013-2020 The Khronos Group Inc.
|
||||||
|
** SPDX-License-Identifier: MIT
|
||||||
|
**
|
||||||
|
** This header is generated from the Khronos OpenGL / OpenGL ES XML
|
||||||
|
** API Registry. The current version of the Registry, generator scripts
|
||||||
|
** used to make the header, and the header can be found at
|
||||||
|
** https://github.com/KhronosGroup/OpenGL-Registry
|
||||||
|
*/
|
||||||
|
#if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__)
|
||||||
|
#ifndef WIN32_LEAN_AND_MEAN
|
||||||
|
#define WIN32_LEAN_AND_MEAN 1
|
||||||
|
#endif
|
||||||
|
#include <windows.h>
|
||||||
|
#endif
|
||||||
|
#ifndef APIENTRY
|
||||||
|
#define APIENTRY
|
||||||
|
#endif
|
||||||
|
#ifndef APIENTRYP
|
||||||
|
#define APIENTRYP APIENTRY *
|
||||||
|
#endif
|
||||||
|
#ifndef GLAPI
|
||||||
|
#define GLAPI extern
|
||||||
|
#endif
|
||||||
|
/* glcorearb.h is for use with OpenGL core profile implementations.
|
||||||
|
** It should should be placed in the same directory as gl.h and
|
||||||
|
** included as <GL/glcorearb.h>.
|
||||||
|
**
|
||||||
|
** glcorearb.h includes only APIs in the latest OpenGL core profile
|
||||||
|
** implementation together with APIs in newer ARB extensions which
|
||||||
|
** can be supported by the core profile. It does not, and never will
|
||||||
|
** include functionality removed from the core profile, such as
|
||||||
|
** fixed-function vertex and fragment processing.
|
||||||
|
**
|
||||||
|
** Do not #include both <GL/glcorearb.h> and either of <GL/gl.h> or
|
||||||
|
** <GL/glext.h> in the same source file.
|
||||||
|
*/
|
||||||
|
/* Generated C header for:
|
||||||
|
* API: gl
|
||||||
|
* Profile: core
|
||||||
|
* Versions considered: .*
|
||||||
|
* Versions emitted: .*
|
||||||
|
* Default extensions included: glcore
|
||||||
|
* Additional extensions included: _nomatch_^
|
||||||
|
* Extensions removed: _nomatch_^
|
||||||
|
*/
|
||||||
|
#ifndef GL_VERSION_1_0
|
||||||
|
typedef void GLvoid;
|
||||||
|
typedef unsigned int GLenum;
|
||||||
|
|
||||||
|
typedef khronos_float_t GLfloat;
|
||||||
|
typedef int GLint;
|
||||||
|
typedef int GLsizei;
|
||||||
|
typedef unsigned int GLbitfield;
|
||||||
|
typedef double GLdouble;
|
||||||
|
typedef unsigned int GLuint;
|
||||||
|
typedef unsigned char GLboolean;
|
||||||
|
typedef khronos_uint8_t GLubyte;
|
||||||
|
#define GL_COLOR_BUFFER_BIT 0x00004000
|
||||||
|
#define GL_FALSE 0
|
||||||
|
#define GL_TRUE 1
|
||||||
|
#define GL_TRIANGLES 0x0004
|
||||||
|
#define GL_ONE 1
|
||||||
|
#define GL_SRC_ALPHA 0x0302
|
||||||
|
#define GL_ONE_MINUS_SRC_ALPHA 0x0303
|
||||||
|
#define GL_FRONT_AND_BACK 0x0408
|
||||||
|
#define GL_POLYGON_MODE 0x0B40
|
||||||
|
#define GL_CULL_FACE 0x0B44
|
||||||
|
#define GL_DEPTH_TEST 0x0B71
|
||||||
|
#define GL_STENCIL_TEST 0x0B90
|
||||||
|
#define GL_VIEWPORT 0x0BA2
|
||||||
|
#define GL_BLEND 0x0BE2
|
||||||
|
#define GL_SCISSOR_BOX 0x0C10
|
||||||
|
#define GL_SCISSOR_TEST 0x0C11
|
||||||
|
#define GL_UNPACK_ROW_LENGTH 0x0CF2
|
||||||
|
#define GL_PACK_ALIGNMENT 0x0D05
|
||||||
|
#define GL_TEXTURE_2D 0x0DE1
|
||||||
|
#define GL_UNSIGNED_BYTE 0x1401
|
||||||
|
#define GL_UNSIGNED_SHORT 0x1403
|
||||||
|
#define GL_UNSIGNED_INT 0x1405
|
||||||
|
#define GL_FLOAT 0x1406
|
||||||
|
#define GL_RGBA 0x1908
|
||||||
|
#define GL_FILL 0x1B02
|
||||||
|
#define GL_VERSION 0x1F02
|
||||||
|
#define GL_EXTENSIONS 0x1F03
|
||||||
|
#define GL_LINEAR 0x2601
|
||||||
|
#define GL_TEXTURE_MAG_FILTER 0x2800
|
||||||
|
#define GL_TEXTURE_MIN_FILTER 0x2801
|
||||||
|
typedef void (APIENTRYP PFNGLPOLYGONMODEPROC) (GLenum face, GLenum mode);
|
||||||
|
typedef void (APIENTRYP PFNGLSCISSORPROC) (GLint x, GLint y, GLsizei width, GLsizei height);
|
||||||
|
typedef void (APIENTRYP PFNGLTEXPARAMETERIPROC) (GLenum target, GLenum pname, GLint param);
|
||||||
|
typedef void (APIENTRYP PFNGLTEXIMAGE2DPROC) (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void *pixels);
|
||||||
|
typedef void (APIENTRYP PFNGLCLEARPROC) (GLbitfield mask);
|
||||||
|
typedef void (APIENTRYP PFNGLCLEARCOLORPROC) (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
|
||||||
|
typedef void (APIENTRYP PFNGLDISABLEPROC) (GLenum cap);
|
||||||
|
typedef void (APIENTRYP PFNGLENABLEPROC) (GLenum cap);
|
||||||
|
typedef void (APIENTRYP PFNGLPIXELSTOREIPROC) (GLenum pname, GLint param);
|
||||||
|
typedef void (APIENTRYP PFNGLREADPIXELSPROC) (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void *pixels);
|
||||||
|
typedef GLenum (APIENTRYP PFNGLGETERRORPROC) (void);
|
||||||
|
typedef void (APIENTRYP PFNGLGETINTEGERVPROC) (GLenum pname, GLint *data);
|
||||||
|
typedef const GLubyte *(APIENTRYP PFNGLGETSTRINGPROC) (GLenum name);
|
||||||
|
typedef GLboolean (APIENTRYP PFNGLISENABLEDPROC) (GLenum cap);
|
||||||
|
typedef void (APIENTRYP PFNGLVIEWPORTPROC) (GLint x, GLint y, GLsizei width, GLsizei height);
|
||||||
|
#ifdef GL_GLEXT_PROTOTYPES
|
||||||
|
GLAPI void APIENTRY glPolygonMode (GLenum face, GLenum mode);
|
||||||
|
GLAPI void APIENTRY glScissor (GLint x, GLint y, GLsizei width, GLsizei height);
|
||||||
|
GLAPI void APIENTRY glTexParameteri (GLenum target, GLenum pname, GLint param);
|
||||||
|
GLAPI void APIENTRY glTexImage2D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void *pixels);
|
||||||
|
GLAPI void APIENTRY glClear (GLbitfield mask);
|
||||||
|
GLAPI void APIENTRY glClearColor (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
|
||||||
|
GLAPI void APIENTRY glDisable (GLenum cap);
|
||||||
|
GLAPI void APIENTRY glEnable (GLenum cap);
|
||||||
|
GLAPI void APIENTRY glPixelStorei (GLenum pname, GLint param);
|
||||||
|
GLAPI void APIENTRY glReadPixels (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void *pixels);
|
||||||
|
GLAPI GLenum APIENTRY glGetError (void);
|
||||||
|
GLAPI void APIENTRY glGetIntegerv (GLenum pname, GLint *data);
|
||||||
|
GLAPI const GLubyte *APIENTRY glGetString (GLenum name);
|
||||||
|
GLAPI GLboolean APIENTRY glIsEnabled (GLenum cap);
|
||||||
|
GLAPI void APIENTRY glViewport (GLint x, GLint y, GLsizei width, GLsizei height);
|
||||||
|
#endif
|
||||||
|
#endif /* GL_VERSION_1_0 */
|
||||||
|
#ifndef GL_VERSION_1_1
|
||||||
|
typedef khronos_float_t GLclampf;
|
||||||
|
typedef double GLclampd;
|
||||||
|
#define GL_TEXTURE_BINDING_2D 0x8069
|
||||||
|
typedef void (APIENTRYP PFNGLDRAWELEMENTSPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices);
|
||||||
|
typedef void (APIENTRYP PFNGLBINDTEXTUREPROC) (GLenum target, GLuint texture);
|
||||||
|
typedef void (APIENTRYP PFNGLDELETETEXTURESPROC) (GLsizei n, const GLuint *textures);
|
||||||
|
typedef void (APIENTRYP PFNGLGENTEXTURESPROC) (GLsizei n, GLuint *textures);
|
||||||
|
#ifdef GL_GLEXT_PROTOTYPES
|
||||||
|
GLAPI void APIENTRY glDrawElements (GLenum mode, GLsizei count, GLenum type, const void *indices);
|
||||||
|
GLAPI void APIENTRY glBindTexture (GLenum target, GLuint texture);
|
||||||
|
GLAPI void APIENTRY glDeleteTextures (GLsizei n, const GLuint *textures);
|
||||||
|
GLAPI void APIENTRY glGenTextures (GLsizei n, GLuint *textures);
|
||||||
|
#endif
|
||||||
|
#endif /* GL_VERSION_1_1 */
|
||||||
|
#ifndef GL_VERSION_1_3
|
||||||
|
#define GL_TEXTURE0 0x84C0
|
||||||
|
#define GL_ACTIVE_TEXTURE 0x84E0
|
||||||
|
typedef void (APIENTRYP PFNGLACTIVETEXTUREPROC) (GLenum texture);
|
||||||
|
#ifdef GL_GLEXT_PROTOTYPES
|
||||||
|
GLAPI void APIENTRY glActiveTexture (GLenum texture);
|
||||||
|
#endif
|
||||||
|
#endif /* GL_VERSION_1_3 */
|
||||||
|
#ifndef GL_VERSION_1_4
|
||||||
|
#define GL_BLEND_DST_RGB 0x80C8
|
||||||
|
#define GL_BLEND_SRC_RGB 0x80C9
|
||||||
|
#define GL_BLEND_DST_ALPHA 0x80CA
|
||||||
|
#define GL_BLEND_SRC_ALPHA 0x80CB
|
||||||
|
#define GL_FUNC_ADD 0x8006
|
||||||
|
typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEPROC) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha);
|
||||||
|
typedef void (APIENTRYP PFNGLBLENDEQUATIONPROC) (GLenum mode);
|
||||||
|
#ifdef GL_GLEXT_PROTOTYPES
|
||||||
|
GLAPI void APIENTRY glBlendFuncSeparate (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha);
|
||||||
|
GLAPI void APIENTRY glBlendEquation (GLenum mode);
|
||||||
|
#endif
|
||||||
|
#endif /* GL_VERSION_1_4 */
|
||||||
|
#ifndef GL_VERSION_1_5
|
||||||
|
typedef khronos_ssize_t GLsizeiptr;
|
||||||
|
typedef khronos_intptr_t GLintptr;
|
||||||
|
#define GL_ARRAY_BUFFER 0x8892
|
||||||
|
#define GL_ELEMENT_ARRAY_BUFFER 0x8893
|
||||||
|
#define GL_ARRAY_BUFFER_BINDING 0x8894
|
||||||
|
#define GL_STREAM_DRAW 0x88E0
|
||||||
|
typedef void (APIENTRYP PFNGLBINDBUFFERPROC) (GLenum target, GLuint buffer);
|
||||||
|
typedef void (APIENTRYP PFNGLDELETEBUFFERSPROC) (GLsizei n, const GLuint *buffers);
|
||||||
|
typedef void (APIENTRYP PFNGLGENBUFFERSPROC) (GLsizei n, GLuint *buffers);
|
||||||
|
typedef void (APIENTRYP PFNGLBUFFERDATAPROC) (GLenum target, GLsizeiptr size, const void *data, GLenum usage);
|
||||||
|
typedef void (APIENTRYP PFNGLBUFFERSUBDATAPROC) (GLenum target, GLintptr offset, GLsizeiptr size, const void *data);
|
||||||
|
#ifdef GL_GLEXT_PROTOTYPES
|
||||||
|
GLAPI void APIENTRY glBindBuffer (GLenum target, GLuint buffer);
|
||||||
|
GLAPI void APIENTRY glDeleteBuffers (GLsizei n, const GLuint *buffers);
|
||||||
|
GLAPI void APIENTRY glGenBuffers (GLsizei n, GLuint *buffers);
|
||||||
|
GLAPI void APIENTRY glBufferData (GLenum target, GLsizeiptr size, const void *data, GLenum usage);
|
||||||
|
GLAPI void APIENTRY glBufferSubData (GLenum target, GLintptr offset, GLsizeiptr size, const void *data);
|
||||||
|
#endif
|
||||||
|
#endif /* GL_VERSION_1_5 */
|
||||||
|
#ifndef GL_VERSION_2_0
|
||||||
|
typedef char GLchar;
|
||||||
|
typedef khronos_int16_t GLshort;
|
||||||
|
typedef khronos_int8_t GLbyte;
|
||||||
|
typedef khronos_uint16_t GLushort;
|
||||||
|
#define GL_BLEND_EQUATION_RGB 0x8009
|
||||||
|
#define GL_BLEND_EQUATION_ALPHA 0x883D
|
||||||
|
#define GL_FRAGMENT_SHADER 0x8B30
|
||||||
|
#define GL_VERTEX_SHADER 0x8B31
|
||||||
|
#define GL_COMPILE_STATUS 0x8B81
|
||||||
|
#define GL_LINK_STATUS 0x8B82
|
||||||
|
#define GL_INFO_LOG_LENGTH 0x8B84
|
||||||
|
#define GL_CURRENT_PROGRAM 0x8B8D
|
||||||
|
#define GL_UPPER_LEFT 0x8CA2
|
||||||
|
typedef void (APIENTRYP PFNGLBLENDEQUATIONSEPARATEPROC) (GLenum modeRGB, GLenum modeAlpha);
|
||||||
|
typedef void (APIENTRYP PFNGLATTACHSHADERPROC) (GLuint program, GLuint shader);
|
||||||
|
typedef void (APIENTRYP PFNGLCOMPILESHADERPROC) (GLuint shader);
|
||||||
|
typedef GLuint (APIENTRYP PFNGLCREATEPROGRAMPROC) (void);
|
||||||
|
typedef GLuint (APIENTRYP PFNGLCREATESHADERPROC) (GLenum type);
|
||||||
|
typedef void (APIENTRYP PFNGLDELETEPROGRAMPROC) (GLuint program);
|
||||||
|
typedef void (APIENTRYP PFNGLDELETESHADERPROC) (GLuint shader);
|
||||||
|
typedef void (APIENTRYP PFNGLDETACHSHADERPROC) (GLuint program, GLuint shader);
|
||||||
|
typedef void (APIENTRYP PFNGLENABLEVERTEXATTRIBARRAYPROC) (GLuint index);
|
||||||
|
typedef GLint (APIENTRYP PFNGLGETATTRIBLOCATIONPROC) (GLuint program, const GLchar *name);
|
||||||
|
typedef void (APIENTRYP PFNGLGETPROGRAMIVPROC) (GLuint program, GLenum pname, GLint *params);
|
||||||
|
typedef void (APIENTRYP PFNGLGETPROGRAMINFOLOGPROC) (GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
|
||||||
|
typedef void (APIENTRYP PFNGLGETSHADERIVPROC) (GLuint shader, GLenum pname, GLint *params);
|
||||||
|
typedef void (APIENTRYP PFNGLGETSHADERINFOLOGPROC) (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
|
||||||
|
typedef GLint (APIENTRYP PFNGLGETUNIFORMLOCATIONPROC) (GLuint program, const GLchar *name);
|
||||||
|
typedef void (APIENTRYP PFNGLLINKPROGRAMPROC) (GLuint program);
|
||||||
|
typedef void (APIENTRYP PFNGLSHADERSOURCEPROC) (GLuint shader, GLsizei count, const GLchar *const*string, const GLint *length);
|
||||||
|
typedef void (APIENTRYP PFNGLUSEPROGRAMPROC) (GLuint program);
|
||||||
|
typedef void (APIENTRYP PFNGLUNIFORM1IPROC) (GLint location, GLint v0);
|
||||||
|
typedef void (APIENTRYP PFNGLUNIFORMMATRIX4FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
|
||||||
|
typedef void (APIENTRYP PFNGLVERTEXATTRIBPOINTERPROC) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void *pointer);
|
||||||
|
#ifdef GL_GLEXT_PROTOTYPES
|
||||||
|
GLAPI void APIENTRY glBlendEquationSeparate (GLenum modeRGB, GLenum modeAlpha);
|
||||||
|
GLAPI void APIENTRY glAttachShader (GLuint program, GLuint shader);
|
||||||
|
GLAPI void APIENTRY glCompileShader (GLuint shader);
|
||||||
|
GLAPI GLuint APIENTRY glCreateProgram (void);
|
||||||
|
GLAPI GLuint APIENTRY glCreateShader (GLenum type);
|
||||||
|
GLAPI void APIENTRY glDeleteProgram (GLuint program);
|
||||||
|
GLAPI void APIENTRY glDeleteShader (GLuint shader);
|
||||||
|
GLAPI void APIENTRY glDetachShader (GLuint program, GLuint shader);
|
||||||
|
GLAPI void APIENTRY glEnableVertexAttribArray (GLuint index);
|
||||||
|
GLAPI GLint APIENTRY glGetAttribLocation (GLuint program, const GLchar *name);
|
||||||
|
GLAPI void APIENTRY glGetProgramiv (GLuint program, GLenum pname, GLint *params);
|
||||||
|
GLAPI void APIENTRY glGetProgramInfoLog (GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
|
||||||
|
GLAPI void APIENTRY glGetShaderiv (GLuint shader, GLenum pname, GLint *params);
|
||||||
|
GLAPI void APIENTRY glGetShaderInfoLog (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
|
||||||
|
GLAPI GLint APIENTRY glGetUniformLocation (GLuint program, const GLchar *name);
|
||||||
|
GLAPI void APIENTRY glLinkProgram (GLuint program);
|
||||||
|
GLAPI void APIENTRY glShaderSource (GLuint shader, GLsizei count, const GLchar *const*string, const GLint *length);
|
||||||
|
GLAPI void APIENTRY glUseProgram (GLuint program);
|
||||||
|
GLAPI void APIENTRY glUniform1i (GLint location, GLint v0);
|
||||||
|
GLAPI void APIENTRY glUniformMatrix4fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
|
||||||
|
GLAPI void APIENTRY glVertexAttribPointer (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void *pointer);
|
||||||
|
#endif
|
||||||
|
#endif /* GL_VERSION_2_0 */
|
||||||
|
#ifndef GL_VERSION_3_0
|
||||||
|
typedef khronos_uint16_t GLhalf;
|
||||||
|
#define GL_MAJOR_VERSION 0x821B
|
||||||
|
#define GL_MINOR_VERSION 0x821C
|
||||||
|
#define GL_NUM_EXTENSIONS 0x821D
|
||||||
|
#define GL_FRAMEBUFFER_SRGB 0x8DB9
|
||||||
|
#define GL_VERTEX_ARRAY_BINDING 0x85B5
|
||||||
|
typedef void (APIENTRYP PFNGLGETBOOLEANI_VPROC) (GLenum target, GLuint index, GLboolean *data);
|
||||||
|
typedef void (APIENTRYP PFNGLGETINTEGERI_VPROC) (GLenum target, GLuint index, GLint *data);
|
||||||
|
typedef const GLubyte *(APIENTRYP PFNGLGETSTRINGIPROC) (GLenum name, GLuint index);
|
||||||
|
typedef void (APIENTRYP PFNGLBINDVERTEXARRAYPROC) (GLuint array);
|
||||||
|
typedef void (APIENTRYP PFNGLDELETEVERTEXARRAYSPROC) (GLsizei n, const GLuint *arrays);
|
||||||
|
typedef void (APIENTRYP PFNGLGENVERTEXARRAYSPROC) (GLsizei n, GLuint *arrays);
|
||||||
|
#ifdef GL_GLEXT_PROTOTYPES
|
||||||
|
GLAPI const GLubyte *APIENTRY glGetStringi (GLenum name, GLuint index);
|
||||||
|
GLAPI void APIENTRY glBindVertexArray (GLuint array);
|
||||||
|
GLAPI void APIENTRY glDeleteVertexArrays (GLsizei n, const GLuint *arrays);
|
||||||
|
GLAPI void APIENTRY glGenVertexArrays (GLsizei n, GLuint *arrays);
|
||||||
|
#endif
|
||||||
|
#endif /* GL_VERSION_3_0 */
|
||||||
|
#ifndef GL_VERSION_3_1
|
||||||
|
#define GL_VERSION_3_1 1
|
||||||
|
#define GL_PRIMITIVE_RESTART 0x8F9D
|
||||||
|
#endif /* GL_VERSION_3_1 */
|
||||||
|
#ifndef GL_VERSION_3_2
|
||||||
|
#define GL_VERSION_3_2 1
|
||||||
|
typedef struct __GLsync *GLsync;
|
||||||
|
typedef khronos_uint64_t GLuint64;
|
||||||
|
typedef khronos_int64_t GLint64;
|
||||||
|
typedef void (APIENTRYP PFNGLDRAWELEMENTSBASEVERTEXPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLint basevertex);
|
||||||
|
typedef void (APIENTRYP PFNGLGETINTEGER64I_VPROC) (GLenum target, GLuint index, GLint64 *data);
|
||||||
|
#ifdef GL_GLEXT_PROTOTYPES
|
||||||
|
GLAPI void APIENTRY glDrawElementsBaseVertex (GLenum mode, GLsizei count, GLenum type, const void *indices, GLint basevertex);
|
||||||
|
#endif
|
||||||
|
#endif /* GL_VERSION_3_2 */
|
||||||
|
#ifndef GL_VERSION_3_3
|
||||||
|
#define GL_VERSION_3_3 1
|
||||||
|
#define GL_SAMPLER_BINDING 0x8919
|
||||||
|
typedef void (APIENTRYP PFNGLBINDSAMPLERPROC) (GLuint unit, GLuint sampler);
|
||||||
|
#ifdef GL_GLEXT_PROTOTYPES
|
||||||
|
GLAPI void APIENTRY glBindSampler (GLuint unit, GLuint sampler);
|
||||||
|
#endif
|
||||||
|
#endif /* GL_VERSION_3_3 */
|
||||||
|
#ifndef GL_VERSION_4_1
|
||||||
|
typedef void (APIENTRYP PFNGLGETFLOATI_VPROC) (GLenum target, GLuint index, GLfloat *data);
|
||||||
|
typedef void (APIENTRYP PFNGLGETDOUBLEI_VPROC) (GLenum target, GLuint index, GLdouble *data);
|
||||||
|
#endif /* GL_VERSION_4_1 */
|
||||||
|
#ifndef GL_VERSION_4_3
|
||||||
|
typedef void (APIENTRY *GLDEBUGPROC)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,const void *userParam);
|
||||||
|
#endif /* GL_VERSION_4_3 */
|
||||||
|
#ifndef GL_VERSION_4_5
|
||||||
|
#define GL_CLIP_ORIGIN 0x935C
|
||||||
|
typedef void (APIENTRYP PFNGLGETTRANSFORMFEEDBACKI_VPROC) (GLuint xfb, GLenum pname, GLuint index, GLint *param);
|
||||||
|
typedef void (APIENTRYP PFNGLGETTRANSFORMFEEDBACKI64_VPROC) (GLuint xfb, GLenum pname, GLuint index, GLint64 *param);
|
||||||
|
#endif /* GL_VERSION_4_5 */
|
||||||
|
#ifndef GL_ARB_bindless_texture
|
||||||
|
typedef khronos_uint64_t GLuint64EXT;
|
||||||
|
#endif /* GL_ARB_bindless_texture */
|
||||||
|
#ifndef GL_ARB_cl_event
|
||||||
|
struct _cl_context;
|
||||||
|
struct _cl_event;
|
||||||
|
#endif /* GL_ARB_cl_event */
|
||||||
|
#ifndef GL_ARB_clip_control
|
||||||
|
#define GL_ARB_clip_control 1
|
||||||
|
#endif /* GL_ARB_clip_control */
|
||||||
|
#ifndef GL_ARB_debug_output
|
||||||
|
typedef void (APIENTRY *GLDEBUGPROCARB)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,const void *userParam);
|
||||||
|
#endif /* GL_ARB_debug_output */
|
||||||
|
#ifndef GL_EXT_EGL_image_storage
|
||||||
|
typedef void *GLeglImageOES;
|
||||||
|
#endif /* GL_EXT_EGL_image_storage */
|
||||||
|
#ifndef GL_EXT_direct_state_access
|
||||||
|
typedef void (APIENTRYP PFNGLGETFLOATI_VEXTPROC) (GLenum pname, GLuint index, GLfloat *params);
|
||||||
|
typedef void (APIENTRYP PFNGLGETDOUBLEI_VEXTPROC) (GLenum pname, GLuint index, GLdouble *params);
|
||||||
|
typedef void (APIENTRYP PFNGLGETPOINTERI_VEXTPROC) (GLenum pname, GLuint index, void **params);
|
||||||
|
typedef void (APIENTRYP PFNGLGETVERTEXARRAYINTEGERI_VEXTPROC) (GLuint vaobj, GLuint index, GLenum pname, GLint *param);
|
||||||
|
typedef void (APIENTRYP PFNGLGETVERTEXARRAYPOINTERI_VEXTPROC) (GLuint vaobj, GLuint index, GLenum pname, void **param);
|
||||||
|
#endif /* GL_EXT_direct_state_access */
|
||||||
|
#ifndef GL_NV_draw_vulkan_image
|
||||||
|
typedef void (APIENTRY *GLVULKANPROCNV)(void);
|
||||||
|
#endif /* GL_NV_draw_vulkan_image */
|
||||||
|
#ifndef GL_NV_gpu_shader5
|
||||||
|
typedef khronos_int64_t GLint64EXT;
|
||||||
|
#endif /* GL_NV_gpu_shader5 */
|
||||||
|
#ifndef GL_NV_vertex_buffer_unified_memory
|
||||||
|
typedef void (APIENTRYP PFNGLGETINTEGERUI64I_VNVPROC) (GLenum value, GLuint index, GLuint64EXT *result);
|
||||||
|
#endif /* GL_NV_vertex_buffer_unified_memory */
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef GL3W_API
|
||||||
|
#define GL3W_API
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef __gl_h_
|
||||||
|
#define __gl_h_
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define GL3W_OK 0
|
||||||
|
#define GL3W_ERROR_INIT -1
|
||||||
|
#define GL3W_ERROR_LIBRARY_OPEN -2
|
||||||
|
#define GL3W_ERROR_OPENGL_VERSION -3
|
||||||
|
|
||||||
|
typedef void (*GL3WglProc)(void);
|
||||||
|
typedef GL3WglProc (*GL3WGetProcAddressProc)(const char *proc);
|
||||||
|
|
||||||
|
/* gl3w api */
|
||||||
|
GL3W_API int imgl3wInit(void);
|
||||||
|
GL3W_API int imgl3wInit2(GL3WGetProcAddressProc proc);
|
||||||
|
GL3W_API int imgl3wIsSupported(int major, int minor);
|
||||||
|
GL3W_API GL3WglProc imgl3wGetProcAddress(const char *proc);
|
||||||
|
|
||||||
|
/* gl3w internal state */
|
||||||
|
union GL3WProcs {
|
||||||
|
GL3WglProc ptr[53];
|
||||||
|
struct {
|
||||||
|
PFNGLACTIVETEXTUREPROC ActiveTexture;
|
||||||
|
PFNGLATTACHSHADERPROC AttachShader;
|
||||||
|
PFNGLBINDBUFFERPROC BindBuffer;
|
||||||
|
PFNGLBINDSAMPLERPROC BindSampler;
|
||||||
|
PFNGLBINDTEXTUREPROC BindTexture;
|
||||||
|
PFNGLBINDVERTEXARRAYPROC BindVertexArray;
|
||||||
|
PFNGLBLENDEQUATIONPROC BlendEquation;
|
||||||
|
PFNGLBLENDEQUATIONSEPARATEPROC BlendEquationSeparate;
|
||||||
|
PFNGLBLENDFUNCSEPARATEPROC BlendFuncSeparate;
|
||||||
|
PFNGLBUFFERDATAPROC BufferData;
|
||||||
|
PFNGLBUFFERSUBDATAPROC BufferSubData;
|
||||||
|
PFNGLCLEARPROC Clear;
|
||||||
|
PFNGLCLEARCOLORPROC ClearColor;
|
||||||
|
PFNGLCOMPILESHADERPROC CompileShader;
|
||||||
|
PFNGLCREATEPROGRAMPROC CreateProgram;
|
||||||
|
PFNGLCREATESHADERPROC CreateShader;
|
||||||
|
PFNGLDELETEBUFFERSPROC DeleteBuffers;
|
||||||
|
PFNGLDELETEPROGRAMPROC DeleteProgram;
|
||||||
|
PFNGLDELETESHADERPROC DeleteShader;
|
||||||
|
PFNGLDELETETEXTURESPROC DeleteTextures;
|
||||||
|
PFNGLDELETEVERTEXARRAYSPROC DeleteVertexArrays;
|
||||||
|
PFNGLDETACHSHADERPROC DetachShader;
|
||||||
|
PFNGLDISABLEPROC Disable;
|
||||||
|
PFNGLDRAWELEMENTSPROC DrawElements;
|
||||||
|
PFNGLDRAWELEMENTSBASEVERTEXPROC DrawElementsBaseVertex;
|
||||||
|
PFNGLENABLEPROC Enable;
|
||||||
|
PFNGLENABLEVERTEXATTRIBARRAYPROC EnableVertexAttribArray;
|
||||||
|
PFNGLGENBUFFERSPROC GenBuffers;
|
||||||
|
PFNGLGENTEXTURESPROC GenTextures;
|
||||||
|
PFNGLGENVERTEXARRAYSPROC GenVertexArrays;
|
||||||
|
PFNGLGETATTRIBLOCATIONPROC GetAttribLocation;
|
||||||
|
PFNGLGETERRORPROC GetError;
|
||||||
|
PFNGLGETINTEGERVPROC GetIntegerv;
|
||||||
|
PFNGLGETPROGRAMINFOLOGPROC GetProgramInfoLog;
|
||||||
|
PFNGLGETPROGRAMIVPROC GetProgramiv;
|
||||||
|
PFNGLGETSHADERINFOLOGPROC GetShaderInfoLog;
|
||||||
|
PFNGLGETSHADERIVPROC GetShaderiv;
|
||||||
|
PFNGLGETSTRINGPROC GetString;
|
||||||
|
PFNGLGETSTRINGIPROC GetStringi;
|
||||||
|
PFNGLGETUNIFORMLOCATIONPROC GetUniformLocation;
|
||||||
|
PFNGLISENABLEDPROC IsEnabled;
|
||||||
|
PFNGLLINKPROGRAMPROC LinkProgram;
|
||||||
|
PFNGLPIXELSTOREIPROC PixelStorei;
|
||||||
|
PFNGLPOLYGONMODEPROC PolygonMode;
|
||||||
|
PFNGLREADPIXELSPROC ReadPixels;
|
||||||
|
PFNGLSCISSORPROC Scissor;
|
||||||
|
PFNGLSHADERSOURCEPROC ShaderSource;
|
||||||
|
PFNGLTEXIMAGE2DPROC TexImage2D;
|
||||||
|
PFNGLTEXPARAMETERIPROC TexParameteri;
|
||||||
|
PFNGLUNIFORM1IPROC Uniform1i;
|
||||||
|
PFNGLUNIFORMMATRIX4FVPROC UniformMatrix4fv;
|
||||||
|
PFNGLUSEPROGRAMPROC UseProgram;
|
||||||
|
PFNGLVERTEXATTRIBPOINTERPROC VertexAttribPointer;
|
||||||
|
PFNGLVIEWPORTPROC Viewport;
|
||||||
|
} gl;
|
||||||
|
};
|
||||||
|
|
||||||
|
GL3W_API extern union GL3WProcs imgl3wProcs;
|
||||||
|
|
||||||
|
/* OpenGL functions */
|
||||||
|
#define glActiveTexture imgl3wProcs.gl.ActiveTexture
|
||||||
|
#define glAttachShader imgl3wProcs.gl.AttachShader
|
||||||
|
#define glBindBuffer imgl3wProcs.gl.BindBuffer
|
||||||
|
#define glBindSampler imgl3wProcs.gl.BindSampler
|
||||||
|
#define glBindTexture imgl3wProcs.gl.BindTexture
|
||||||
|
#define glBindVertexArray imgl3wProcs.gl.BindVertexArray
|
||||||
|
#define glBlendEquation imgl3wProcs.gl.BlendEquation
|
||||||
|
#define glBlendEquationSeparate imgl3wProcs.gl.BlendEquationSeparate
|
||||||
|
#define glBlendFuncSeparate imgl3wProcs.gl.BlendFuncSeparate
|
||||||
|
#define glBufferData imgl3wProcs.gl.BufferData
|
||||||
|
#define glBufferSubData imgl3wProcs.gl.BufferSubData
|
||||||
|
#define glClear imgl3wProcs.gl.Clear
|
||||||
|
#define glClearColor imgl3wProcs.gl.ClearColor
|
||||||
|
#define glCompileShader imgl3wProcs.gl.CompileShader
|
||||||
|
#define glCreateProgram imgl3wProcs.gl.CreateProgram
|
||||||
|
#define glCreateShader imgl3wProcs.gl.CreateShader
|
||||||
|
#define glDeleteBuffers imgl3wProcs.gl.DeleteBuffers
|
||||||
|
#define glDeleteProgram imgl3wProcs.gl.DeleteProgram
|
||||||
|
#define glDeleteShader imgl3wProcs.gl.DeleteShader
|
||||||
|
#define glDeleteTextures imgl3wProcs.gl.DeleteTextures
|
||||||
|
#define glDeleteVertexArrays imgl3wProcs.gl.DeleteVertexArrays
|
||||||
|
#define glDetachShader imgl3wProcs.gl.DetachShader
|
||||||
|
#define glDisable imgl3wProcs.gl.Disable
|
||||||
|
#define glDrawElements imgl3wProcs.gl.DrawElements
|
||||||
|
#define glDrawElementsBaseVertex imgl3wProcs.gl.DrawElementsBaseVertex
|
||||||
|
#define glEnable imgl3wProcs.gl.Enable
|
||||||
|
#define glEnableVertexAttribArray imgl3wProcs.gl.EnableVertexAttribArray
|
||||||
|
#define glGenBuffers imgl3wProcs.gl.GenBuffers
|
||||||
|
#define glGenTextures imgl3wProcs.gl.GenTextures
|
||||||
|
#define glGenVertexArrays imgl3wProcs.gl.GenVertexArrays
|
||||||
|
#define glGetAttribLocation imgl3wProcs.gl.GetAttribLocation
|
||||||
|
#define glGetError imgl3wProcs.gl.GetError
|
||||||
|
#define glGetIntegerv imgl3wProcs.gl.GetIntegerv
|
||||||
|
#define glGetProgramInfoLog imgl3wProcs.gl.GetProgramInfoLog
|
||||||
|
#define glGetProgramiv imgl3wProcs.gl.GetProgramiv
|
||||||
|
#define glGetShaderInfoLog imgl3wProcs.gl.GetShaderInfoLog
|
||||||
|
#define glGetShaderiv imgl3wProcs.gl.GetShaderiv
|
||||||
|
#define glGetString imgl3wProcs.gl.GetString
|
||||||
|
#define glGetStringi imgl3wProcs.gl.GetStringi
|
||||||
|
#define glGetUniformLocation imgl3wProcs.gl.GetUniformLocation
|
||||||
|
#define glIsEnabled imgl3wProcs.gl.IsEnabled
|
||||||
|
#define glLinkProgram imgl3wProcs.gl.LinkProgram
|
||||||
|
#define glPixelStorei imgl3wProcs.gl.PixelStorei
|
||||||
|
#define glPolygonMode imgl3wProcs.gl.PolygonMode
|
||||||
|
#define glReadPixels imgl3wProcs.gl.ReadPixels
|
||||||
|
#define glScissor imgl3wProcs.gl.Scissor
|
||||||
|
#define glShaderSource imgl3wProcs.gl.ShaderSource
|
||||||
|
#define glTexImage2D imgl3wProcs.gl.TexImage2D
|
||||||
|
#define glTexParameteri imgl3wProcs.gl.TexParameteri
|
||||||
|
#define glUniform1i imgl3wProcs.gl.Uniform1i
|
||||||
|
#define glUniformMatrix4fv imgl3wProcs.gl.UniformMatrix4fv
|
||||||
|
#define glUseProgram imgl3wProcs.gl.UseProgram
|
||||||
|
#define glVertexAttribPointer imgl3wProcs.gl.VertexAttribPointer
|
||||||
|
#define glViewport imgl3wProcs.gl.Viewport
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef IMGL3W_IMPL
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
|
||||||
|
|
||||||
|
#if defined(_WIN32)
|
||||||
|
#ifndef WIN32_LEAN_AND_MEAN
|
||||||
|
#define WIN32_LEAN_AND_MEAN 1
|
||||||
|
#endif
|
||||||
|
#include <windows.h>
|
||||||
|
|
||||||
|
static HMODULE libgl;
|
||||||
|
typedef PROC(__stdcall* GL3WglGetProcAddr)(LPCSTR);
|
||||||
|
static GL3WglGetProcAddr wgl_get_proc_address;
|
||||||
|
|
||||||
|
static int open_libgl(void)
|
||||||
|
{
|
||||||
|
libgl = LoadLibraryA("opengl32.dll");
|
||||||
|
if (!libgl)
|
||||||
|
return GL3W_ERROR_LIBRARY_OPEN;
|
||||||
|
wgl_get_proc_address = (GL3WglGetProcAddr)GetProcAddress(libgl, "wglGetProcAddress");
|
||||||
|
return GL3W_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void close_libgl(void) { FreeLibrary(libgl); }
|
||||||
|
static GL3WglProc get_proc(const char *proc)
|
||||||
|
{
|
||||||
|
GL3WglProc res;
|
||||||
|
res = (GL3WglProc)wgl_get_proc_address(proc);
|
||||||
|
if (!res)
|
||||||
|
res = (GL3WglProc)GetProcAddress(libgl, proc);
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
#elif defined(__APPLE__)
|
||||||
|
#include <dlfcn.h>
|
||||||
|
|
||||||
|
static void *libgl;
|
||||||
|
static int open_libgl(void)
|
||||||
|
{
|
||||||
|
libgl = dlopen("/System/Library/Frameworks/OpenGL.framework/OpenGL", RTLD_LAZY | RTLD_LOCAL);
|
||||||
|
if (!libgl)
|
||||||
|
return GL3W_ERROR_LIBRARY_OPEN;
|
||||||
|
return GL3W_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void close_libgl(void) { dlclose(libgl); }
|
||||||
|
|
||||||
|
static GL3WglProc get_proc(const char *proc)
|
||||||
|
{
|
||||||
|
GL3WglProc res;
|
||||||
|
*(void **)(&res) = dlsym(libgl, proc);
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
#include <dlfcn.h>
|
||||||
|
|
||||||
|
static void *libgl;
|
||||||
|
static GL3WglProc (*glx_get_proc_address)(const GLubyte *);
|
||||||
|
|
||||||
|
static int open_libgl(void)
|
||||||
|
{
|
||||||
|
libgl = dlopen("libGL.so.1", RTLD_LAZY | RTLD_LOCAL);
|
||||||
|
if (!libgl)
|
||||||
|
return GL3W_ERROR_LIBRARY_OPEN;
|
||||||
|
*(void **)(&glx_get_proc_address) = dlsym(libgl, "glXGetProcAddressARB");
|
||||||
|
return GL3W_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void close_libgl(void) { dlclose(libgl); }
|
||||||
|
|
||||||
|
static GL3WglProc get_proc(const char *proc)
|
||||||
|
{
|
||||||
|
GL3WglProc res;
|
||||||
|
res = glx_get_proc_address((const GLubyte *)proc);
|
||||||
|
if (!res)
|
||||||
|
*(void **)(&res) = dlsym(libgl, proc);
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
static struct { int major, minor; } version;
|
||||||
|
|
||||||
|
static int parse_version(void)
|
||||||
|
{
|
||||||
|
if (!glGetIntegerv)
|
||||||
|
return GL3W_ERROR_INIT;
|
||||||
|
glGetIntegerv(GL_MAJOR_VERSION, &version.major);
|
||||||
|
glGetIntegerv(GL_MINOR_VERSION, &version.minor);
|
||||||
|
if (version.major < 3)
|
||||||
|
return GL3W_ERROR_OPENGL_VERSION;
|
||||||
|
return GL3W_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void load_procs(GL3WGetProcAddressProc proc);
|
||||||
|
|
||||||
|
int imgl3wInit(void)
|
||||||
|
{
|
||||||
|
int res = open_libgl();
|
||||||
|
if (res)
|
||||||
|
return res;
|
||||||
|
atexit(close_libgl);
|
||||||
|
return imgl3wInit2(get_proc);
|
||||||
|
}
|
||||||
|
|
||||||
|
int imgl3wInit2(GL3WGetProcAddressProc proc)
|
||||||
|
{
|
||||||
|
load_procs(proc);
|
||||||
|
return parse_version();
|
||||||
|
}
|
||||||
|
|
||||||
|
int imgl3wIsSupported(int major, int minor)
|
||||||
|
{
|
||||||
|
if (major < 3)
|
||||||
|
return 0;
|
||||||
|
if (version.major == major)
|
||||||
|
return version.minor >= minor;
|
||||||
|
return version.major >= major;
|
||||||
|
}
|
||||||
|
|
||||||
|
GL3WglProc imgl3wGetProcAddress(const char *proc) { return get_proc(proc); }
|
||||||
|
|
||||||
|
static const char *proc_names[] = {
|
||||||
|
"glActiveTexture",
|
||||||
|
"glAttachShader",
|
||||||
|
"glBindBuffer",
|
||||||
|
"glBindSampler",
|
||||||
|
"glBindTexture",
|
||||||
|
"glBindVertexArray",
|
||||||
|
"glBlendEquation",
|
||||||
|
"glBlendEquationSeparate",
|
||||||
|
"glBlendFuncSeparate",
|
||||||
|
"glBufferData",
|
||||||
|
"glBufferSubData",
|
||||||
|
"glClear",
|
||||||
|
"glClearColor",
|
||||||
|
"glCompileShader",
|
||||||
|
"glCreateProgram",
|
||||||
|
"glCreateShader",
|
||||||
|
"glDeleteBuffers",
|
||||||
|
"glDeleteProgram",
|
||||||
|
"glDeleteShader",
|
||||||
|
"glDeleteTextures",
|
||||||
|
"glDeleteVertexArrays",
|
||||||
|
"glDetachShader",
|
||||||
|
"glDisable",
|
||||||
|
"glDrawElements",
|
||||||
|
"glDrawElementsBaseVertex",
|
||||||
|
"glEnable",
|
||||||
|
"glEnableVertexAttribArray",
|
||||||
|
"glGenBuffers",
|
||||||
|
"glGenTextures",
|
||||||
|
"glGenVertexArrays",
|
||||||
|
"glGetAttribLocation",
|
||||||
|
"glGetError",
|
||||||
|
"glGetIntegerv",
|
||||||
|
"glGetProgramInfoLog",
|
||||||
|
"glGetProgramiv",
|
||||||
|
"glGetShaderInfoLog",
|
||||||
|
"glGetShaderiv",
|
||||||
|
"glGetString",
|
||||||
|
"glGetStringi",
|
||||||
|
"glGetUniformLocation",
|
||||||
|
"glIsEnabled",
|
||||||
|
"glLinkProgram",
|
||||||
|
"glPixelStorei",
|
||||||
|
"glPolygonMode",
|
||||||
|
"glReadPixels",
|
||||||
|
"glScissor",
|
||||||
|
"glShaderSource",
|
||||||
|
"glTexImage2D",
|
||||||
|
"glTexParameteri",
|
||||||
|
"glUniform1i",
|
||||||
|
"glUniformMatrix4fv",
|
||||||
|
"glUseProgram",
|
||||||
|
"glVertexAttribPointer",
|
||||||
|
"glViewport",
|
||||||
|
};
|
||||||
|
|
||||||
|
GL3W_API union GL3WProcs imgl3wProcs;
|
||||||
|
|
||||||
|
static void load_procs(GL3WGetProcAddressProc proc)
|
||||||
|
{
|
||||||
|
size_t i;
|
||||||
|
for (i = 0; i < ARRAY_SIZE(proc_names); i++)
|
||||||
|
imgl3wProcs.ptr[i] = proc(proc_names[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
+8
-2
@@ -57,7 +57,7 @@
|
|||||||
#include <SDL.h>
|
#include <SDL.h>
|
||||||
#include <SDL_syswm.h>
|
#include <SDL_syswm.h>
|
||||||
#if defined(__APPLE__)
|
#if defined(__APPLE__)
|
||||||
#include "TargetConditionals.h"
|
#include <TargetConditionals.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if SDL_VERSION_ATLEAST(2,0,4) && !defined(__EMSCRIPTEN__) && !defined(__ANDROID__) && !(defined(__APPLE__) && TARGET_OS_IOS)
|
#if SDL_VERSION_ATLEAST(2,0,4) && !defined(__EMSCRIPTEN__) && !defined(__ANDROID__) && !(defined(__APPLE__) && TARGET_OS_IOS)
|
||||||
@@ -278,10 +278,16 @@ bool ImGui_ImplSDL2_InitForMetal(SDL_Window* window)
|
|||||||
return ImGui_ImplSDL2_Init(window);
|
return ImGui_ImplSDL2_Init(window);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ImGui_ImplSDL2_InitForSDLRenderer(SDL_Window* window)
|
||||||
|
{
|
||||||
|
return ImGui_ImplSDL2_Init(window);
|
||||||
|
}
|
||||||
|
|
||||||
void ImGui_ImplSDL2_Shutdown()
|
void ImGui_ImplSDL2_Shutdown()
|
||||||
{
|
{
|
||||||
ImGuiIO& io = ImGui::GetIO();
|
|
||||||
ImGui_ImplSDL2_Data* bd = ImGui_ImplSDL2_GetBackendData();
|
ImGui_ImplSDL2_Data* bd = ImGui_ImplSDL2_GetBackendData();
|
||||||
|
IM_ASSERT(bd != NULL && "No platform backend to shutdown, or already shutdown?");
|
||||||
|
ImGuiIO& io = ImGui::GetIO();
|
||||||
|
|
||||||
if (bd->ClipboardTextData)
|
if (bd->ClipboardTextData)
|
||||||
SDL_free(bd->ClipboardTextData);
|
SDL_free(bd->ClipboardTextData);
|
||||||
|
|||||||
+1
@@ -25,6 +25,7 @@ IMGUI_IMPL_API bool ImGui_ImplSDL2_InitForOpenGL(SDL_Window* window, void* s
|
|||||||
IMGUI_IMPL_API bool ImGui_ImplSDL2_InitForVulkan(SDL_Window* window);
|
IMGUI_IMPL_API bool ImGui_ImplSDL2_InitForVulkan(SDL_Window* window);
|
||||||
IMGUI_IMPL_API bool ImGui_ImplSDL2_InitForD3D(SDL_Window* window);
|
IMGUI_IMPL_API bool ImGui_ImplSDL2_InitForD3D(SDL_Window* window);
|
||||||
IMGUI_IMPL_API bool ImGui_ImplSDL2_InitForMetal(SDL_Window* window);
|
IMGUI_IMPL_API bool ImGui_ImplSDL2_InitForMetal(SDL_Window* window);
|
||||||
|
IMGUI_IMPL_API bool ImGui_ImplSDL2_InitForSDLRenderer(SDL_Window* window);
|
||||||
IMGUI_IMPL_API void ImGui_ImplSDL2_Shutdown();
|
IMGUI_IMPL_API void ImGui_ImplSDL2_Shutdown();
|
||||||
IMGUI_IMPL_API void ImGui_ImplSDL2_NewFrame();
|
IMGUI_IMPL_API void ImGui_ImplSDL2_NewFrame();
|
||||||
IMGUI_IMPL_API bool ImGui_ImplSDL2_ProcessEvent(const SDL_Event* event);
|
IMGUI_IMPL_API bool ImGui_ImplSDL2_ProcessEvent(const SDL_Event* event);
|
||||||
|
|||||||
+248
@@ -0,0 +1,248 @@
|
|||||||
|
// dear imgui: Renderer Backend for SDL_Renderer
|
||||||
|
// (Requires: SDL 2.0.17+)
|
||||||
|
|
||||||
|
// Important to understand: SDL_Renderer is an _optional_ component of SDL.
|
||||||
|
// For a multi-platform app consider using e.g. SDL+DirectX on Windows and SDL+OpenGL on Linux/OSX.
|
||||||
|
// If your application will want to render any non trivial amount of graphics other than UI,
|
||||||
|
// please be aware that SDL_Renderer offers a limited graphic API to the end-user and it might
|
||||||
|
// be difficult to step out of those boundaries.
|
||||||
|
// However, we understand it is a convenient choice to get an app started easily.
|
||||||
|
|
||||||
|
// Implemented features:
|
||||||
|
// [X] Renderer: User texture binding. Use 'SDL_Texture*' as ImTextureID. Read the FAQ about ImTextureID!
|
||||||
|
// [X] Renderer: Support for large meshes (64k+ vertices) with 16-bit indices.
|
||||||
|
// Missing features:
|
||||||
|
|
||||||
|
// You can copy and use unmodified imgui_impl_* files in your project. See examples/ folder for examples of using this.
|
||||||
|
// If you are new to Dear ImGui, read documentation from the docs/ folder + read the top of imgui.cpp.
|
||||||
|
// Read online: https://github.com/ocornut/imgui/tree/master/docs
|
||||||
|
|
||||||
|
// CHANGELOG
|
||||||
|
// 2021-12-21: Update SDL_RenderGeometryRaw() format to work with SDL 2.0.19.
|
||||||
|
// 2021-12-03: Added support for large mesh (64K+ vertices), enable ImGuiBackendFlags_RendererHasVtxOffset flag.
|
||||||
|
// 2021-10-06: Backup and restore modified ClipRect/Viewport.
|
||||||
|
// 2021-09-21: Initial version.
|
||||||
|
|
||||||
|
#include "imgui.h"
|
||||||
|
#include "imgui_impl_sdlrenderer.h"
|
||||||
|
#if defined(_MSC_VER) && _MSC_VER <= 1500 // MSVC 2008 or earlier
|
||||||
|
#include <stddef.h> // intptr_t
|
||||||
|
#else
|
||||||
|
#include <stdint.h> // intptr_t
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// SDL
|
||||||
|
#include <SDL.h>
|
||||||
|
#if !SDL_VERSION_ATLEAST(2,0,17)
|
||||||
|
#error This backend requires SDL 2.0.17+ because of SDL_RenderGeometry() function
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// SDL_Renderer data
|
||||||
|
struct ImGui_ImplSDLRenderer_Data
|
||||||
|
{
|
||||||
|
SDL_Renderer* SDLRenderer;
|
||||||
|
SDL_Texture* FontTexture;
|
||||||
|
ImGui_ImplSDLRenderer_Data() { memset(this, 0, sizeof(*this)); }
|
||||||
|
};
|
||||||
|
|
||||||
|
// Backend data stored in io.BackendRendererUserData to allow support for multiple Dear ImGui contexts
|
||||||
|
// It is STRONGLY preferred that you use docking branch with multi-viewports (== single Dear ImGui context + multiple windows) instead of multiple Dear ImGui contexts.
|
||||||
|
static ImGui_ImplSDLRenderer_Data* ImGui_ImplSDLRenderer_GetBackendData()
|
||||||
|
{
|
||||||
|
return ImGui::GetCurrentContext() ? (ImGui_ImplSDLRenderer_Data*)ImGui::GetIO().BackendRendererUserData : NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Functions
|
||||||
|
bool ImGui_ImplSDLRenderer_Init(SDL_Renderer* renderer)
|
||||||
|
{
|
||||||
|
ImGuiIO& io = ImGui::GetIO();
|
||||||
|
IM_ASSERT(io.BackendRendererUserData == NULL && "Already initialized a renderer backend!");
|
||||||
|
IM_ASSERT(renderer != NULL && "SDL_Renderer not initialized!");
|
||||||
|
|
||||||
|
// Setup backend capabilities flags
|
||||||
|
ImGui_ImplSDLRenderer_Data* bd = IM_NEW(ImGui_ImplSDLRenderer_Data)();
|
||||||
|
io.BackendRendererUserData = (void*)bd;
|
||||||
|
io.BackendRendererName = "imgui_impl_sdlrenderer";
|
||||||
|
io.BackendFlags |= ImGuiBackendFlags_RendererHasVtxOffset; // We can honor the ImDrawCmd::VtxOffset field, allowing for large meshes.
|
||||||
|
|
||||||
|
bd->SDLRenderer = renderer;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ImGui_ImplSDLRenderer_Shutdown()
|
||||||
|
{
|
||||||
|
ImGui_ImplSDLRenderer_Data* bd = ImGui_ImplSDLRenderer_GetBackendData();
|
||||||
|
IM_ASSERT(bd != NULL && "No renderer backend to shutdown, or already shutdown?");
|
||||||
|
ImGuiIO& io = ImGui::GetIO();
|
||||||
|
|
||||||
|
ImGui_ImplSDLRenderer_DestroyDeviceObjects();
|
||||||
|
|
||||||
|
io.BackendRendererName = NULL;
|
||||||
|
io.BackendRendererUserData = NULL;
|
||||||
|
IM_DELETE(bd);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void ImGui_ImplSDLRenderer_SetupRenderState()
|
||||||
|
{
|
||||||
|
ImGui_ImplSDLRenderer_Data* bd = ImGui_ImplSDLRenderer_GetBackendData();
|
||||||
|
|
||||||
|
// Clear out any viewports and cliprect set by the user
|
||||||
|
// FIXME: Technically speaking there are lots of other things we could backup/setup/restore during our render process.
|
||||||
|
SDL_RenderSetViewport(bd->SDLRenderer, NULL);
|
||||||
|
SDL_RenderSetClipRect(bd->SDLRenderer, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ImGui_ImplSDLRenderer_NewFrame()
|
||||||
|
{
|
||||||
|
ImGui_ImplSDLRenderer_Data* bd = ImGui_ImplSDLRenderer_GetBackendData();
|
||||||
|
IM_ASSERT(bd != NULL && "Did you call ImGui_ImplSDLRenderer_Init()?");
|
||||||
|
|
||||||
|
if (!bd->FontTexture)
|
||||||
|
ImGui_ImplSDLRenderer_CreateDeviceObjects();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ImGui_ImplSDLRenderer_RenderDrawData(ImDrawData* draw_data)
|
||||||
|
{
|
||||||
|
ImGui_ImplSDLRenderer_Data* bd = ImGui_ImplSDLRenderer_GetBackendData();
|
||||||
|
|
||||||
|
// If there's a scale factor set by the user, use that instead
|
||||||
|
// If the user has specified a scale factor to SDL_Renderer already via SDL_RenderSetScale(), SDL will scale whatever we pass
|
||||||
|
// to SDL_RenderGeometryRaw() by that scale factor. In that case we don't want to be also scaling it ourselves here.
|
||||||
|
float rsx = 1.0f;
|
||||||
|
float rsy = 1.0f;
|
||||||
|
SDL_RenderGetScale(bd->SDLRenderer, &rsx, &rsy);
|
||||||
|
ImVec2 render_scale;
|
||||||
|
render_scale.x = (rsx == 1.0f) ? draw_data->FramebufferScale.x : 1.0f;
|
||||||
|
render_scale.y = (rsy == 1.0f) ? draw_data->FramebufferScale.y : 1.0f;
|
||||||
|
|
||||||
|
// Avoid rendering when minimized, scale coordinates for retina displays (screen coordinates != framebuffer coordinates)
|
||||||
|
int fb_width = (int)(draw_data->DisplaySize.x * render_scale.x);
|
||||||
|
int fb_height = (int)(draw_data->DisplaySize.y * render_scale.y);
|
||||||
|
if (fb_width == 0 || fb_height == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// Backup SDL_Renderer state that will be modified to restore it afterwards
|
||||||
|
struct BackupSDLRendererState
|
||||||
|
{
|
||||||
|
SDL_Rect Viewport;
|
||||||
|
bool ClipEnabled;
|
||||||
|
SDL_Rect ClipRect;
|
||||||
|
};
|
||||||
|
BackupSDLRendererState old = {};
|
||||||
|
old.ClipEnabled = SDL_RenderIsClipEnabled(bd->SDLRenderer) == SDL_TRUE;
|
||||||
|
SDL_RenderGetViewport(bd->SDLRenderer, &old.Viewport);
|
||||||
|
SDL_RenderGetClipRect(bd->SDLRenderer, &old.ClipRect);
|
||||||
|
|
||||||
|
// Will project scissor/clipping rectangles into framebuffer space
|
||||||
|
ImVec2 clip_off = draw_data->DisplayPos; // (0,0) unless using multi-viewports
|
||||||
|
ImVec2 clip_scale = render_scale;
|
||||||
|
|
||||||
|
// Render command lists
|
||||||
|
ImGui_ImplSDLRenderer_SetupRenderState();
|
||||||
|
for (int n = 0; n < draw_data->CmdListsCount; n++)
|
||||||
|
{
|
||||||
|
const ImDrawList* cmd_list = draw_data->CmdLists[n];
|
||||||
|
const ImDrawVert* vtx_buffer = cmd_list->VtxBuffer.Data;
|
||||||
|
const ImDrawIdx* idx_buffer = cmd_list->IdxBuffer.Data;
|
||||||
|
|
||||||
|
for (int cmd_i = 0; cmd_i < cmd_list->CmdBuffer.Size; cmd_i++)
|
||||||
|
{
|
||||||
|
const ImDrawCmd* pcmd = &cmd_list->CmdBuffer[cmd_i];
|
||||||
|
if (pcmd->UserCallback)
|
||||||
|
{
|
||||||
|
// User callback, registered via ImDrawList::AddCallback()
|
||||||
|
// (ImDrawCallback_ResetRenderState is a special callback value used by the user to request the renderer to reset render state.)
|
||||||
|
if (pcmd->UserCallback == ImDrawCallback_ResetRenderState)
|
||||||
|
ImGui_ImplSDLRenderer_SetupRenderState();
|
||||||
|
else
|
||||||
|
pcmd->UserCallback(cmd_list, pcmd);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Project scissor/clipping rectangles into framebuffer space
|
||||||
|
ImVec2 clip_min((pcmd->ClipRect.x - clip_off.x) * clip_scale.x, (pcmd->ClipRect.y - clip_off.y) * clip_scale.y);
|
||||||
|
ImVec2 clip_max((pcmd->ClipRect.z - clip_off.x) * clip_scale.x, (pcmd->ClipRect.w - clip_off.y) * clip_scale.y);
|
||||||
|
if (clip_min.x < 0.0f) { clip_min.x = 0.0f; }
|
||||||
|
if (clip_min.y < 0.0f) { clip_min.y = 0.0f; }
|
||||||
|
if (clip_max.x > fb_width) { clip_max.x = (float)fb_width; }
|
||||||
|
if (clip_max.y > fb_height) { clip_max.y = (float)fb_height; }
|
||||||
|
if (clip_max.x <= clip_min.x || clip_max.y <= clip_min.y)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
SDL_Rect r = { (int)(clip_min.x), (int)(clip_min.y), (int)(clip_max.x - clip_min.x), (int)(clip_max.y - clip_min.y) };
|
||||||
|
SDL_RenderSetClipRect(bd->SDLRenderer, &r);
|
||||||
|
|
||||||
|
const float* xy = (const float*)((const char*)(vtx_buffer + pcmd->VtxOffset) + IM_OFFSETOF(ImDrawVert, pos));
|
||||||
|
const float* uv = (const float*)((const char*)(vtx_buffer + pcmd->VtxOffset) + IM_OFFSETOF(ImDrawVert, uv));
|
||||||
|
#if SDL_VERSION_ATLEAST(2,0,19)
|
||||||
|
const SDL_Color* color = (const SDL_Color*)((const char*)(vtx_buffer + pcmd->VtxOffset) + IM_OFFSETOF(ImDrawVert, col)); // SDL 2.0.19+
|
||||||
|
#else
|
||||||
|
const int* color = (const int*)((const char*)(vtx_buffer + pcmd->VtxOffset) + IM_OFFSETOF(ImDrawVert, col)); // SDL 2.0.17 and 2.0.18
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Bind texture, Draw
|
||||||
|
SDL_Texture* tex = (SDL_Texture*)pcmd->GetTexID();
|
||||||
|
SDL_RenderGeometryRaw(bd->SDLRenderer, tex,
|
||||||
|
xy, (int)sizeof(ImDrawVert),
|
||||||
|
color, (int)sizeof(ImDrawVert),
|
||||||
|
uv, (int)sizeof(ImDrawVert),
|
||||||
|
cmd_list->VtxBuffer.Size - pcmd->VtxOffset,
|
||||||
|
idx_buffer + pcmd->IdxOffset, pcmd->ElemCount, sizeof(ImDrawIdx));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Restore modified SDL_Renderer state
|
||||||
|
SDL_RenderSetViewport(bd->SDLRenderer, &old.Viewport);
|
||||||
|
SDL_RenderSetClipRect(bd->SDLRenderer, old.ClipEnabled ? &old.ClipRect : NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Called by Init/NewFrame/Shutdown
|
||||||
|
bool ImGui_ImplSDLRenderer_CreateFontsTexture()
|
||||||
|
{
|
||||||
|
ImGuiIO& io = ImGui::GetIO();
|
||||||
|
ImGui_ImplSDLRenderer_Data* bd = ImGui_ImplSDLRenderer_GetBackendData();
|
||||||
|
|
||||||
|
// Build texture atlas
|
||||||
|
unsigned char* pixels;
|
||||||
|
int width, height;
|
||||||
|
io.Fonts->GetTexDataAsRGBA32(&pixels, &width, &height); // Load as RGBA 32-bit (75% of the memory is wasted, but default font is so small) because it is more likely to be compatible with user's existing shaders. If your ImTextureId represent a higher-level concept than just a GL texture id, consider calling GetTexDataAsAlpha8() instead to save on GPU memory.
|
||||||
|
|
||||||
|
// Upload texture to graphics system
|
||||||
|
bd->FontTexture = SDL_CreateTexture(bd->SDLRenderer, SDL_PIXELFORMAT_RGBA32, SDL_TEXTUREACCESS_STATIC, width, height);
|
||||||
|
if (bd->FontTexture == NULL)
|
||||||
|
{
|
||||||
|
SDL_Log("error creating texture");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
SDL_UpdateTexture(bd->FontTexture, NULL, pixels, 4 * width);
|
||||||
|
SDL_SetTextureBlendMode(bd->FontTexture, SDL_BLENDMODE_BLEND);
|
||||||
|
|
||||||
|
// Store our identifier
|
||||||
|
io.Fonts->SetTexID((ImTextureID)(intptr_t)bd->FontTexture);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ImGui_ImplSDLRenderer_DestroyFontsTexture()
|
||||||
|
{
|
||||||
|
ImGuiIO& io = ImGui::GetIO();
|
||||||
|
ImGui_ImplSDLRenderer_Data* bd = ImGui_ImplSDLRenderer_GetBackendData();
|
||||||
|
if (bd->FontTexture)
|
||||||
|
{
|
||||||
|
io.Fonts->SetTexID(0);
|
||||||
|
SDL_DestroyTexture(bd->FontTexture);
|
||||||
|
bd->FontTexture = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ImGui_ImplSDLRenderer_CreateDeviceObjects()
|
||||||
|
{
|
||||||
|
return ImGui_ImplSDLRenderer_CreateFontsTexture();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ImGui_ImplSDLRenderer_DestroyDeviceObjects()
|
||||||
|
{
|
||||||
|
ImGui_ImplSDLRenderer_DestroyFontsTexture();
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
// dear imgui: Renderer Backend for SDL_Renderer
|
||||||
|
// (Requires: SDL 2.0.17+)
|
||||||
|
|
||||||
|
// Important to understand: SDL_Renderer is an _optional_ component of SDL.
|
||||||
|
// For a multi-platform app consider using e.g. SDL+DirectX on Windows and SDL+OpenGL on Linux/OSX.
|
||||||
|
// If your application will want to render any non trivial amount of graphics other than UI,
|
||||||
|
// please be aware that SDL_Renderer offers a limited graphic API to the end-user and it might
|
||||||
|
// be difficult to step out of those boundaries.
|
||||||
|
// However, we understand it is a convenient choice to get an app started easily.
|
||||||
|
|
||||||
|
// Implemented features:
|
||||||
|
// [X] Renderer: User texture binding. Use 'SDL_Texture*' as ImTextureID. Read the FAQ about ImTextureID!
|
||||||
|
// [X] Renderer: Support for large meshes (64k+ vertices) with 16-bit indices.
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
#include "imgui.h" // IMGUI_IMPL_API
|
||||||
|
|
||||||
|
struct SDL_Renderer;
|
||||||
|
|
||||||
|
IMGUI_IMPL_API bool ImGui_ImplSDLRenderer_Init(SDL_Renderer* renderer);
|
||||||
|
IMGUI_IMPL_API void ImGui_ImplSDLRenderer_Shutdown();
|
||||||
|
IMGUI_IMPL_API void ImGui_ImplSDLRenderer_NewFrame();
|
||||||
|
IMGUI_IMPL_API void ImGui_ImplSDLRenderer_RenderDrawData(ImDrawData* draw_data);
|
||||||
|
|
||||||
|
// Called by Init/NewFrame/Shutdown
|
||||||
|
IMGUI_IMPL_API bool ImGui_ImplSDLRenderer_CreateFontsTexture();
|
||||||
|
IMGUI_IMPL_API void ImGui_ImplSDLRenderer_DestroyFontsTexture();
|
||||||
|
IMGUI_IMPL_API bool ImGui_ImplSDLRenderer_CreateDeviceObjects();
|
||||||
|
IMGUI_IMPL_API void ImGui_ImplSDLRenderer_DestroyDeviceObjects();
|
||||||
+294
-186
@@ -1,4 +1,4 @@
|
|||||||
// dear imgui, v1.84
|
// dear imgui, v1.86
|
||||||
// (internal structures/api)
|
// (internal structures/api)
|
||||||
|
|
||||||
// You may use this file to debug, understand or extend ImGui features but we don't provide any guarantee of forward compatibility!
|
// You may use this file to debug, understand or extend ImGui features but we don't provide any guarantee of forward compatibility!
|
||||||
@@ -18,12 +18,14 @@ Index of this file:
|
|||||||
// [SECTION] Generic helpers
|
// [SECTION] Generic helpers
|
||||||
// [SECTION] ImDrawList support
|
// [SECTION] ImDrawList support
|
||||||
// [SECTION] Widgets support: flags, enums, data structures
|
// [SECTION] Widgets support: flags, enums, data structures
|
||||||
|
// [SECTION] Clipper support
|
||||||
|
// [SECTION] Navigation support
|
||||||
// [SECTION] Columns support
|
// [SECTION] Columns support
|
||||||
// [SECTION] Multi-select support
|
// [SECTION] Multi-select support
|
||||||
// [SECTION] Docking support
|
// [SECTION] Docking support
|
||||||
// [SECTION] Viewport support
|
// [SECTION] Viewport support
|
||||||
// [SECTION] Settings support
|
// [SECTION] Settings support
|
||||||
// [SECTION] Metrics, Debug
|
// [SECTION] Metrics, Debug tools
|
||||||
// [SECTION] Generic context hooks
|
// [SECTION] Generic context hooks
|
||||||
// [SECTION] ImGuiContext (main imgui context)
|
// [SECTION] ImGuiContext (main imgui context)
|
||||||
// [SECTION] ImGuiWindowTempData, ImGuiWindow
|
// [SECTION] ImGuiWindowTempData, ImGuiWindow
|
||||||
@@ -82,19 +84,13 @@ Index of this file:
|
|||||||
#pragma clang diagnostic ignored "-Wzero-as-null-pointer-constant"
|
#pragma clang diagnostic ignored "-Wzero-as-null-pointer-constant"
|
||||||
#pragma clang diagnostic ignored "-Wdouble-promotion"
|
#pragma clang diagnostic ignored "-Wdouble-promotion"
|
||||||
#pragma clang diagnostic ignored "-Wimplicit-int-float-conversion" // warning: implicit conversion from 'xxx' to 'float' may lose precision
|
#pragma clang diagnostic ignored "-Wimplicit-int-float-conversion" // warning: implicit conversion from 'xxx' to 'float' may lose precision
|
||||||
|
#pragma clang diagnostic ignored "-Wmissing-noreturn" // warning: function 'xxx' could be declared with attribute 'noreturn'
|
||||||
#elif defined(__GNUC__)
|
#elif defined(__GNUC__)
|
||||||
#pragma GCC diagnostic push
|
#pragma GCC diagnostic push
|
||||||
#pragma GCC diagnostic ignored "-Wpragmas" // warning: unknown option after '#pragma GCC diagnostic' kind
|
#pragma GCC diagnostic ignored "-Wpragmas" // warning: unknown option after '#pragma GCC diagnostic' kind
|
||||||
#pragma GCC diagnostic ignored "-Wclass-memaccess" // [__GNUC__ >= 8] warning: 'memset/memcpy' clearing/writing an object of type 'xxxx' with no trivial copy-assignment; use assignment or value-initialization instead
|
#pragma GCC diagnostic ignored "-Wclass-memaccess" // [__GNUC__ >= 8] warning: 'memset/memcpy' clearing/writing an object of type 'xxxx' with no trivial copy-assignment; use assignment or value-initialization instead
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Helper macros
|
|
||||||
#if defined(__clang__)
|
|
||||||
#define IM_NORETURN __attribute__((noreturn))
|
|
||||||
#else
|
|
||||||
#define IM_NORETURN
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Legacy defines
|
// Legacy defines
|
||||||
#ifdef IMGUI_DISABLE_FORMAT_STRING_FUNCTIONS // Renamed in 1.74
|
#ifdef IMGUI_DISABLE_FORMAT_STRING_FUNCTIONS // Renamed in 1.74
|
||||||
#error Use IMGUI_DISABLE_DEFAULT_FORMAT_FUNCTIONS
|
#error Use IMGUI_DISABLE_DEFAULT_FORMAT_FUNCTIONS
|
||||||
@@ -148,8 +144,8 @@ struct ImGuiWindowSettings; // Storage for a window .ini settings (we ke
|
|||||||
|
|
||||||
// Use your programming IDE "Go to definition" facility on the names of the center columns to find the actual flags/enum lists.
|
// Use your programming IDE "Go to definition" facility on the names of the center columns to find the actual flags/enum lists.
|
||||||
typedef int ImGuiLayoutType; // -> enum ImGuiLayoutType_ // Enum: Horizontal or vertical
|
typedef int ImGuiLayoutType; // -> enum ImGuiLayoutType_ // Enum: Horizontal or vertical
|
||||||
|
typedef int ImGuiActivateFlags; // -> enum ImGuiActivateFlags_ // Flags: for navigation/focus function (will be for ActivateItem() later)
|
||||||
typedef int ImGuiItemFlags; // -> enum ImGuiItemFlags_ // Flags: for PushItemFlag()
|
typedef int ImGuiItemFlags; // -> enum ImGuiItemFlags_ // Flags: for PushItemFlag()
|
||||||
typedef int ImGuiItemAddFlags; // -> enum ImGuiItemAddFlags_ // Flags: for ItemAdd()
|
|
||||||
typedef int ImGuiItemStatusFlags; // -> enum ImGuiItemStatusFlags_ // Flags: for DC.LastItemStatusFlags
|
typedef int ImGuiItemStatusFlags; // -> enum ImGuiItemStatusFlags_ // Flags: for DC.LastItemStatusFlags
|
||||||
typedef int ImGuiOldColumnFlags; // -> enum ImGuiOldColumnFlags_ // Flags: for BeginColumns()
|
typedef int ImGuiOldColumnFlags; // -> enum ImGuiOldColumnFlags_ // Flags: for BeginColumns()
|
||||||
typedef int ImGuiNavHighlightFlags; // -> enum ImGuiNavHighlightFlags_ // Flags: for RenderNavHighlight()
|
typedef int ImGuiNavHighlightFlags; // -> enum ImGuiNavHighlightFlags_ // Flags: for RenderNavHighlight()
|
||||||
@@ -157,6 +153,7 @@ typedef int ImGuiNavDirSourceFlags; // -> enum ImGuiNavDirSourceFlags_ // F
|
|||||||
typedef int ImGuiNavMoveFlags; // -> enum ImGuiNavMoveFlags_ // Flags: for navigation requests
|
typedef int ImGuiNavMoveFlags; // -> enum ImGuiNavMoveFlags_ // Flags: for navigation requests
|
||||||
typedef int ImGuiNextItemDataFlags; // -> enum ImGuiNextItemDataFlags_ // Flags: for SetNextItemXXX() functions
|
typedef int ImGuiNextItemDataFlags; // -> enum ImGuiNextItemDataFlags_ // Flags: for SetNextItemXXX() functions
|
||||||
typedef int ImGuiNextWindowDataFlags; // -> enum ImGuiNextWindowDataFlags_// Flags: for SetNextWindowXXX() functions
|
typedef int ImGuiNextWindowDataFlags; // -> enum ImGuiNextWindowDataFlags_// Flags: for SetNextWindowXXX() functions
|
||||||
|
typedef int ImGuiScrollFlags; // -> enum ImGuiScrollFlags_ // Flags: for ScrollToItem() and navigation requests
|
||||||
typedef int ImGuiSeparatorFlags; // -> enum ImGuiSeparatorFlags_ // Flags: for SeparatorEx()
|
typedef int ImGuiSeparatorFlags; // -> enum ImGuiSeparatorFlags_ // Flags: for SeparatorEx()
|
||||||
typedef int ImGuiTextFlags; // -> enum ImGuiTextFlags_ // Flags: for TextEx()
|
typedef int ImGuiTextFlags; // -> enum ImGuiTextFlags_ // Flags: for TextEx()
|
||||||
typedef int ImGuiTooltipFlags; // -> enum ImGuiTooltipFlags_ // Flags: for BeginTooltipEx()
|
typedef int ImGuiTooltipFlags; // -> enum ImGuiTooltipFlags_ // Flags: for BeginTooltipEx()
|
||||||
@@ -256,12 +253,19 @@ namespace ImStb
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Debug Tools
|
// Debug Tools
|
||||||
// Use 'Metrics->Tools->Item Picker' to break into the call-stack of a specific item.
|
// Use 'Metrics/Debugger->Tools->Item Picker' to break into the call-stack of a specific item.
|
||||||
|
// This will call IM_DEBUG_BREAK() which you may redefine yourself. See https://github.com/scottt/debugbreak for more reference.
|
||||||
#ifndef IM_DEBUG_BREAK
|
#ifndef IM_DEBUG_BREAK
|
||||||
#if defined(__clang__)
|
#if defined (_MSC_VER)
|
||||||
#define IM_DEBUG_BREAK() __builtin_debugtrap()
|
|
||||||
#elif defined (_MSC_VER)
|
|
||||||
#define IM_DEBUG_BREAK() __debugbreak()
|
#define IM_DEBUG_BREAK() __debugbreak()
|
||||||
|
#elif defined(__clang__)
|
||||||
|
#define IM_DEBUG_BREAK() __builtin_debugtrap()
|
||||||
|
#elif defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
|
||||||
|
#define IM_DEBUG_BREAK() __asm__ volatile("int $0x03")
|
||||||
|
#elif defined(__GNUC__) && defined(__thumb__)
|
||||||
|
#define IM_DEBUG_BREAK() __asm__ volatile(".inst 0xde01")
|
||||||
|
#elif defined(__GNUC__) && defined(__arm__) && !defined(__thumb__)
|
||||||
|
#define IM_DEBUG_BREAK() __asm__ volatile(".inst 0xe7f001f0");
|
||||||
#else
|
#else
|
||||||
#define IM_DEBUG_BREAK() IM_ASSERT(0) // It is expected that you define IM_DEBUG_BREAK() into something that will break nicely in a debugger!
|
#define IM_DEBUG_BREAK() IM_ASSERT(0) // It is expected that you define IM_DEBUG_BREAK() into something that will break nicely in a debugger!
|
||||||
#endif
|
#endif
|
||||||
@@ -298,7 +302,9 @@ static inline ImGuiID ImHash(const void* data, int size, ImU32 seed = 0) { ret
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Helpers: Sorting
|
// Helpers: Sorting
|
||||||
#define ImQsort qsort
|
#ifndef ImQsort
|
||||||
|
static inline void ImQsort(void* base, size_t count, size_t size_of_element, int(IMGUI_CDECL *compare_func)(void const*, void const*)) { if (count > 1) qsort(base, count, size_of_element, compare_func); }
|
||||||
|
#endif
|
||||||
|
|
||||||
// Helpers: Color Blending
|
// Helpers: Color Blending
|
||||||
IMGUI_API ImU32 ImAlphaBlendColors(ImU32 col_a, ImU32 col_b);
|
IMGUI_API ImU32 ImAlphaBlendColors(ImU32 col_a, ImU32 col_b);
|
||||||
@@ -405,8 +411,8 @@ static inline double ImLog(double x) { return log(x); }
|
|||||||
static inline int ImAbs(int x) { return x < 0 ? -x : x; }
|
static inline int ImAbs(int x) { return x < 0 ? -x : x; }
|
||||||
static inline float ImAbs(float x) { return fabsf(x); }
|
static inline float ImAbs(float x) { return fabsf(x); }
|
||||||
static inline double ImAbs(double x) { return fabs(x); }
|
static inline double ImAbs(double x) { return fabs(x); }
|
||||||
static inline float ImSign(float x) { return (x < 0.0f) ? -1.0f : ((x > 0.0f) ? 1.0f : 0.0f); } // Sign operator - returns -1, 0 or 1 based on sign of argument
|
static inline float ImSign(float x) { return (x < 0.0f) ? -1.0f : (x > 0.0f) ? 1.0f : 0.0f; } // Sign operator - returns -1, 0 or 1 based on sign of argument
|
||||||
static inline double ImSign(double x) { return (x < 0.0) ? -1.0 : ((x > 0.0) ? 1.0 : 0.0); }
|
static inline double ImSign(double x) { return (x < 0.0) ? -1.0 : (x > 0.0) ? 1.0 : 0.0; }
|
||||||
#ifdef IMGUI_ENABLE_SSE
|
#ifdef IMGUI_ENABLE_SSE
|
||||||
static inline float ImRsqrt(float x) { return _mm_cvtss_f32(_mm_rsqrt_ss(_mm_set_ss(x))); }
|
static inline float ImRsqrt(float x) { return _mm_cvtss_f32(_mm_rsqrt_ss(_mm_set_ss(x))); }
|
||||||
#else
|
#else
|
||||||
@@ -442,6 +448,7 @@ static inline float ImDot(const ImVec2& a, const ImVec2& b)
|
|||||||
static inline ImVec2 ImRotate(const ImVec2& v, float cos_a, float sin_a) { return ImVec2(v.x * cos_a - v.y * sin_a, v.x * sin_a + v.y * cos_a); }
|
static inline ImVec2 ImRotate(const ImVec2& v, float cos_a, float sin_a) { return ImVec2(v.x * cos_a - v.y * sin_a, v.x * sin_a + v.y * cos_a); }
|
||||||
static inline float ImLinearSweep(float current, float target, float speed) { if (current < target) return ImMin(current + speed, target); if (current > target) return ImMax(current - speed, target); return current; }
|
static inline float ImLinearSweep(float current, float target, float speed) { if (current < target) return ImMin(current + speed, target); if (current > target) return ImMax(current - speed, target); return current; }
|
||||||
static inline ImVec2 ImMul(const ImVec2& lhs, const ImVec2& rhs) { return ImVec2(lhs.x * rhs.x, lhs.y * rhs.y); }
|
static inline ImVec2 ImMul(const ImVec2& lhs, const ImVec2& rhs) { return ImVec2(lhs.x * rhs.x, lhs.y * rhs.y); }
|
||||||
|
static inline bool ImIsFloatAboveGuaranteedIntegerPrecision(float f) { return f <= -16777216 || f >= 16777216; }
|
||||||
IM_MSVC_RUNTIME_CHECKS_RESTORE
|
IM_MSVC_RUNTIME_CHECKS_RESTORE
|
||||||
|
|
||||||
// Helpers: Geometry
|
// Helpers: Geometry
|
||||||
@@ -747,15 +754,8 @@ enum ImGuiItemFlags_
|
|||||||
ImGuiItemFlags_NoNavDefaultFocus = 1 << 4, // false // Disable item being a candidate for default focus (e.g. used by title bar items)
|
ImGuiItemFlags_NoNavDefaultFocus = 1 << 4, // false // Disable item being a candidate for default focus (e.g. used by title bar items)
|
||||||
ImGuiItemFlags_SelectableDontClosePopup = 1 << 5, // false // Disable MenuItem/Selectable() automatically closing their popup window
|
ImGuiItemFlags_SelectableDontClosePopup = 1 << 5, // false // Disable MenuItem/Selectable() automatically closing their popup window
|
||||||
ImGuiItemFlags_MixedValue = 1 << 6, // false // [BETA] Represent a mixed/indeterminate value, generally multi-selection where values differ. Currently only supported by Checkbox() (later should support all sorts of widgets)
|
ImGuiItemFlags_MixedValue = 1 << 6, // false // [BETA] Represent a mixed/indeterminate value, generally multi-selection where values differ. Currently only supported by Checkbox() (later should support all sorts of widgets)
|
||||||
ImGuiItemFlags_ReadOnly = 1 << 7 // false // [ALPHA] Allow hovering interactions but underlying value is not changed.
|
ImGuiItemFlags_ReadOnly = 1 << 7, // false // [ALPHA] Allow hovering interactions but underlying value is not changed.
|
||||||
};
|
ImGuiItemFlags_Inputable = 1 << 8 // false // [WIP] Auto-activate input mode when tab focused. Currently only used and supported by a few items before it becomes a generic feature.
|
||||||
|
|
||||||
// Flags for ItemAdd()
|
|
||||||
// FIXME-NAV: _Focusable is _ALMOST_ what you would expect to be called '_TabStop' but because SetKeyboardFocusHere() works on items with no TabStop we distinguish Focusable from TabStop.
|
|
||||||
enum ImGuiItemAddFlags_
|
|
||||||
{
|
|
||||||
ImGuiItemAddFlags_None = 0,
|
|
||||||
ImGuiItemAddFlags_Focusable = 1 << 0 // FIXME-NAV: In current/legacy scheme, Focusable+TabStop support are opt-in by widgets. We will transition it toward being opt-out, so this flag is expected to eventually disappear.
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Storage for LastItem data
|
// Storage for LastItem data
|
||||||
@@ -763,16 +763,14 @@ enum ImGuiItemStatusFlags_
|
|||||||
{
|
{
|
||||||
ImGuiItemStatusFlags_None = 0,
|
ImGuiItemStatusFlags_None = 0,
|
||||||
ImGuiItemStatusFlags_HoveredRect = 1 << 0, // Mouse position is within item rectangle (does NOT mean that the window is in correct z-order and can be hovered!, this is only one part of the most-common IsItemHovered test)
|
ImGuiItemStatusFlags_HoveredRect = 1 << 0, // Mouse position is within item rectangle (does NOT mean that the window is in correct z-order and can be hovered!, this is only one part of the most-common IsItemHovered test)
|
||||||
ImGuiItemStatusFlags_HasDisplayRect = 1 << 1, // window->DC.LastItemDisplayRect is valid
|
ImGuiItemStatusFlags_HasDisplayRect = 1 << 1, // g.LastItemData.DisplayRect is valid
|
||||||
ImGuiItemStatusFlags_Edited = 1 << 2, // Value exposed by item was edited in the current frame (should match the bool return value of most widgets)
|
ImGuiItemStatusFlags_Edited = 1 << 2, // Value exposed by item was edited in the current frame (should match the bool return value of most widgets)
|
||||||
ImGuiItemStatusFlags_ToggledSelection = 1 << 3, // Set when Selectable(), TreeNode() reports toggling a selection. We can't report "Selected", only state changes, in order to easily handle clipping with less issues.
|
ImGuiItemStatusFlags_ToggledSelection = 1 << 3, // Set when Selectable(), TreeNode() reports toggling a selection. We can't report "Selected", only state changes, in order to easily handle clipping with less issues.
|
||||||
ImGuiItemStatusFlags_ToggledOpen = 1 << 4, // Set when TreeNode() reports toggling their open state.
|
ImGuiItemStatusFlags_ToggledOpen = 1 << 4, // Set when TreeNode() reports toggling their open state.
|
||||||
ImGuiItemStatusFlags_HasDeactivated = 1 << 5, // Set if the widget/group is able to provide data for the ImGuiItemStatusFlags_Deactivated flag.
|
ImGuiItemStatusFlags_HasDeactivated = 1 << 5, // Set if the widget/group is able to provide data for the ImGuiItemStatusFlags_Deactivated flag.
|
||||||
ImGuiItemStatusFlags_Deactivated = 1 << 6, // Only valid if ImGuiItemStatusFlags_HasDeactivated is set.
|
ImGuiItemStatusFlags_Deactivated = 1 << 6, // Only valid if ImGuiItemStatusFlags_HasDeactivated is set.
|
||||||
ImGuiItemStatusFlags_HoveredWindow = 1 << 7, // Override the HoveredWindow test to allow cross-window hover testing.
|
ImGuiItemStatusFlags_HoveredWindow = 1 << 7, // Override the HoveredWindow test to allow cross-window hover testing.
|
||||||
ImGuiItemStatusFlags_FocusedByCode = 1 << 8, // Set when the Focusable item just got focused from code.
|
ImGuiItemStatusFlags_FocusedByTabbing = 1 << 8 // Set when the Focusable item just got focused by Tabbing (FIXME: to be removed soon)
|
||||||
ImGuiItemStatusFlags_FocusedByTabbing = 1 << 9, // Set when the Focusable item just got focused by Tabbing.
|
|
||||||
ImGuiItemStatusFlags_Focused = ImGuiItemStatusFlags_FocusedByCode | ImGuiItemStatusFlags_FocusedByTabbing
|
|
||||||
|
|
||||||
#ifdef IMGUI_ENABLE_TEST_ENGINE
|
#ifdef IMGUI_ENABLE_TEST_ENGINE
|
||||||
, // [imgui_tests only]
|
, // [imgui_tests only]
|
||||||
@@ -921,49 +919,6 @@ enum ImGuiInputReadMode
|
|||||||
ImGuiInputReadMode_RepeatFast
|
ImGuiInputReadMode_RepeatFast
|
||||||
};
|
};
|
||||||
|
|
||||||
enum ImGuiNavHighlightFlags_
|
|
||||||
{
|
|
||||||
ImGuiNavHighlightFlags_None = 0,
|
|
||||||
ImGuiNavHighlightFlags_TypeDefault = 1 << 0,
|
|
||||||
ImGuiNavHighlightFlags_TypeThin = 1 << 1,
|
|
||||||
ImGuiNavHighlightFlags_AlwaysDraw = 1 << 2, // Draw rectangular highlight if (g.NavId == id) _even_ when using the mouse.
|
|
||||||
ImGuiNavHighlightFlags_NoRounding = 1 << 3
|
|
||||||
};
|
|
||||||
|
|
||||||
enum ImGuiNavDirSourceFlags_
|
|
||||||
{
|
|
||||||
ImGuiNavDirSourceFlags_None = 0,
|
|
||||||
ImGuiNavDirSourceFlags_Keyboard = 1 << 0,
|
|
||||||
ImGuiNavDirSourceFlags_PadDPad = 1 << 1,
|
|
||||||
ImGuiNavDirSourceFlags_PadLStick = 1 << 2
|
|
||||||
};
|
|
||||||
|
|
||||||
enum ImGuiNavMoveFlags_
|
|
||||||
{
|
|
||||||
ImGuiNavMoveFlags_None = 0,
|
|
||||||
ImGuiNavMoveFlags_LoopX = 1 << 0, // On failed request, restart from opposite side
|
|
||||||
ImGuiNavMoveFlags_LoopY = 1 << 1,
|
|
||||||
ImGuiNavMoveFlags_WrapX = 1 << 2, // On failed request, request from opposite side one line down (when NavDir==right) or one line up (when NavDir==left)
|
|
||||||
ImGuiNavMoveFlags_WrapY = 1 << 3, // This is not super useful for provided for completeness
|
|
||||||
ImGuiNavMoveFlags_AllowCurrentNavId = 1 << 4, // Allow scoring and considering the current NavId as a move target candidate. This is used when the move source is offset (e.g. pressing PageDown actually needs to send a Up move request, if we are pressing PageDown from the bottom-most item we need to stay in place)
|
|
||||||
ImGuiNavMoveFlags_AlsoScoreVisibleSet = 1 << 5, // Store alternate result in NavMoveResultLocalVisibleSet that only comprise elements that are already fully visible.
|
|
||||||
ImGuiNavMoveFlags_ScrollToEdge = 1 << 6
|
|
||||||
};
|
|
||||||
|
|
||||||
enum ImGuiNavForward
|
|
||||||
{
|
|
||||||
ImGuiNavForward_None,
|
|
||||||
ImGuiNavForward_ForwardQueued,
|
|
||||||
ImGuiNavForward_ForwardActive
|
|
||||||
};
|
|
||||||
|
|
||||||
enum ImGuiNavLayer
|
|
||||||
{
|
|
||||||
ImGuiNavLayer_Main = 0, // Main scrolling layer
|
|
||||||
ImGuiNavLayer_Menu = 1, // Menu layer (access with Alt/ImGuiNavInput_Menu)
|
|
||||||
ImGuiNavLayer_COUNT
|
|
||||||
};
|
|
||||||
|
|
||||||
enum ImGuiPopupPositionPolicy
|
enum ImGuiPopupPositionPolicy
|
||||||
{
|
{
|
||||||
ImGuiPopupPositionPolicy_Default,
|
ImGuiPopupPositionPolicy_Default,
|
||||||
@@ -1075,8 +1030,6 @@ struct IMGUI_API ImGuiInputTextState
|
|||||||
bool SelectedAllMouseLock; // after a double-click to select all, we ignore further mouse drags to update selection
|
bool SelectedAllMouseLock; // after a double-click to select all, we ignore further mouse drags to update selection
|
||||||
bool Edited; // edited this frame
|
bool Edited; // edited this frame
|
||||||
ImGuiInputTextFlags Flags; // copy of InputText() flags
|
ImGuiInputTextFlags Flags; // copy of InputText() flags
|
||||||
ImGuiInputTextCallback UserCallback; // "
|
|
||||||
void* UserCallbackData; // "
|
|
||||||
|
|
||||||
ImGuiInputTextState() { memset(this, 0, sizeof(*this)); }
|
ImGuiInputTextState() { memset(this, 0, sizeof(*this)); }
|
||||||
void ClearText() { CurLenW = CurLenA = 0; TextW[0] = 0; TextA[0] = 0; CursorClamp(); }
|
void ClearText() { CurLenW = CurLenA = 0; TextW[0] = 0; TextA[0] = 0; CursorClamp(); }
|
||||||
@@ -1110,20 +1063,6 @@ struct ImGuiPopupData
|
|||||||
ImGuiPopupData() { memset(this, 0, sizeof(*this)); OpenFrameCount = -1; }
|
ImGuiPopupData() { memset(this, 0, sizeof(*this)); OpenFrameCount = -1; }
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ImGuiNavItemData
|
|
||||||
{
|
|
||||||
ImGuiWindow* Window; // Init,Move // Best candidate window (result->ItemWindow->RootWindowForNav == request->Window)
|
|
||||||
ImGuiID ID; // Init,Move // Best candidate item ID
|
|
||||||
ImGuiID FocusScopeId; // Init,Move // Best candidate focus scope ID
|
|
||||||
ImRect RectRel; // Init,Move // Best candidate bounding box in window relative space
|
|
||||||
float DistBox; // Move // Best candidate box distance to current NavId
|
|
||||||
float DistCenter; // Move // Best candidate center distance to current NavId
|
|
||||||
float DistAxial; // Move // Best candidate axial distance to current NavId
|
|
||||||
|
|
||||||
ImGuiNavItemData() { Clear(); }
|
|
||||||
void Clear() { Window = NULL; ID = FocusScopeId = 0; RectRel = ImRect(); DistBox = DistCenter = DistAxial = FLT_MAX; }
|
|
||||||
};
|
|
||||||
|
|
||||||
enum ImGuiNextWindowDataFlags_
|
enum ImGuiNextWindowDataFlags_
|
||||||
{
|
{
|
||||||
ImGuiNextWindowDataFlags_None = 0,
|
ImGuiNextWindowDataFlags_None = 0,
|
||||||
@@ -1185,17 +1124,36 @@ struct ImGuiLastItemData
|
|||||||
ImGuiID ID;
|
ImGuiID ID;
|
||||||
ImGuiItemFlags InFlags; // See ImGuiItemFlags_
|
ImGuiItemFlags InFlags; // See ImGuiItemFlags_
|
||||||
ImGuiItemStatusFlags StatusFlags; // See ImGuiItemStatusFlags_
|
ImGuiItemStatusFlags StatusFlags; // See ImGuiItemStatusFlags_
|
||||||
ImRect Rect;
|
ImRect Rect; // Full rectangle
|
||||||
ImRect DisplayRect;
|
ImRect NavRect; // Navigation scoring rectangle (not displayed)
|
||||||
|
ImRect DisplayRect; // Display rectangle (only if ImGuiItemStatusFlags_HasDisplayRect is set)
|
||||||
|
|
||||||
ImGuiLastItemData() { memset(this, 0, sizeof(*this)); }
|
ImGuiLastItemData() { memset(this, 0, sizeof(*this)); }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct IMGUI_API ImGuiStackSizes
|
||||||
|
{
|
||||||
|
short SizeOfIDStack;
|
||||||
|
short SizeOfColorStack;
|
||||||
|
short SizeOfStyleVarStack;
|
||||||
|
short SizeOfFontStack;
|
||||||
|
short SizeOfFocusScopeStack;
|
||||||
|
short SizeOfGroupStack;
|
||||||
|
short SizeOfItemFlagsStack;
|
||||||
|
short SizeOfBeginPopupStack;
|
||||||
|
short SizeOfDisabledStack;
|
||||||
|
|
||||||
|
ImGuiStackSizes() { memset(this, 0, sizeof(*this)); }
|
||||||
|
void SetToCurrentState();
|
||||||
|
void CompareWithCurrentState();
|
||||||
|
};
|
||||||
|
|
||||||
// Data saved for each window pushed into the stack
|
// Data saved for each window pushed into the stack
|
||||||
struct ImGuiWindowStackData
|
struct ImGuiWindowStackData
|
||||||
{
|
{
|
||||||
ImGuiWindow* Window;
|
ImGuiWindow* Window;
|
||||||
ImGuiLastItemData ParentLastItemDataBackup;
|
ImGuiLastItemData ParentLastItemDataBackup;
|
||||||
|
ImGuiStackSizes StackSizesOnBegin; // Store size of various stacks for asserting
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ImGuiShrinkWidthItem
|
struct ImGuiShrinkWidthItem
|
||||||
@@ -1213,6 +1171,120 @@ struct ImGuiPtrOrIndex
|
|||||||
ImGuiPtrOrIndex(int index) { Ptr = NULL; Index = index; }
|
ImGuiPtrOrIndex(int index) { Ptr = NULL; Index = index; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// [SECTION] Clipper support
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
struct ImGuiListClipperRange
|
||||||
|
{
|
||||||
|
int Min;
|
||||||
|
int Max;
|
||||||
|
bool PosToIndexConvert; // Begin/End are absolute position (will be converted to indices later)
|
||||||
|
ImS8 PosToIndexOffsetMin; // Add to Min after converting to indices
|
||||||
|
ImS8 PosToIndexOffsetMax; // Add to Min after converting to indices
|
||||||
|
|
||||||
|
static ImGuiListClipperRange FromIndices(int min, int max) { ImGuiListClipperRange r = { min, max, false, 0, 0 }; return r; }
|
||||||
|
static ImGuiListClipperRange FromPositions(float y1, float y2, int off_min, int off_max) { ImGuiListClipperRange r = { (int)y1, (int)y2, true, (ImS8)off_min, (ImS8)off_max }; return r; }
|
||||||
|
};
|
||||||
|
|
||||||
|
// Temporary clipper data, buffers shared/reused between instances
|
||||||
|
struct ImGuiListClipperData
|
||||||
|
{
|
||||||
|
ImGuiListClipper* ListClipper;
|
||||||
|
float LossynessOffset;
|
||||||
|
int StepNo;
|
||||||
|
int ItemsFrozen;
|
||||||
|
ImVector<ImGuiListClipperRange> Ranges;
|
||||||
|
|
||||||
|
ImGuiListClipperData() { memset(this, 0, sizeof(*this)); }
|
||||||
|
void Reset(ImGuiListClipper* clipper) { ListClipper = clipper; StepNo = ItemsFrozen = 0; Ranges.resize(0); }
|
||||||
|
};
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// [SECTION] Navigation support
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
enum ImGuiActivateFlags_
|
||||||
|
{
|
||||||
|
ImGuiActivateFlags_None = 0,
|
||||||
|
ImGuiActivateFlags_PreferInput = 1 << 0, // Favor activation that requires keyboard text input (e.g. for Slider/Drag). Default if keyboard is available.
|
||||||
|
ImGuiActivateFlags_PreferTweak = 1 << 1, // Favor activation for tweaking with arrows or gamepad (e.g. for Slider/Drag). Default if keyboard is not available.
|
||||||
|
ImGuiActivateFlags_TryToPreserveState = 1 << 2 // Request widget to preserve state if it can (e.g. InputText will try to preserve cursor/selection)
|
||||||
|
};
|
||||||
|
|
||||||
|
// Early work-in-progress API for ScrollToItem()
|
||||||
|
enum ImGuiScrollFlags_
|
||||||
|
{
|
||||||
|
ImGuiScrollFlags_None = 0,
|
||||||
|
ImGuiScrollFlags_KeepVisibleEdgeX = 1 << 0, // If item is not visible: scroll as little as possible on X axis to bring item back into view [default for X axis]
|
||||||
|
ImGuiScrollFlags_KeepVisibleEdgeY = 1 << 1, // If item is not visible: scroll as little as possible on Y axis to bring item back into view [default for Y axis for windows that are already visible]
|
||||||
|
ImGuiScrollFlags_KeepVisibleCenterX = 1 << 2, // If item is not visible: scroll to make the item centered on X axis [rarely used]
|
||||||
|
ImGuiScrollFlags_KeepVisibleCenterY = 1 << 3, // If item is not visible: scroll to make the item centered on Y axis
|
||||||
|
ImGuiScrollFlags_AlwaysCenterX = 1 << 4, // Always center the result item on X axis [rarely used]
|
||||||
|
ImGuiScrollFlags_AlwaysCenterY = 1 << 5, // Always center the result item on Y axis [default for Y axis for appearing window)
|
||||||
|
ImGuiScrollFlags_NoScrollParent = 1 << 6, // Disable forwarding scrolling to parent window if required to keep item/rect visible (only scroll window the function was applied to).
|
||||||
|
ImGuiScrollFlags_MaskX_ = ImGuiScrollFlags_KeepVisibleEdgeX | ImGuiScrollFlags_KeepVisibleCenterX | ImGuiScrollFlags_AlwaysCenterX,
|
||||||
|
ImGuiScrollFlags_MaskY_ = ImGuiScrollFlags_KeepVisibleEdgeY | ImGuiScrollFlags_KeepVisibleCenterY | ImGuiScrollFlags_AlwaysCenterY
|
||||||
|
};
|
||||||
|
|
||||||
|
enum ImGuiNavHighlightFlags_
|
||||||
|
{
|
||||||
|
ImGuiNavHighlightFlags_None = 0,
|
||||||
|
ImGuiNavHighlightFlags_TypeDefault = 1 << 0,
|
||||||
|
ImGuiNavHighlightFlags_TypeThin = 1 << 1,
|
||||||
|
ImGuiNavHighlightFlags_AlwaysDraw = 1 << 2, // Draw rectangular highlight if (g.NavId == id) _even_ when using the mouse.
|
||||||
|
ImGuiNavHighlightFlags_NoRounding = 1 << 3
|
||||||
|
};
|
||||||
|
|
||||||
|
enum ImGuiNavDirSourceFlags_
|
||||||
|
{
|
||||||
|
ImGuiNavDirSourceFlags_None = 0,
|
||||||
|
ImGuiNavDirSourceFlags_RawKeyboard = 1 << 0, // Raw keyboard (not pulled from nav), faciliate use of some functions before we can unify nav and keys
|
||||||
|
ImGuiNavDirSourceFlags_Keyboard = 1 << 1,
|
||||||
|
ImGuiNavDirSourceFlags_PadDPad = 1 << 2,
|
||||||
|
ImGuiNavDirSourceFlags_PadLStick = 1 << 3
|
||||||
|
};
|
||||||
|
|
||||||
|
enum ImGuiNavMoveFlags_
|
||||||
|
{
|
||||||
|
ImGuiNavMoveFlags_None = 0,
|
||||||
|
ImGuiNavMoveFlags_LoopX = 1 << 0, // On failed request, restart from opposite side
|
||||||
|
ImGuiNavMoveFlags_LoopY = 1 << 1,
|
||||||
|
ImGuiNavMoveFlags_WrapX = 1 << 2, // On failed request, request from opposite side one line down (when NavDir==right) or one line up (when NavDir==left)
|
||||||
|
ImGuiNavMoveFlags_WrapY = 1 << 3, // This is not super useful but provided for completeness
|
||||||
|
ImGuiNavMoveFlags_AllowCurrentNavId = 1 << 4, // Allow scoring and considering the current NavId as a move target candidate. This is used when the move source is offset (e.g. pressing PageDown actually needs to send a Up move request, if we are pressing PageDown from the bottom-most item we need to stay in place)
|
||||||
|
ImGuiNavMoveFlags_AlsoScoreVisibleSet = 1 << 5, // Store alternate result in NavMoveResultLocalVisible that only comprise elements that are already fully visible (used by PageUp/PageDown)
|
||||||
|
ImGuiNavMoveFlags_ScrollToEdgeY = 1 << 6, // Force scrolling to min/max (used by Home/End) // FIXME-NAV: Aim to remove or reword, probably unnecessary
|
||||||
|
ImGuiNavMoveFlags_Forwarded = 1 << 7,
|
||||||
|
ImGuiNavMoveFlags_DebugNoResult = 1 << 8, // Dummy scoring for debug purpose, don't apply result
|
||||||
|
ImGuiNavMoveFlags_FocusApi = 1 << 9,
|
||||||
|
ImGuiNavMoveFlags_Tabbing = 1 << 10, // == Focus + Activate if item is Inputable + DontChangeNavHighlight
|
||||||
|
ImGuiNavMoveFlags_Activate = 1 << 11,
|
||||||
|
ImGuiNavMoveFlags_DontSetNavHighlight = 1 << 12 // Do not alter the visible state of keyboard vs mouse nav highlight
|
||||||
|
};
|
||||||
|
|
||||||
|
enum ImGuiNavLayer
|
||||||
|
{
|
||||||
|
ImGuiNavLayer_Main = 0, // Main scrolling layer
|
||||||
|
ImGuiNavLayer_Menu = 1, // Menu layer (access with Alt/ImGuiNavInput_Menu)
|
||||||
|
ImGuiNavLayer_COUNT
|
||||||
|
};
|
||||||
|
|
||||||
|
struct ImGuiNavItemData
|
||||||
|
{
|
||||||
|
ImGuiWindow* Window; // Init,Move // Best candidate window (result->ItemWindow->RootWindowForNav == request->Window)
|
||||||
|
ImGuiID ID; // Init,Move // Best candidate item ID
|
||||||
|
ImGuiID FocusScopeId; // Init,Move // Best candidate focus scope ID
|
||||||
|
ImRect RectRel; // Init,Move // Best candidate bounding box in window relative space
|
||||||
|
ImGuiItemFlags InFlags; // ????,Move // Best candidate item flags
|
||||||
|
float DistBox; // Move // Best candidate box distance to current NavId
|
||||||
|
float DistCenter; // Move // Best candidate center distance to current NavId
|
||||||
|
float DistAxial; // Move // Best candidate axial distance to current NavId
|
||||||
|
|
||||||
|
ImGuiNavItemData() { Clear(); }
|
||||||
|
void Clear() { Window = NULL; ID = FocusScopeId = 0; InFlags = 0; DistBox = DistCenter = DistAxial = FLT_MAX; }
|
||||||
|
};
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// [SECTION] Columns support
|
// [SECTION] Columns support
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@@ -1352,11 +1424,12 @@ struct ImGuiSettingsHandler
|
|||||||
};
|
};
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// [SECTION] Metrics, Debug
|
// [SECTION] Metrics, Debug Tools
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
struct ImGuiMetricsConfig
|
struct ImGuiMetricsConfig
|
||||||
{
|
{
|
||||||
|
bool ShowStackTool;
|
||||||
bool ShowWindowsRects;
|
bool ShowWindowsRects;
|
||||||
bool ShowWindowsBeginOrder;
|
bool ShowWindowsBeginOrder;
|
||||||
bool ShowTablesRects;
|
bool ShowTablesRects;
|
||||||
@@ -1367,6 +1440,7 @@ struct ImGuiMetricsConfig
|
|||||||
|
|
||||||
ImGuiMetricsConfig()
|
ImGuiMetricsConfig()
|
||||||
{
|
{
|
||||||
|
ShowStackTool = false;
|
||||||
ShowWindowsRects = false;
|
ShowWindowsRects = false;
|
||||||
ShowWindowsBeginOrder = false;
|
ShowWindowsBeginOrder = false;
|
||||||
ShowTablesRects = false;
|
ShowTablesRects = false;
|
||||||
@@ -1377,19 +1451,25 @@ struct ImGuiMetricsConfig
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct IMGUI_API ImGuiStackSizes
|
struct ImGuiStackLevelInfo
|
||||||
{
|
{
|
||||||
short SizeOfIDStack;
|
ImGuiID ID;
|
||||||
short SizeOfColorStack;
|
ImS8 QueryFrameCount; // >= 1: Query in progress
|
||||||
short SizeOfStyleVarStack;
|
bool QuerySuccess; // Obtained result from DebugHookIdInfo()
|
||||||
short SizeOfFontStack;
|
char Desc[58]; // Arbitrarily sized buffer to hold a result (FIXME: could replace Results[] with a chunk stream?)
|
||||||
short SizeOfFocusScopeStack;
|
|
||||||
short SizeOfGroupStack;
|
|
||||||
short SizeOfBeginPopupStack;
|
|
||||||
|
|
||||||
ImGuiStackSizes() { memset(this, 0, sizeof(*this)); }
|
ImGuiStackLevelInfo() { memset(this, 0, sizeof(*this)); }
|
||||||
void SetToCurrentState();
|
};
|
||||||
void CompareWithCurrentState();
|
|
||||||
|
// State for Stack tool queries
|
||||||
|
struct ImGuiStackTool
|
||||||
|
{
|
||||||
|
int LastActiveFrame;
|
||||||
|
int StackLevel; // -1: query stack and resize Results, >= 0: individual stack level
|
||||||
|
ImGuiID QueryId; // ID to query details for
|
||||||
|
ImVector<ImGuiStackLevelInfo> Results;
|
||||||
|
|
||||||
|
ImGuiStackTool() { memset(this, 0, sizeof(*this)); }
|
||||||
};
|
};
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@@ -1433,7 +1513,6 @@ struct ImGuiContext
|
|||||||
bool WithinEndChild; // Set within EndChild()
|
bool WithinEndChild; // Set within EndChild()
|
||||||
bool GcCompactAll; // Request full GC
|
bool GcCompactAll; // Request full GC
|
||||||
bool TestEngineHookItems; // Will call test engine hooks: ImGuiTestEngineHook_ItemAdd(), ImGuiTestEngineHook_ItemInfo(), ImGuiTestEngineHook_Log()
|
bool TestEngineHookItems; // Will call test engine hooks: ImGuiTestEngineHook_ItemAdd(), ImGuiTestEngineHook_ItemInfo(), ImGuiTestEngineHook_Log()
|
||||||
ImGuiID TestEngineHookIdInfo; // Will call test engine hooks: ImGuiTestEngineHook_IdInfo() from GetID()
|
|
||||||
void* TestEngine; // Test engine user data
|
void* TestEngine; // Test engine user data
|
||||||
|
|
||||||
// Windows state
|
// Windows state
|
||||||
@@ -1453,6 +1532,7 @@ struct ImGuiContext
|
|||||||
float WheelingWindowTimer;
|
float WheelingWindowTimer;
|
||||||
|
|
||||||
// Item/widgets state and tracking information
|
// Item/widgets state and tracking information
|
||||||
|
ImGuiID DebugHookIdInfo; // Will call core hooks: DebugHookIdInfo() from GetID functions, used by Stack Tool [next HoveredId/ActiveId to not pull in an extra cache-line]
|
||||||
ImGuiID HoveredId; // Hovered widget, filled during the frame
|
ImGuiID HoveredId; // Hovered widget, filled during the frame
|
||||||
ImGuiID HoveredIdPreviousFrame;
|
ImGuiID HoveredIdPreviousFrame;
|
||||||
bool HoveredIdAllowOverlap;
|
bool HoveredIdAllowOverlap;
|
||||||
@@ -1500,6 +1580,7 @@ struct ImGuiContext
|
|||||||
ImVector<ImGuiGroupData>GroupStack; // Stack for BeginGroup()/EndGroup() - not inherited by Begin()
|
ImVector<ImGuiGroupData>GroupStack; // Stack for BeginGroup()/EndGroup() - not inherited by Begin()
|
||||||
ImVector<ImGuiPopupData>OpenPopupStack; // Which popups are open (persistent)
|
ImVector<ImGuiPopupData>OpenPopupStack; // Which popups are open (persistent)
|
||||||
ImVector<ImGuiPopupData>BeginPopupStack; // Which level of BeginPopup() we are in (reset every frame)
|
ImVector<ImGuiPopupData>BeginPopupStack; // Which level of BeginPopup() we are in (reset every frame)
|
||||||
|
int BeginMenuCount;
|
||||||
|
|
||||||
// Viewports
|
// Viewports
|
||||||
ImVector<ImGuiViewportP*> Viewports; // Active viewports (Size==1 in 'master' branch). Each viewports hold their copy of ImDrawData.
|
ImVector<ImGuiViewportP*> Viewports; // Active viewports (Size==1 in 'master' branch). Each viewports hold their copy of ImDrawData.
|
||||||
@@ -1511,37 +1592,44 @@ struct ImGuiContext
|
|||||||
ImGuiID NavActivateId; // ~~ (g.ActiveId == 0) && IsNavInputPressed(ImGuiNavInput_Activate) ? NavId : 0, also set when calling ActivateItem()
|
ImGuiID NavActivateId; // ~~ (g.ActiveId == 0) && IsNavInputPressed(ImGuiNavInput_Activate) ? NavId : 0, also set when calling ActivateItem()
|
||||||
ImGuiID NavActivateDownId; // ~~ IsNavInputDown(ImGuiNavInput_Activate) ? NavId : 0
|
ImGuiID NavActivateDownId; // ~~ IsNavInputDown(ImGuiNavInput_Activate) ? NavId : 0
|
||||||
ImGuiID NavActivatePressedId; // ~~ IsNavInputPressed(ImGuiNavInput_Activate) ? NavId : 0
|
ImGuiID NavActivatePressedId; // ~~ IsNavInputPressed(ImGuiNavInput_Activate) ? NavId : 0
|
||||||
ImGuiID NavInputId; // ~~ IsNavInputPressed(ImGuiNavInput_Input) ? NavId : 0
|
ImGuiID NavActivateInputId; // ~~ IsNavInputPressed(ImGuiNavInput_Input) ? NavId : 0; ImGuiActivateFlags_PreferInput will be set and NavActivateId will be 0.
|
||||||
ImGuiID NavJustTabbedId; // Just tabbed to this id.
|
ImGuiActivateFlags NavActivateFlags;
|
||||||
ImGuiID NavJustMovedToId; // Just navigated to this id (result of a successfully MoveRequest).
|
ImGuiID NavJustMovedToId; // Just navigated to this id (result of a successfully MoveRequest).
|
||||||
ImGuiID NavJustMovedToFocusScopeId; // Just navigated to this focus scope id (result of a successfully MoveRequest).
|
ImGuiID NavJustMovedToFocusScopeId; // Just navigated to this focus scope id (result of a successfully MoveRequest).
|
||||||
ImGuiKeyModFlags NavJustMovedToKeyMods;
|
ImGuiKeyModFlags NavJustMovedToKeyMods;
|
||||||
ImGuiID NavNextActivateId; // Set by ActivateItem(), queued until next frame.
|
ImGuiID NavNextActivateId; // Set by ActivateItem(), queued until next frame.
|
||||||
|
ImGuiActivateFlags NavNextActivateFlags;
|
||||||
ImGuiInputSource NavInputSource; // Keyboard or Gamepad mode? THIS WILL ONLY BE None or NavGamepad or NavKeyboard.
|
ImGuiInputSource NavInputSource; // Keyboard or Gamepad mode? THIS WILL ONLY BE None or NavGamepad or NavKeyboard.
|
||||||
ImRect NavScoringRect; // Rectangle used for scoring, in screen space. Based of window->NavRectRel[], modified for directional navigation scoring.
|
|
||||||
int NavScoringCount; // Metrics for debugging
|
|
||||||
ImGuiNavLayer NavLayer; // Layer we are navigating on. For now the system is hard-coded for 0=main contents and 1=menu/title bar, may expose layers later.
|
ImGuiNavLayer NavLayer; // Layer we are navigating on. For now the system is hard-coded for 0=main contents and 1=menu/title bar, may expose layers later.
|
||||||
int NavIdTabCounter; // == NavWindow->DC.FocusIdxTabCounter at time of NavId processing
|
|
||||||
bool NavIdIsAlive; // Nav widget has been seen this frame ~~ NavRectRel is valid
|
bool NavIdIsAlive; // Nav widget has been seen this frame ~~ NavRectRel is valid
|
||||||
bool NavMousePosDirty; // When set we will update mouse position if (io.ConfigFlags & ImGuiConfigFlags_NavEnableSetMousePos) if set (NB: this not enabled by default)
|
bool NavMousePosDirty; // When set we will update mouse position if (io.ConfigFlags & ImGuiConfigFlags_NavEnableSetMousePos) if set (NB: this not enabled by default)
|
||||||
bool NavDisableHighlight; // When user starts using mouse, we hide gamepad/keyboard highlight (NB: but they are still available, which is why NavDisableHighlight isn't always != NavDisableMouseHover)
|
bool NavDisableHighlight; // When user starts using mouse, we hide gamepad/keyboard highlight (NB: but they are still available, which is why NavDisableHighlight isn't always != NavDisableMouseHover)
|
||||||
bool NavDisableMouseHover; // When user starts using gamepad/keyboard, we hide mouse hovering highlight until mouse is touched again.
|
bool NavDisableMouseHover; // When user starts using gamepad/keyboard, we hide mouse hovering highlight until mouse is touched again.
|
||||||
bool NavAnyRequest; // ~~ NavMoveRequest || NavInitRequest
|
|
||||||
|
// Navigation: Init & Move Requests
|
||||||
|
bool NavAnyRequest; // ~~ NavMoveRequest || NavInitRequest this is to perform early out in ItemAdd()
|
||||||
bool NavInitRequest; // Init request for appearing window to select first item
|
bool NavInitRequest; // Init request for appearing window to select first item
|
||||||
bool NavInitRequestFromMove;
|
bool NavInitRequestFromMove;
|
||||||
ImGuiID NavInitResultId; // Init request result (first item of the window, or one for which SetItemDefaultFocus() was called)
|
ImGuiID NavInitResultId; // Init request result (first item of the window, or one for which SetItemDefaultFocus() was called)
|
||||||
ImRect NavInitResultRectRel; // Init request result rectangle (relative to parent window)
|
ImRect NavInitResultRectRel; // Init request result rectangle (relative to parent window)
|
||||||
bool NavMoveRequest; // Move request for this frame
|
bool NavMoveSubmitted; // Move request submitted, will process result on next NewFrame()
|
||||||
ImGuiNavMoveFlags NavMoveRequestFlags;
|
bool NavMoveScoringItems; // Move request submitted, still scoring incoming items
|
||||||
ImGuiNavForward NavMoveRequestForward; // None / ForwardQueued / ForwardActive (this is used to navigate sibling parent menus from a child menu)
|
bool NavMoveForwardToNextFrame;
|
||||||
ImGuiKeyModFlags NavMoveRequestKeyMods;
|
ImGuiNavMoveFlags NavMoveFlags;
|
||||||
ImGuiDir NavMoveDir, NavMoveDirLast; // Direction of the move request (left/right/up/down), direction of the previous move request
|
ImGuiScrollFlags NavMoveScrollFlags;
|
||||||
|
ImGuiKeyModFlags NavMoveKeyMods;
|
||||||
|
ImGuiDir NavMoveDir; // Direction of the move request (left/right/up/down)
|
||||||
|
ImGuiDir NavMoveDirForDebug;
|
||||||
ImGuiDir NavMoveClipDir; // FIXME-NAV: Describe the purpose of this better. Might want to rename?
|
ImGuiDir NavMoveClipDir; // FIXME-NAV: Describe the purpose of this better. Might want to rename?
|
||||||
|
ImRect NavScoringRect; // Rectangle used for scoring, in screen space. Based of window->NavRectRel[], modified for directional navigation scoring.
|
||||||
|
ImRect NavScoringNoClipRect; // Some nav operations (such as PageUp/PageDown) enforce a region which clipper will attempt to always keep submitted
|
||||||
|
int NavScoringDebugCount; // Metrics for debugging
|
||||||
|
int NavTabbingDir; // Generally -1 or +1, 0 when tabbing without a nav id
|
||||||
|
int NavTabbingCounter; // >0 when counting items for tabbing
|
||||||
ImGuiNavItemData NavMoveResultLocal; // Best move request candidate within NavWindow
|
ImGuiNavItemData NavMoveResultLocal; // Best move request candidate within NavWindow
|
||||||
ImGuiNavItemData NavMoveResultLocalVisibleSet; // Best move request candidate within NavWindow that are mostly visible (when using ImGuiNavMoveFlags_AlsoScoreVisibleSet flag)
|
ImGuiNavItemData NavMoveResultLocalVisible; // Best move request candidate within NavWindow that are mostly visible (when using ImGuiNavMoveFlags_AlsoScoreVisibleSet flag)
|
||||||
ImGuiNavItemData NavMoveResultOther; // Best move request candidate within NavWindow's flattened hierarchy (when using ImGuiWindowFlags_NavFlattened flag)
|
ImGuiNavItemData NavMoveResultOther; // Best move request candidate within NavWindow's flattened hierarchy (when using ImGuiWindowFlags_NavFlattened flag)
|
||||||
ImGuiWindow* NavWrapRequestWindow; // Window which requested trying nav wrap-around.
|
ImGuiNavItemData NavTabbingResultFirst; // First tabbing request candidate within NavWindow and flattened hierarchy
|
||||||
ImGuiNavMoveFlags NavWrapRequestFlags; // Wrap-around operation flags.
|
|
||||||
|
|
||||||
// Navigation: Windowing (CTRL+TAB for list, or Menu button + keys or directional pads to move/resize)
|
// Navigation: Windowing (CTRL+TAB for list, or Menu button + keys or directional pads to move/resize)
|
||||||
ImGuiWindow* NavWindowingTarget; // Target window when doing CTRL+Tab (or Pad Menu + FocusPrev/Next), this window is temporarily displayed top-most!
|
ImGuiWindow* NavWindowingTarget; // Target window when doing CTRL+Tab (or Pad Menu + FocusPrev/Next), this window is temporarily displayed top-most!
|
||||||
@@ -1551,15 +1639,6 @@ struct ImGuiContext
|
|||||||
float NavWindowingHighlightAlpha;
|
float NavWindowingHighlightAlpha;
|
||||||
bool NavWindowingToggleLayer;
|
bool NavWindowingToggleLayer;
|
||||||
|
|
||||||
// Legacy Focus/Tabbing system (older than Nav, active even if Nav is disabled, misnamed. FIXME-NAV: This needs a redesign!)
|
|
||||||
ImGuiWindow* TabFocusRequestCurrWindow; //
|
|
||||||
ImGuiWindow* TabFocusRequestNextWindow; //
|
|
||||||
int TabFocusRequestCurrCounterRegular; // Any item being requested for focus, stored as an index (we on layout to be stable between the frame pressing TAB and the next frame, semi-ouch)
|
|
||||||
int TabFocusRequestCurrCounterTabStop; // Tab item being requested for focus, stored as an index
|
|
||||||
int TabFocusRequestNextCounterRegular; // Stored for next frame
|
|
||||||
int TabFocusRequestNextCounterTabStop; // "
|
|
||||||
bool TabFocusPressed; // Set in NewFrame() when user pressed Tab
|
|
||||||
|
|
||||||
// Render
|
// Render
|
||||||
float DimBgRatio; // 0.0..1.0 animation when fading in a dimming background (for modal window and CTRL+TAB list)
|
float DimBgRatio; // 0.0..1.0 animation when fading in a dimming background (for modal window and CTRL+TAB list)
|
||||||
ImGuiMouseCursor MouseCursor;
|
ImGuiMouseCursor MouseCursor;
|
||||||
@@ -1583,11 +1662,15 @@ struct ImGuiContext
|
|||||||
ImVector<unsigned char> DragDropPayloadBufHeap; // We don't expose the ImVector<> directly, ImGuiPayload only holds pointer+size
|
ImVector<unsigned char> DragDropPayloadBufHeap; // We don't expose the ImVector<> directly, ImGuiPayload only holds pointer+size
|
||||||
unsigned char DragDropPayloadBufLocal[16]; // Local buffer for small payloads
|
unsigned char DragDropPayloadBufLocal[16]; // Local buffer for small payloads
|
||||||
|
|
||||||
|
// Clipper
|
||||||
|
int ClipperTempDataStacked;
|
||||||
|
ImVector<ImGuiListClipperData> ClipperTempData;
|
||||||
|
|
||||||
// Table
|
// Table
|
||||||
ImGuiTable* CurrentTable;
|
ImGuiTable* CurrentTable;
|
||||||
int CurrentTableStackIdx;
|
int TablesTempDataStacked; // Temporary table data size (because we leave previous instances undestructed, we generally don't use TablesTempData.Size)
|
||||||
ImPool<ImGuiTable> Tables;
|
ImVector<ImGuiTableTempData> TablesTempData; // Temporary table data (buffers reused/shared across instances, support nesting)
|
||||||
ImVector<ImGuiTableTempData> TablesTempDataStack;
|
ImPool<ImGuiTable> Tables; // Persistent table data
|
||||||
ImVector<float> TablesLastTimeActive; // Last used timestamp of each tables (SOA, for efficient GC)
|
ImVector<float> TablesLastTimeActive; // Last used timestamp of each tables (SOA, for efficient GC)
|
||||||
ImVector<ImDrawChannel> DrawChannelsTempMergeBuffer;
|
ImVector<ImDrawChannel> DrawChannelsTempMergeBuffer;
|
||||||
|
|
||||||
@@ -1598,14 +1681,14 @@ struct ImGuiContext
|
|||||||
ImVector<ImGuiShrinkWidthItem> ShrinkWidthBuffer;
|
ImVector<ImGuiShrinkWidthItem> ShrinkWidthBuffer;
|
||||||
|
|
||||||
// Widget state
|
// Widget state
|
||||||
ImVec2 LastValidMousePos;
|
ImVec2 MouseLastValidPos;
|
||||||
ImGuiInputTextState InputTextState;
|
ImGuiInputTextState InputTextState;
|
||||||
ImFont InputTextPasswordFont;
|
ImFont InputTextPasswordFont;
|
||||||
ImGuiID TempInputId; // Temporary text input when CTRL+clicking on a slider, etc.
|
ImGuiID TempInputId; // Temporary text input when CTRL+clicking on a slider, etc.
|
||||||
ImGuiColorEditFlags ColorEditOptions; // Store user options for color edit widgets
|
ImGuiColorEditFlags ColorEditOptions; // Store user options for color edit widgets
|
||||||
float ColorEditLastHue; // Backup of last Hue associated to LastColor[3], so we can restore Hue in lossy RGB<>HSV round trips
|
float ColorEditLastHue; // Backup of last Hue associated to LastColor, so we can restore Hue in lossy RGB<>HSV round trips
|
||||||
float ColorEditLastSat; // Backup of last Saturation associated to LastColor[3], so we can restore Saturation in lossy RGB<>HSV round trips
|
float ColorEditLastSat; // Backup of last Saturation associated to LastColor, so we can restore Saturation in lossy RGB<>HSV round trips
|
||||||
float ColorEditLastColor[3];
|
ImU32 ColorEditLastColor; // RGB value with alpha set to 0.
|
||||||
ImVec4 ColorPickerRef; // Initial/reference color at the time of opening the color picker.
|
ImVec4 ColorPickerRef; // Initial/reference color at the time of opening the color picker.
|
||||||
ImGuiComboPreviewData ComboPreviewData;
|
ImGuiComboPreviewData ComboPreviewData;
|
||||||
float SliderCurrentAccum; // Accumulated slider delta when using navigation controls.
|
float SliderCurrentAccum; // Accumulated slider delta when using navigation controls.
|
||||||
@@ -1613,9 +1696,10 @@ struct ImGuiContext
|
|||||||
bool DragCurrentAccumDirty;
|
bool DragCurrentAccumDirty;
|
||||||
float DragCurrentAccum; // Accumulator for dragging modification. Always high-precision, not rounded by end-user precision settings
|
float DragCurrentAccum; // Accumulator for dragging modification. Always high-precision, not rounded by end-user precision settings
|
||||||
float DragSpeedDefaultRatio; // If speed == 0.0f, uses (max-min) * DragSpeedDefaultRatio
|
float DragSpeedDefaultRatio; // If speed == 0.0f, uses (max-min) * DragSpeedDefaultRatio
|
||||||
float DisabledAlphaBackup; // Backup for style.Alpha for BeginDisabled()
|
|
||||||
float ScrollbarClickDeltaToGrabCenter; // Distance between mouse and center of grab box, normalized in parent space. Use storage?
|
float ScrollbarClickDeltaToGrabCenter; // Distance between mouse and center of grab box, normalized in parent space. Use storage?
|
||||||
int TooltipOverrideCount;
|
float DisabledAlphaBackup; // Backup for style.Alpha for BeginDisabled()
|
||||||
|
short DisabledStackSize;
|
||||||
|
short TooltipOverrideCount;
|
||||||
float TooltipSlowDelay; // Time before slow tooltips appears (FIXME: This is temporary until we merge in tooltip timer+priority work)
|
float TooltipSlowDelay; // Time before slow tooltips appears (FIXME: This is temporary until we merge in tooltip timer+priority work)
|
||||||
ImVector<char> ClipboardHandlerData; // If no custom clipboard handler is defined
|
ImVector<char> ClipboardHandlerData; // If no custom clipboard handler is defined
|
||||||
ImVector<ImGuiID> MenusIdSubmittedThisFrame; // A list of menu IDs that were rendered at least once
|
ImVector<ImGuiID> MenusIdSubmittedThisFrame; // A list of menu IDs that were rendered at least once
|
||||||
@@ -1650,8 +1734,9 @@ struct ImGuiContext
|
|||||||
|
|
||||||
// Debug Tools
|
// Debug Tools
|
||||||
bool DebugItemPickerActive; // Item picker is active (started with DebugStartItemPicker())
|
bool DebugItemPickerActive; // Item picker is active (started with DebugStartItemPicker())
|
||||||
ImGuiID DebugItemPickerBreakId; // Will call IM_DEBUG_BREAK() when encountering this id
|
ImGuiID DebugItemPickerBreakId; // Will call IM_DEBUG_BREAK() when encountering this ID
|
||||||
ImGuiMetricsConfig DebugMetricsConfig;
|
ImGuiMetricsConfig DebugMetricsConfig;
|
||||||
|
ImGuiStackTool DebugStackTool;
|
||||||
|
|
||||||
// Misc
|
// Misc
|
||||||
float FramerateSecPerFrame[120]; // Calculate estimate of framerate for user over the last 2 seconds.
|
float FramerateSecPerFrame[120]; // Calculate estimate of framerate for user over the last 2 seconds.
|
||||||
@@ -1676,7 +1761,6 @@ struct ImGuiContext
|
|||||||
WithinFrameScope = WithinFrameScopeWithImplicitWindow = WithinEndChild = false;
|
WithinFrameScope = WithinFrameScopeWithImplicitWindow = WithinEndChild = false;
|
||||||
GcCompactAll = false;
|
GcCompactAll = false;
|
||||||
TestEngineHookItems = false;
|
TestEngineHookItems = false;
|
||||||
TestEngineHookIdInfo = 0;
|
|
||||||
TestEngine = NULL;
|
TestEngine = NULL;
|
||||||
|
|
||||||
WindowsActiveCount = 0;
|
WindowsActiveCount = 0;
|
||||||
@@ -1687,6 +1771,7 @@ struct ImGuiContext
|
|||||||
WheelingWindow = NULL;
|
WheelingWindow = NULL;
|
||||||
WheelingWindowTimer = 0.0f;
|
WheelingWindowTimer = 0.0f;
|
||||||
|
|
||||||
|
DebugHookIdInfo = 0;
|
||||||
HoveredId = HoveredIdPreviousFrame = 0;
|
HoveredId = HoveredIdPreviousFrame = 0;
|
||||||
HoveredIdAllowOverlap = false;
|
HoveredIdAllowOverlap = false;
|
||||||
HoveredIdUsingMouseWheel = HoveredIdPreviousFrameUsingMouseWheel = false;
|
HoveredIdUsingMouseWheel = HoveredIdPreviousFrameUsingMouseWheel = false;
|
||||||
@@ -1717,16 +1802,15 @@ struct ImGuiContext
|
|||||||
LastActiveIdTimer = 0.0f;
|
LastActiveIdTimer = 0.0f;
|
||||||
|
|
||||||
CurrentItemFlags = ImGuiItemFlags_None;
|
CurrentItemFlags = ImGuiItemFlags_None;
|
||||||
|
BeginMenuCount = 0;
|
||||||
|
|
||||||
NavWindow = NULL;
|
NavWindow = NULL;
|
||||||
NavId = NavFocusScopeId = NavActivateId = NavActivateDownId = NavActivatePressedId = NavInputId = 0;
|
NavId = NavFocusScopeId = NavActivateId = NavActivateDownId = NavActivatePressedId = NavActivateInputId = 0;
|
||||||
NavJustTabbedId = NavJustMovedToId = NavJustMovedToFocusScopeId = NavNextActivateId = 0;
|
NavJustMovedToId = NavJustMovedToFocusScopeId = NavNextActivateId = 0;
|
||||||
|
NavActivateFlags = NavNextActivateFlags = ImGuiActivateFlags_None;
|
||||||
NavJustMovedToKeyMods = ImGuiKeyModFlags_None;
|
NavJustMovedToKeyMods = ImGuiKeyModFlags_None;
|
||||||
NavInputSource = ImGuiInputSource_None;
|
NavInputSource = ImGuiInputSource_None;
|
||||||
NavScoringRect = ImRect();
|
|
||||||
NavScoringCount = 0;
|
|
||||||
NavLayer = ImGuiNavLayer_Main;
|
NavLayer = ImGuiNavLayer_Main;
|
||||||
NavIdTabCounter = INT_MAX;
|
|
||||||
NavIdIsAlive = false;
|
NavIdIsAlive = false;
|
||||||
NavMousePosDirty = false;
|
NavMousePosDirty = false;
|
||||||
NavDisableHighlight = true;
|
NavDisableHighlight = true;
|
||||||
@@ -1735,23 +1819,21 @@ struct ImGuiContext
|
|||||||
NavInitRequest = false;
|
NavInitRequest = false;
|
||||||
NavInitRequestFromMove = false;
|
NavInitRequestFromMove = false;
|
||||||
NavInitResultId = 0;
|
NavInitResultId = 0;
|
||||||
NavMoveRequest = false;
|
NavMoveSubmitted = false;
|
||||||
NavMoveRequestFlags = ImGuiNavMoveFlags_None;
|
NavMoveScoringItems = false;
|
||||||
NavMoveRequestForward = ImGuiNavForward_None;
|
NavMoveForwardToNextFrame = false;
|
||||||
NavMoveRequestKeyMods = ImGuiKeyModFlags_None;
|
NavMoveFlags = ImGuiNavMoveFlags_None;
|
||||||
NavMoveDir = NavMoveDirLast = NavMoveClipDir = ImGuiDir_None;
|
NavMoveScrollFlags = ImGuiScrollFlags_None;
|
||||||
NavWrapRequestWindow = NULL;
|
NavMoveKeyMods = ImGuiKeyModFlags_None;
|
||||||
NavWrapRequestFlags = ImGuiNavMoveFlags_None;
|
NavMoveDir = NavMoveDirForDebug = NavMoveClipDir = ImGuiDir_None;
|
||||||
|
NavScoringDebugCount = 0;
|
||||||
|
NavTabbingDir = 0;
|
||||||
|
NavTabbingCounter = 0;
|
||||||
|
|
||||||
NavWindowingTarget = NavWindowingTargetAnim = NavWindowingListWindow = NULL;
|
NavWindowingTarget = NavWindowingTargetAnim = NavWindowingListWindow = NULL;
|
||||||
NavWindowingTimer = NavWindowingHighlightAlpha = 0.0f;
|
NavWindowingTimer = NavWindowingHighlightAlpha = 0.0f;
|
||||||
NavWindowingToggleLayer = false;
|
NavWindowingToggleLayer = false;
|
||||||
|
|
||||||
TabFocusRequestCurrWindow = TabFocusRequestNextWindow = NULL;
|
|
||||||
TabFocusRequestCurrCounterRegular = TabFocusRequestCurrCounterTabStop = INT_MAX;
|
|
||||||
TabFocusRequestNextCounterRegular = TabFocusRequestNextCounterTabStop = INT_MAX;
|
|
||||||
TabFocusPressed = false;
|
|
||||||
|
|
||||||
DimBgRatio = 0.0f;
|
DimBgRatio = 0.0f;
|
||||||
MouseCursor = ImGuiMouseCursor_Arrow;
|
MouseCursor = ImGuiMouseCursor_Arrow;
|
||||||
|
|
||||||
@@ -1767,21 +1849,23 @@ struct ImGuiContext
|
|||||||
DragDropHoldJustPressedId = 0;
|
DragDropHoldJustPressedId = 0;
|
||||||
memset(DragDropPayloadBufLocal, 0, sizeof(DragDropPayloadBufLocal));
|
memset(DragDropPayloadBufLocal, 0, sizeof(DragDropPayloadBufLocal));
|
||||||
|
|
||||||
|
ClipperTempDataStacked = 0;
|
||||||
|
|
||||||
CurrentTable = NULL;
|
CurrentTable = NULL;
|
||||||
CurrentTableStackIdx = -1;
|
TablesTempDataStacked = 0;
|
||||||
CurrentTabBar = NULL;
|
CurrentTabBar = NULL;
|
||||||
|
|
||||||
LastValidMousePos = ImVec2(0.0f, 0.0f);
|
|
||||||
TempInputId = 0;
|
TempInputId = 0;
|
||||||
ColorEditOptions = ImGuiColorEditFlags_DefaultOptions_;
|
ColorEditOptions = ImGuiColorEditFlags_DefaultOptions_;
|
||||||
ColorEditLastHue = ColorEditLastSat = 0.0f;
|
ColorEditLastHue = ColorEditLastSat = 0.0f;
|
||||||
ColorEditLastColor[0] = ColorEditLastColor[1] = ColorEditLastColor[2] = FLT_MAX;
|
ColorEditLastColor = 0;
|
||||||
SliderCurrentAccum = 0.0f;
|
SliderCurrentAccum = 0.0f;
|
||||||
SliderCurrentAccumDirty = false;
|
SliderCurrentAccumDirty = false;
|
||||||
DragCurrentAccumDirty = false;
|
DragCurrentAccumDirty = false;
|
||||||
DragCurrentAccum = 0.0f;
|
DragCurrentAccum = 0.0f;
|
||||||
DragSpeedDefaultRatio = 1.0f / 100.0f;
|
DragSpeedDefaultRatio = 1.0f / 100.0f;
|
||||||
DisabledAlphaBackup = 0.0f;
|
DisabledAlphaBackup = 0.0f;
|
||||||
|
DisabledStackSize = 0;
|
||||||
ScrollbarClickDeltaToGrabCenter = 0.0f;
|
ScrollbarClickDeltaToGrabCenter = 0.0f;
|
||||||
TooltipOverrideCount = 0;
|
TooltipOverrideCount = 0;
|
||||||
TooltipSlowDelay = 0.50f;
|
TooltipSlowDelay = 0.50f;
|
||||||
@@ -1835,6 +1919,7 @@ struct IMGUI_API ImGuiWindowTempData
|
|||||||
ImVec1 Indent; // Indentation / start position from left of window (increased by TreePush/TreePop, etc.)
|
ImVec1 Indent; // Indentation / start position from left of window (increased by TreePush/TreePop, etc.)
|
||||||
ImVec1 ColumnsOffset; // Offset to the current column (if ColumnsCurrent > 0). FIXME: This and the above should be a stack to allow use cases like Tree->Column->Tree. Need revamp columns API.
|
ImVec1 ColumnsOffset; // Offset to the current column (if ColumnsCurrent > 0). FIXME: This and the above should be a stack to allow use cases like Tree->Column->Tree. Need revamp columns API.
|
||||||
ImVec1 GroupOffset;
|
ImVec1 GroupOffset;
|
||||||
|
ImVec2 CursorStartPosLossyness;// Record the loss of precision of CursorStartPos due to really large scrolling amount. This is used by clipper to compensentate and fix the most common use case of large scroll area.
|
||||||
|
|
||||||
// Keyboard/Gamepad navigation
|
// Keyboard/Gamepad navigation
|
||||||
ImGuiNavLayer NavLayerCurrent; // Current layer, 0..31 (we currently only use 0..1)
|
ImGuiNavLayer NavLayerCurrent; // Current layer, 0..31 (we currently only use 0..1)
|
||||||
@@ -1856,8 +1941,6 @@ struct IMGUI_API ImGuiWindowTempData
|
|||||||
int CurrentTableIdx; // Current table index (into g.Tables)
|
int CurrentTableIdx; // Current table index (into g.Tables)
|
||||||
ImGuiLayoutType LayoutType;
|
ImGuiLayoutType LayoutType;
|
||||||
ImGuiLayoutType ParentLayoutType; // Layout type of parent window at the time of Begin()
|
ImGuiLayoutType ParentLayoutType; // Layout type of parent window at the time of Begin()
|
||||||
int FocusCounterRegular; // (Legacy Focus/Tabbing system) Sequential counter, start at -1 and increase as assigned via FocusableItemRegister() (FIXME-NAV: Needs redesign)
|
|
||||||
int FocusCounterTabStop; // (Legacy Focus/Tabbing system) Same, but only count widgets which you can Tab through.
|
|
||||||
|
|
||||||
// Local parameters stacks
|
// Local parameters stacks
|
||||||
// We store the current settings outside of the vectors to increase memory locality (reduce cache misses). The vectors are rarely modified. Also it allows us to not heap allocate for short-lived windows which are not using those settings.
|
// We store the current settings outside of the vectors to increase memory locality (reduce cache misses). The vectors are rarely modified. Also it allows us to not heap allocate for short-lived windows which are not using those settings.
|
||||||
@@ -1865,7 +1948,6 @@ struct IMGUI_API ImGuiWindowTempData
|
|||||||
float TextWrapPos; // Current text wrap pos.
|
float TextWrapPos; // Current text wrap pos.
|
||||||
ImVector<float> ItemWidthStack; // Store item widths to restore (attention: .back() is not == ItemWidth)
|
ImVector<float> ItemWidthStack; // Store item widths to restore (attention: .back() is not == ItemWidth)
|
||||||
ImVector<float> TextWrapPosStack; // Store text wrap pos to restore (attention: .back() is not == TextWrapPos)
|
ImVector<float> TextWrapPosStack; // Store text wrap pos to restore (attention: .back() is not == TextWrapPos)
|
||||||
ImGuiStackSizes StackSizesOnBegin; // Store size of various stacks for asserting
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Storage for one window
|
// Storage for one window
|
||||||
@@ -1902,6 +1984,7 @@ struct IMGUI_API ImGuiWindow
|
|||||||
bool Appearing; // Set during the frame where the window is appearing (or re-appearing)
|
bool Appearing; // Set during the frame where the window is appearing (or re-appearing)
|
||||||
bool Hidden; // Do not display (== HiddenFrames*** > 0)
|
bool Hidden; // Do not display (== HiddenFrames*** > 0)
|
||||||
bool IsFallbackWindow; // Set on the "Debug##Default" window.
|
bool IsFallbackWindow; // Set on the "Debug##Default" window.
|
||||||
|
bool IsExplicitChild; // Set when passed _ChildWindow, left to false by BeginDocked()
|
||||||
bool HasCloseButton; // Set when the window has a close button (p_open != NULL)
|
bool HasCloseButton; // Set when the window has a close button (p_open != NULL)
|
||||||
signed char ResizeBorderHeld; // Current border being held for resize (-1: none, otherwise 0-3)
|
signed char ResizeBorderHeld; // Current border being held for resize (-1: none, otherwise 0-3)
|
||||||
short BeginCount; // Number of Begin() during the current frame (generally 0 or 1, 1+ if appending via multiple Begin/End pairs)
|
short BeginCount; // Number of Begin() during the current frame (generally 0 or 1, 1+ if appending via multiple Begin/End pairs)
|
||||||
@@ -1948,8 +2031,10 @@ struct IMGUI_API ImGuiWindow
|
|||||||
|
|
||||||
ImDrawList* DrawList; // == &DrawListInst (for backward compatibility reason with code using imgui_internal.h we keep this a pointer)
|
ImDrawList* DrawList; // == &DrawListInst (for backward compatibility reason with code using imgui_internal.h we keep this a pointer)
|
||||||
ImDrawList DrawListInst;
|
ImDrawList DrawListInst;
|
||||||
ImGuiWindow* ParentWindow; // If we are a child _or_ popup window, this is pointing to our parent. Otherwise NULL.
|
ImGuiWindow* ParentWindow; // If we are a child _or_ popup _or_ docked window, this is pointing to our parent. Otherwise NULL.
|
||||||
ImGuiWindow* RootWindow; // Point to ourself or first ancestor that is not a child window == Top-level window.
|
ImGuiWindow* ParentWindowInBeginStack;
|
||||||
|
ImGuiWindow* RootWindow; // Point to ourself or first ancestor that is not a child window. Doesn't cross through popups/dock nodes.
|
||||||
|
ImGuiWindow* RootWindowPopupTree; // Point to ourself or first ancestor that is not a child window. Cross through popups parent<>child.
|
||||||
ImGuiWindow* RootWindowForTitleBarHighlight; // Point to ourself or first ancestor which will display TitleBgActive color when this window is active.
|
ImGuiWindow* RootWindowForTitleBarHighlight; // Point to ourself or first ancestor which will display TitleBgActive color when this window is active.
|
||||||
ImGuiWindow* RootWindowForNav; // Point to ourself or first ancestor which doesn't have the NavFlattened flag.
|
ImGuiWindow* RootWindowForNav; // Point to ourself or first ancestor which doesn't have the NavFlattened flag.
|
||||||
|
|
||||||
@@ -2021,7 +2106,7 @@ struct ImGuiTabItem
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Storage for a tab bar (sizeof() 152 bytes)
|
// Storage for a tab bar (sizeof() 152 bytes)
|
||||||
struct ImGuiTabBar
|
struct IMGUI_API ImGuiTabBar
|
||||||
{
|
{
|
||||||
ImVector<ImGuiTabItem> Tabs;
|
ImVector<ImGuiTabItem> Tabs;
|
||||||
ImGuiTabBarFlags Flags;
|
ImGuiTabBarFlags Flags;
|
||||||
@@ -2146,7 +2231,7 @@ struct ImGuiTableCellData
|
|||||||
};
|
};
|
||||||
|
|
||||||
// FIXME-TABLE: more transient data could be stored in a per-stacked table structure: DrawSplitter, SortSpecs, incoming RowData
|
// FIXME-TABLE: more transient data could be stored in a per-stacked table structure: DrawSplitter, SortSpecs, incoming RowData
|
||||||
struct ImGuiTable
|
struct IMGUI_API ImGuiTable
|
||||||
{
|
{
|
||||||
ImGuiID ID;
|
ImGuiID ID;
|
||||||
ImGuiTableFlags Flags;
|
ImGuiTableFlags Flags;
|
||||||
@@ -2252,14 +2337,14 @@ struct ImGuiTable
|
|||||||
bool MemoryCompacted;
|
bool MemoryCompacted;
|
||||||
bool HostSkipItems; // Backup of InnerWindow->SkipItem at the end of BeginTable(), because we will overwrite InnerWindow->SkipItem on a per-column basis
|
bool HostSkipItems; // Backup of InnerWindow->SkipItem at the end of BeginTable(), because we will overwrite InnerWindow->SkipItem on a per-column basis
|
||||||
|
|
||||||
IMGUI_API ImGuiTable() { memset(this, 0, sizeof(*this)); LastFrameActive = -1; }
|
ImGuiTable() { memset(this, 0, sizeof(*this)); LastFrameActive = -1; }
|
||||||
IMGUI_API ~ImGuiTable() { IM_FREE(RawData); }
|
~ImGuiTable() { IM_FREE(RawData); }
|
||||||
};
|
};
|
||||||
|
|
||||||
// Transient data that are only needed between BeginTable() and EndTable(), those buffers are shared (1 per level of stacked table).
|
// Transient data that are only needed between BeginTable() and EndTable(), those buffers are shared (1 per level of stacked table).
|
||||||
// - Accessing those requires chasing an extra pointer so for very frequently used data we leave them in the main table structure.
|
// - Accessing those requires chasing an extra pointer so for very frequently used data we leave them in the main table structure.
|
||||||
// - We also leave out of this structure data that tend to be particularly useful for debugging/metrics.
|
// - We also leave out of this structure data that tend to be particularly useful for debugging/metrics.
|
||||||
struct ImGuiTableTempData
|
struct IMGUI_API ImGuiTableTempData
|
||||||
{
|
{
|
||||||
int TableIndex; // Index in g.Tables.Buf[] pool
|
int TableIndex; // Index in g.Tables.Buf[] pool
|
||||||
float LastTimeActive; // Last timestamp this structure was used
|
float LastTimeActive; // Last timestamp this structure was used
|
||||||
@@ -2276,7 +2361,7 @@ struct ImGuiTableTempData
|
|||||||
float HostBackupItemWidth; // Backup of OuterWindow->DC.ItemWidth at the end of BeginTable()
|
float HostBackupItemWidth; // Backup of OuterWindow->DC.ItemWidth at the end of BeginTable()
|
||||||
int HostBackupItemWidthStackSize;//Backup of OuterWindow->DC.ItemWidthStack.Size at the end of BeginTable()
|
int HostBackupItemWidthStackSize;//Backup of OuterWindow->DC.ItemWidthStack.Size at the end of BeginTable()
|
||||||
|
|
||||||
IMGUI_API ImGuiTableTempData() { memset(this, 0, sizeof(*this)); LastTimeActive = -1.0f; }
|
ImGuiTableTempData() { memset(this, 0, sizeof(*this)); LastTimeActive = -1.0f; }
|
||||||
};
|
};
|
||||||
|
|
||||||
// sizeof() ~ 12
|
// sizeof() ~ 12
|
||||||
@@ -2335,13 +2420,16 @@ namespace ImGui
|
|||||||
IMGUI_API ImGuiWindow* FindWindowByName(const char* name);
|
IMGUI_API ImGuiWindow* FindWindowByName(const char* name);
|
||||||
IMGUI_API void UpdateWindowParentAndRootLinks(ImGuiWindow* window, ImGuiWindowFlags flags, ImGuiWindow* parent_window);
|
IMGUI_API void UpdateWindowParentAndRootLinks(ImGuiWindow* window, ImGuiWindowFlags flags, ImGuiWindow* parent_window);
|
||||||
IMGUI_API ImVec2 CalcWindowNextAutoFitSize(ImGuiWindow* window);
|
IMGUI_API ImVec2 CalcWindowNextAutoFitSize(ImGuiWindow* window);
|
||||||
IMGUI_API bool IsWindowChildOf(ImGuiWindow* window, ImGuiWindow* potential_parent);
|
IMGUI_API bool IsWindowChildOf(ImGuiWindow* window, ImGuiWindow* potential_parent, bool popup_hierarchy);
|
||||||
|
IMGUI_API bool IsWindowWithinBeginStackOf(ImGuiWindow* window, ImGuiWindow* potential_parent);
|
||||||
IMGUI_API bool IsWindowAbove(ImGuiWindow* potential_above, ImGuiWindow* potential_below);
|
IMGUI_API bool IsWindowAbove(ImGuiWindow* potential_above, ImGuiWindow* potential_below);
|
||||||
IMGUI_API bool IsWindowNavFocusable(ImGuiWindow* window);
|
IMGUI_API bool IsWindowNavFocusable(ImGuiWindow* window);
|
||||||
IMGUI_API void SetWindowPos(ImGuiWindow* window, const ImVec2& pos, ImGuiCond cond = 0);
|
IMGUI_API void SetWindowPos(ImGuiWindow* window, const ImVec2& pos, ImGuiCond cond = 0);
|
||||||
IMGUI_API void SetWindowSize(ImGuiWindow* window, const ImVec2& size, ImGuiCond cond = 0);
|
IMGUI_API void SetWindowSize(ImGuiWindow* window, const ImVec2& size, ImGuiCond cond = 0);
|
||||||
IMGUI_API void SetWindowCollapsed(ImGuiWindow* window, bool collapsed, ImGuiCond cond = 0);
|
IMGUI_API void SetWindowCollapsed(ImGuiWindow* window, bool collapsed, ImGuiCond cond = 0);
|
||||||
IMGUI_API void SetWindowHitTestHole(ImGuiWindow* window, const ImVec2& pos, const ImVec2& size);
|
IMGUI_API void SetWindowHitTestHole(ImGuiWindow* window, const ImVec2& pos, const ImVec2& size);
|
||||||
|
inline ImRect WindowRectAbsToRel(ImGuiWindow* window, const ImRect& r) { ImVec2 off = window->DC.CursorStartPos; return ImRect(r.Min.x - off.x, r.Min.y - off.y, r.Max.x - off.x, r.Max.y - off.y); }
|
||||||
|
inline ImRect WindowRectRelToAbs(ImGuiWindow* window, const ImRect& r) { ImVec2 off = window->DC.CursorStartPos; return ImRect(r.Min.x + off.x, r.Min.y + off.y, r.Max.x + off.x, r.Max.y + off.y); }
|
||||||
|
|
||||||
// Windows: Display Order and Focus Order
|
// Windows: Display Order and Focus Order
|
||||||
IMGUI_API void FocusWindow(ImGuiWindow* window);
|
IMGUI_API void FocusWindow(ImGuiWindow* window);
|
||||||
@@ -2349,6 +2437,9 @@ namespace ImGui
|
|||||||
IMGUI_API void BringWindowToFocusFront(ImGuiWindow* window);
|
IMGUI_API void BringWindowToFocusFront(ImGuiWindow* window);
|
||||||
IMGUI_API void BringWindowToDisplayFront(ImGuiWindow* window);
|
IMGUI_API void BringWindowToDisplayFront(ImGuiWindow* window);
|
||||||
IMGUI_API void BringWindowToDisplayBack(ImGuiWindow* window);
|
IMGUI_API void BringWindowToDisplayBack(ImGuiWindow* window);
|
||||||
|
IMGUI_API void BringWindowToDisplayBehind(ImGuiWindow* window, ImGuiWindow* above_window);
|
||||||
|
IMGUI_API int FindWindowDisplayIndex(ImGuiWindow* window);
|
||||||
|
IMGUI_API ImGuiWindow* FindBottomMostVisibleWindowWithinBeginStack(ImGuiWindow* window);
|
||||||
|
|
||||||
// Fonts, drawing
|
// Fonts, drawing
|
||||||
IMGUI_API void SetCurrentFont(ImFont* font);
|
IMGUI_API void SetCurrentFont(ImFont* font);
|
||||||
@@ -2387,7 +2478,14 @@ namespace ImGui
|
|||||||
IMGUI_API void SetScrollY(ImGuiWindow* window, float scroll_y);
|
IMGUI_API void SetScrollY(ImGuiWindow* window, float scroll_y);
|
||||||
IMGUI_API void SetScrollFromPosX(ImGuiWindow* window, float local_x, float center_x_ratio);
|
IMGUI_API void SetScrollFromPosX(ImGuiWindow* window, float local_x, float center_x_ratio);
|
||||||
IMGUI_API void SetScrollFromPosY(ImGuiWindow* window, float local_y, float center_y_ratio);
|
IMGUI_API void SetScrollFromPosY(ImGuiWindow* window, float local_y, float center_y_ratio);
|
||||||
IMGUI_API ImVec2 ScrollToBringRectIntoView(ImGuiWindow* window, const ImRect& item_rect);
|
|
||||||
|
// Early work-in-progress API (ScrollToItem() will become public)
|
||||||
|
IMGUI_API void ScrollToItem(ImGuiScrollFlags flags = 0);
|
||||||
|
IMGUI_API void ScrollToRect(ImGuiWindow* window, const ImRect& rect, ImGuiScrollFlags flags = 0);
|
||||||
|
IMGUI_API ImVec2 ScrollToRectEx(ImGuiWindow* window, const ImRect& rect, ImGuiScrollFlags flags = 0);
|
||||||
|
//#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
|
||||||
|
inline void ScrollToBringRectIntoView(ImGuiWindow* window, const ImRect& rect) { ScrollToRect(window, rect, ImGuiScrollFlags_KeepVisibleEdgeY); }
|
||||||
|
//#endif
|
||||||
|
|
||||||
// Basic Accessors
|
// Basic Accessors
|
||||||
inline ImGuiID GetItemID() { ImGuiContext& g = *GImGui; return g.LastItemData.ID; } // Get ID of last item (~~ often same ImGui::GetID(label) beforehand)
|
inline ImGuiID GetItemID() { ImGuiContext& g = *GImGui; return g.LastItemData.ID; } // Get ID of last item (~~ often same ImGui::GetID(label) beforehand)
|
||||||
@@ -2408,10 +2506,10 @@ namespace ImGui
|
|||||||
// Basic Helpers for widget code
|
// Basic Helpers for widget code
|
||||||
IMGUI_API void ItemSize(const ImVec2& size, float text_baseline_y = -1.0f);
|
IMGUI_API void ItemSize(const ImVec2& size, float text_baseline_y = -1.0f);
|
||||||
IMGUI_API void ItemSize(const ImRect& bb, float text_baseline_y = -1.0f);
|
IMGUI_API void ItemSize(const ImRect& bb, float text_baseline_y = -1.0f);
|
||||||
IMGUI_API bool ItemAdd(const ImRect& bb, ImGuiID id, const ImRect* nav_bb = NULL, ImGuiItemAddFlags flags = 0);
|
IMGUI_API bool ItemAdd(const ImRect& bb, ImGuiID id, const ImRect* nav_bb = NULL, ImGuiItemFlags extra_flags = 0);
|
||||||
IMGUI_API bool ItemHoverable(const ImRect& bb, ImGuiID id);
|
IMGUI_API bool ItemHoverable(const ImRect& bb, ImGuiID id);
|
||||||
IMGUI_API void ItemFocusable(ImGuiWindow* window, ImGuiID id);
|
IMGUI_API bool IsClippedEx(const ImRect& bb, ImGuiID id);
|
||||||
IMGUI_API bool IsClippedEx(const ImRect& bb, ImGuiID id, bool clip_even_when_logged);
|
IMGUI_API void SetLastItemData(ImGuiID item_id, ImGuiItemFlags in_flags, ImGuiItemStatusFlags status_flags, const ImRect& item_rect);
|
||||||
IMGUI_API ImVec2 CalcItemSize(ImVec2 size, float default_w, float default_h);
|
IMGUI_API ImVec2 CalcItemSize(ImVec2 size, float default_w, float default_h);
|
||||||
IMGUI_API float CalcWrapWidthForPos(const ImVec2& pos, float wrap_pos_x);
|
IMGUI_API float CalcWrapWidthForPos(const ImVec2& pos, float wrap_pos_x);
|
||||||
IMGUI_API void PushMultiItemsWidths(int components, float width_full);
|
IMGUI_API void PushMultiItemsWidths(int components, float width_full);
|
||||||
@@ -2424,12 +2522,14 @@ namespace ImGui
|
|||||||
IMGUI_API void PopItemFlag();
|
IMGUI_API void PopItemFlag();
|
||||||
|
|
||||||
#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
|
#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
|
||||||
|
// Currently refactoring focus/nav/tabbing system
|
||||||
// If you have old/custom copy-and-pasted widgets that used FocusableItemRegister():
|
// If you have old/custom copy-and-pasted widgets that used FocusableItemRegister():
|
||||||
// (Old) IMGUI_VERSION_NUM < 18209: using 'ItemAdd(....)' and 'bool focused = FocusableItemRegister(...)'
|
// (Old) IMGUI_VERSION_NUM < 18209: using 'ItemAdd(....)' and 'bool tab_focused = FocusableItemRegister(...)'
|
||||||
// (New) IMGUI_VERSION_NUM >= 18209: using 'ItemAdd(..., ImGuiItemAddFlags_Focusable)' and 'bool focused = (GetItemStatusFlags() & ImGuiItemStatusFlags_Focused) != 0'
|
// (Old) IMGUI_VERSION_NUM >= 18209: using 'ItemAdd(..., ImGuiItemAddFlags_Focusable)' and 'bool tab_focused = (GetItemStatusFlags() & ImGuiItemStatusFlags_Focused) != 0'
|
||||||
|
// (New) IMGUI_VERSION_NUM >= 18413: using 'ItemAdd(..., ImGuiItemFlags_Inputable)' and 'bool tab_focused = (GetItemStatusFlags() & ImGuiItemStatusFlags_FocusedTabbing) != 0 || g.NavActivateInputId == id' (WIP)
|
||||||
// Widget code are simplified as there's no need to call FocusableItemUnregister() while managing the transition from regular widget to TempInputText()
|
// Widget code are simplified as there's no need to call FocusableItemUnregister() while managing the transition from regular widget to TempInputText()
|
||||||
inline bool FocusableItemRegister(ImGuiWindow* window, ImGuiID id) { IM_ASSERT(0); IM_UNUSED(window); IM_UNUSED(id); return false; } // -> pass ImGuiItemAddFlags_Focusable flag to ItemAdd()
|
inline bool FocusableItemRegister(ImGuiWindow* window, ImGuiID id) { IM_ASSERT(0); IM_UNUSED(window); IM_UNUSED(id); return false; } // -> pass ImGuiItemAddFlags_Inputable flag to ItemAdd()
|
||||||
inline IM_NORETURN void FocusableItemUnregister(ImGuiWindow* window) { IM_ASSERT(0); IM_UNUSED(window); } // -> unnecessary: TempInputText() uses ImGuiInputTextFlags_MergedItem
|
inline void FocusableItemUnregister(ImGuiWindow* window) { IM_ASSERT(0); IM_UNUSED(window); } // -> unnecessary: TempInputText() uses ImGuiInputTextFlags_MergedItem
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Logging/Capture
|
// Logging/Capture
|
||||||
@@ -2443,16 +2543,19 @@ namespace ImGui
|
|||||||
IMGUI_API void OpenPopupEx(ImGuiID id, ImGuiPopupFlags popup_flags = ImGuiPopupFlags_None);
|
IMGUI_API void OpenPopupEx(ImGuiID id, ImGuiPopupFlags popup_flags = ImGuiPopupFlags_None);
|
||||||
IMGUI_API void ClosePopupToLevel(int remaining, bool restore_focus_to_window_under_popup);
|
IMGUI_API void ClosePopupToLevel(int remaining, bool restore_focus_to_window_under_popup);
|
||||||
IMGUI_API void ClosePopupsOverWindow(ImGuiWindow* ref_window, bool restore_focus_to_window_under_popup);
|
IMGUI_API void ClosePopupsOverWindow(ImGuiWindow* ref_window, bool restore_focus_to_window_under_popup);
|
||||||
|
IMGUI_API void ClosePopupsExceptModals();
|
||||||
IMGUI_API bool IsPopupOpen(ImGuiID id, ImGuiPopupFlags popup_flags);
|
IMGUI_API bool IsPopupOpen(ImGuiID id, ImGuiPopupFlags popup_flags);
|
||||||
IMGUI_API bool BeginPopupEx(ImGuiID id, ImGuiWindowFlags extra_flags);
|
IMGUI_API bool BeginPopupEx(ImGuiID id, ImGuiWindowFlags extra_flags);
|
||||||
IMGUI_API void BeginTooltipEx(ImGuiWindowFlags extra_flags, ImGuiTooltipFlags tooltip_flags);
|
IMGUI_API void BeginTooltipEx(ImGuiTooltipFlags tooltip_flags, ImGuiWindowFlags extra_window_flags);
|
||||||
IMGUI_API ImRect GetPopupAllowedExtentRect(ImGuiWindow* window);
|
IMGUI_API ImRect GetPopupAllowedExtentRect(ImGuiWindow* window);
|
||||||
IMGUI_API ImGuiWindow* GetTopMostPopupModal();
|
IMGUI_API ImGuiWindow* GetTopMostPopupModal();
|
||||||
|
IMGUI_API ImGuiWindow* GetTopMostAndVisiblePopupModal();
|
||||||
IMGUI_API ImVec2 FindBestWindowPosForPopup(ImGuiWindow* window);
|
IMGUI_API ImVec2 FindBestWindowPosForPopup(ImGuiWindow* window);
|
||||||
IMGUI_API ImVec2 FindBestWindowPosForPopupEx(const ImVec2& ref_pos, const ImVec2& size, ImGuiDir* last_dir, const ImRect& r_outer, const ImRect& r_avoid, ImGuiPopupPositionPolicy policy);
|
IMGUI_API ImVec2 FindBestWindowPosForPopupEx(const ImVec2& ref_pos, const ImVec2& size, ImGuiDir* last_dir, const ImRect& r_outer, const ImRect& r_avoid, ImGuiPopupPositionPolicy policy);
|
||||||
IMGUI_API bool BeginViewportSideBar(const char* name, ImGuiViewport* viewport, ImGuiDir dir, float size, ImGuiWindowFlags window_flags);
|
|
||||||
|
|
||||||
// Menus
|
// Menus
|
||||||
|
IMGUI_API bool BeginViewportSideBar(const char* name, ImGuiViewport* viewport, ImGuiDir dir, float size, ImGuiWindowFlags window_flags);
|
||||||
|
IMGUI_API bool BeginMenuEx(const char* label, const char* icon, bool enabled = true);
|
||||||
IMGUI_API bool MenuItemEx(const char* label, const char* icon, const char* shortcut = NULL, bool selected = false, bool enabled = true);
|
IMGUI_API bool MenuItemEx(const char* label, const char* icon, const char* shortcut = NULL, bool selected = false, bool enabled = true);
|
||||||
|
|
||||||
// Combos
|
// Combos
|
||||||
@@ -2462,9 +2565,13 @@ namespace ImGui
|
|||||||
|
|
||||||
// Gamepad/Keyboard Navigation
|
// Gamepad/Keyboard Navigation
|
||||||
IMGUI_API void NavInitWindow(ImGuiWindow* window, bool force_reinit);
|
IMGUI_API void NavInitWindow(ImGuiWindow* window, bool force_reinit);
|
||||||
|
IMGUI_API void NavInitRequestApplyResult();
|
||||||
IMGUI_API bool NavMoveRequestButNoResultYet();
|
IMGUI_API bool NavMoveRequestButNoResultYet();
|
||||||
|
IMGUI_API void NavMoveRequestSubmit(ImGuiDir move_dir, ImGuiDir clip_dir, ImGuiNavMoveFlags move_flags, ImGuiScrollFlags scroll_flags);
|
||||||
|
IMGUI_API void NavMoveRequestForward(ImGuiDir move_dir, ImGuiDir clip_dir, ImGuiNavMoveFlags move_flags, ImGuiScrollFlags scroll_flags);
|
||||||
|
IMGUI_API void NavMoveRequestResolveWithLastItem(ImGuiNavItemData* result);
|
||||||
IMGUI_API void NavMoveRequestCancel();
|
IMGUI_API void NavMoveRequestCancel();
|
||||||
IMGUI_API void NavMoveRequestForward(ImGuiDir move_dir, ImGuiDir clip_dir, const ImRect& bb_rel, ImGuiNavMoveFlags move_flags);
|
IMGUI_API void NavMoveRequestApplyResult();
|
||||||
IMGUI_API void NavMoveRequestTryWrapping(ImGuiWindow* window, ImGuiNavMoveFlags move_flags);
|
IMGUI_API void NavMoveRequestTryWrapping(ImGuiWindow* window, ImGuiNavMoveFlags move_flags);
|
||||||
IMGUI_API float GetNavInputAmount(ImGuiNavInput n, ImGuiInputReadMode mode);
|
IMGUI_API float GetNavInputAmount(ImGuiNavInput n, ImGuiInputReadMode mode);
|
||||||
IMGUI_API ImVec2 GetNavInputAmount2d(ImGuiNavDirSourceFlags dir_sources, ImGuiInputReadMode mode, float slow_factor = 0.0f, float fast_factor = 0.0f);
|
IMGUI_API ImVec2 GetNavInputAmount2d(ImGuiNavDirSourceFlags dir_sources, ImGuiInputReadMode mode, float slow_factor = 0.0f, float fast_factor = 0.0f);
|
||||||
@@ -2610,7 +2717,7 @@ namespace ImGui
|
|||||||
IMGUI_API bool CollapseButton(ImGuiID id, const ImVec2& pos);
|
IMGUI_API bool CollapseButton(ImGuiID id, const ImVec2& pos);
|
||||||
IMGUI_API bool ArrowButtonEx(const char* str_id, ImGuiDir dir, ImVec2 size_arg, ImGuiButtonFlags flags = 0);
|
IMGUI_API bool ArrowButtonEx(const char* str_id, ImGuiDir dir, ImVec2 size_arg, ImGuiButtonFlags flags = 0);
|
||||||
IMGUI_API void Scrollbar(ImGuiAxis axis);
|
IMGUI_API void Scrollbar(ImGuiAxis axis);
|
||||||
IMGUI_API bool ScrollbarEx(const ImRect& bb, ImGuiID id, ImGuiAxis axis, float* p_scroll_v, float avail_v, float contents_v, ImDrawFlags flags);
|
IMGUI_API bool ScrollbarEx(const ImRect& bb, ImGuiID id, ImGuiAxis axis, ImS64* p_scroll_v, ImS64 avail_v, ImS64 contents_v, ImDrawFlags flags);
|
||||||
IMGUI_API bool ImageButtonEx(ImGuiID id, ImTextureID texture_id, const ImVec2& size, const ImVec2& uv0, const ImVec2& uv1, const ImVec2& padding, const ImVec4& bg_col, const ImVec4& tint_col);
|
IMGUI_API bool ImageButtonEx(ImGuiID id, ImTextureID texture_id, const ImVec2& size, const ImVec2& uv0, const ImVec2& uv1, const ImVec2& padding, const ImVec4& bg_col, const ImVec4& tint_col);
|
||||||
IMGUI_API ImRect GetWindowScrollbarRect(ImGuiWindow* window, ImGuiAxis axis);
|
IMGUI_API ImRect GetWindowScrollbarRect(ImGuiWindow* window, ImGuiAxis axis);
|
||||||
IMGUI_API ImGuiID GetWindowScrollbarID(ImGuiWindow* window, ImGuiAxis axis);
|
IMGUI_API ImGuiID GetWindowScrollbarID(ImGuiWindow* window, ImGuiAxis axis);
|
||||||
@@ -2673,10 +2780,12 @@ namespace ImGui
|
|||||||
|
|
||||||
// Debug Tools
|
// Debug Tools
|
||||||
IMGUI_API void ErrorCheckEndFrameRecover(ImGuiErrorLogCallback log_callback, void* user_data = NULL);
|
IMGUI_API void ErrorCheckEndFrameRecover(ImGuiErrorLogCallback log_callback, void* user_data = NULL);
|
||||||
|
IMGUI_API void ErrorCheckEndWindowRecover(ImGuiErrorLogCallback log_callback, void* user_data = NULL);
|
||||||
inline void DebugDrawItemRect(ImU32 col = IM_COL32(255,0,0,255)) { ImGuiContext& g = *GImGui; ImGuiWindow* window = g.CurrentWindow; GetForegroundDrawList(window)->AddRect(g.LastItemData.Rect.Min, g.LastItemData.Rect.Max, col); }
|
inline void DebugDrawItemRect(ImU32 col = IM_COL32(255,0,0,255)) { ImGuiContext& g = *GImGui; ImGuiWindow* window = g.CurrentWindow; GetForegroundDrawList(window)->AddRect(g.LastItemData.Rect.Min, g.LastItemData.Rect.Max, col); }
|
||||||
inline void DebugStartItemPicker() { ImGuiContext& g = *GImGui; g.DebugItemPickerActive = true; }
|
inline void DebugStartItemPicker() { ImGuiContext& g = *GImGui; g.DebugItemPickerActive = true; }
|
||||||
|
|
||||||
IMGUI_API void ShowFontAtlas(ImFontAtlas* atlas);
|
IMGUI_API void ShowFontAtlas(ImFontAtlas* atlas);
|
||||||
|
IMGUI_API void DebugHookIdInfo(ImGuiID id, ImGuiDataType data_type, const void* data_id, const void* data_id_end);
|
||||||
IMGUI_API void DebugNodeColumns(ImGuiOldColumns* columns);
|
IMGUI_API void DebugNodeColumns(ImGuiOldColumns* columns);
|
||||||
IMGUI_API void DebugNodeDrawList(ImGuiWindow* window, const ImDrawList* draw_list, const char* label);
|
IMGUI_API void DebugNodeDrawList(ImGuiWindow* window, const ImDrawList* draw_list, const char* label);
|
||||||
IMGUI_API void DebugNodeDrawCmdShowMeshAndBoundingBox(ImDrawList* out_draw_list, const ImDrawList* draw_list, const ImDrawCmd* draw_cmd, bool show_mesh, bool show_aabb);
|
IMGUI_API void DebugNodeDrawCmdShowMeshAndBoundingBox(ImDrawList* out_draw_list, const ImDrawList* draw_list, const ImDrawCmd* draw_cmd, bool show_mesh, bool show_aabb);
|
||||||
@@ -2688,6 +2797,7 @@ namespace ImGui
|
|||||||
IMGUI_API void DebugNodeWindow(ImGuiWindow* window, const char* label);
|
IMGUI_API void DebugNodeWindow(ImGuiWindow* window, const char* label);
|
||||||
IMGUI_API void DebugNodeWindowSettings(ImGuiWindowSettings* settings);
|
IMGUI_API void DebugNodeWindowSettings(ImGuiWindowSettings* settings);
|
||||||
IMGUI_API void DebugNodeWindowsList(ImVector<ImGuiWindow*>* windows, const char* label);
|
IMGUI_API void DebugNodeWindowsList(ImVector<ImGuiWindow*>* windows, const char* label);
|
||||||
|
IMGUI_API void DebugNodeWindowsListByBeginStackParent(ImGuiWindow** windows, int windows_size, ImGuiWindow* parent_in_begin_stack);
|
||||||
IMGUI_API void DebugNodeViewport(ImGuiViewportP* viewport);
|
IMGUI_API void DebugNodeViewport(ImGuiViewportP* viewport);
|
||||||
IMGUI_API void DebugRenderViewportThumbnail(ImDrawList* draw_list, ImGuiViewportP* viewport, const ImRect& bb);
|
IMGUI_API void DebugRenderViewportThumbnail(ImDrawList* draw_list, ImGuiViewportP* viewport, const ImRect& bb);
|
||||||
|
|
||||||
@@ -2722,14 +2832,12 @@ IMGUI_API void ImFontAtlasBuildMultiplyRectAlpha8(const unsigned char table
|
|||||||
#ifdef IMGUI_ENABLE_TEST_ENGINE
|
#ifdef IMGUI_ENABLE_TEST_ENGINE
|
||||||
extern void ImGuiTestEngineHook_ItemAdd(ImGuiContext* ctx, const ImRect& bb, ImGuiID id);
|
extern void ImGuiTestEngineHook_ItemAdd(ImGuiContext* ctx, const ImRect& bb, ImGuiID id);
|
||||||
extern void ImGuiTestEngineHook_ItemInfo(ImGuiContext* ctx, ImGuiID id, const char* label, ImGuiItemStatusFlags flags);
|
extern void ImGuiTestEngineHook_ItemInfo(ImGuiContext* ctx, ImGuiID id, const char* label, ImGuiItemStatusFlags flags);
|
||||||
extern void ImGuiTestEngineHook_IdInfo(ImGuiContext* ctx, ImGuiDataType data_type, ImGuiID id, const void* data_id);
|
|
||||||
extern void ImGuiTestEngineHook_IdInfo(ImGuiContext* ctx, ImGuiDataType data_type, ImGuiID id, const void* data_id, const void* data_id_end);
|
|
||||||
extern void ImGuiTestEngineHook_Log(ImGuiContext* ctx, const char* fmt, ...);
|
extern void ImGuiTestEngineHook_Log(ImGuiContext* ctx, const char* fmt, ...);
|
||||||
|
extern const char* ImGuiTestEngine_FindItemDebugLabel(ImGuiContext* ctx, ImGuiID id);
|
||||||
|
|
||||||
#define IMGUI_TEST_ENGINE_ITEM_ADD(_BB,_ID) if (g.TestEngineHookItems) ImGuiTestEngineHook_ItemAdd(&g, _BB, _ID) // Register item bounding box
|
#define IMGUI_TEST_ENGINE_ITEM_ADD(_BB,_ID) if (g.TestEngineHookItems) ImGuiTestEngineHook_ItemAdd(&g, _BB, _ID) // Register item bounding box
|
||||||
#define IMGUI_TEST_ENGINE_ITEM_INFO(_ID,_LABEL,_FLAGS) if (g.TestEngineHookItems) ImGuiTestEngineHook_ItemInfo(&g, _ID, _LABEL, _FLAGS) // Register item label and status flags (optional)
|
#define IMGUI_TEST_ENGINE_ITEM_INFO(_ID,_LABEL,_FLAGS) if (g.TestEngineHookItems) ImGuiTestEngineHook_ItemInfo(&g, _ID, _LABEL, _FLAGS) // Register item label and status flags (optional)
|
||||||
#define IMGUI_TEST_ENGINE_LOG(_FMT,...) if (g.TestEngineHookItems) ImGuiTestEngineHook_Log(&g, _FMT, __VA_ARGS__) // Custom log entry from user land into test log
|
#define IMGUI_TEST_ENGINE_LOG(_FMT,...) if (g.TestEngineHookItems) ImGuiTestEngineHook_Log(&g, _FMT, __VA_ARGS__) // Custom log entry from user land into test log
|
||||||
#define IMGUI_TEST_ENGINE_ID_INFO(_ID,_TYPE,_DATA) if (g.TestEngineHookIdInfo == _ID) ImGuiTestEngineHook_IdInfo(&g, _TYPE, _ID, (const void*)(_DATA));
|
|
||||||
#define IMGUI_TEST_ENGINE_ID_INFO2(_ID,_TYPE,_DATA,_DATA2) if (g.TestEngineHookIdInfo == _ID) ImGuiTestEngineHook_IdInfo(&g, _TYPE, _ID, (const void*)(_DATA), (const void*)(_DATA2));
|
|
||||||
#else
|
#else
|
||||||
#define IMGUI_TEST_ENGINE_ITEM_INFO(_ID,_LABEL,_FLAGS) ((void)0)
|
#define IMGUI_TEST_ENGINE_ITEM_INFO(_ID,_LABEL,_FLAGS) ((void)0)
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
+11
-11
@@ -1,4 +1,4 @@
|
|||||||
// dear imgui, v1.84
|
// dear imgui, v1.86
|
||||||
// (tables and columns code)
|
// (tables and columns code)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -324,7 +324,7 @@ bool ImGui::BeginTableEx(const char* name, ImGuiID id, int columns_count, ImG
|
|||||||
const ImVec2 avail_size = GetContentRegionAvail();
|
const ImVec2 avail_size = GetContentRegionAvail();
|
||||||
ImVec2 actual_outer_size = CalcItemSize(outer_size, ImMax(avail_size.x, 1.0f), use_child_window ? ImMax(avail_size.y, 1.0f) : 0.0f);
|
ImVec2 actual_outer_size = CalcItemSize(outer_size, ImMax(avail_size.x, 1.0f), use_child_window ? ImMax(avail_size.y, 1.0f) : 0.0f);
|
||||||
ImRect outer_rect(outer_window->DC.CursorPos, outer_window->DC.CursorPos + actual_outer_size);
|
ImRect outer_rect(outer_window->DC.CursorPos, outer_window->DC.CursorPos + actual_outer_size);
|
||||||
if (use_child_window && IsClippedEx(outer_rect, 0, false))
|
if (use_child_window && IsClippedEx(outer_rect, 0))
|
||||||
{
|
{
|
||||||
ItemSize(outer_rect);
|
ItemSize(outer_rect);
|
||||||
return false;
|
return false;
|
||||||
@@ -340,10 +340,9 @@ bool ImGui::BeginTableEx(const char* name, ImGuiID id, int columns_count, ImG
|
|||||||
|
|
||||||
// Acquire temporary buffers
|
// Acquire temporary buffers
|
||||||
const int table_idx = g.Tables.GetIndex(table);
|
const int table_idx = g.Tables.GetIndex(table);
|
||||||
g.CurrentTableStackIdx++;
|
if (++g.TablesTempDataStacked > g.TablesTempData.Size)
|
||||||
if (g.CurrentTableStackIdx + 1 > g.TablesTempDataStack.Size)
|
g.TablesTempData.resize(g.TablesTempDataStacked, ImGuiTableTempData());
|
||||||
g.TablesTempDataStack.resize(g.CurrentTableStackIdx + 1, ImGuiTableTempData());
|
ImGuiTableTempData* temp_data = table->TempData = &g.TablesTempData[g.TablesTempDataStacked - 1];
|
||||||
ImGuiTableTempData* temp_data = table->TempData = &g.TablesTempDataStack[g.CurrentTableStackIdx];
|
|
||||||
temp_data->TableIndex = table_idx;
|
temp_data->TableIndex = table_idx;
|
||||||
table->DrawSplitter = &table->TempData->DrawSplitter;
|
table->DrawSplitter = &table->TempData->DrawSplitter;
|
||||||
table->DrawSplitter->Clear();
|
table->DrawSplitter->Clear();
|
||||||
@@ -564,6 +563,7 @@ bool ImGui::BeginTableEx(const char* name, ImGuiID id, int columns_count, ImG
|
|||||||
// + 0 (for ImGuiTable instance, we are pooling allocations in g.Tables)
|
// + 0 (for ImGuiTable instance, we are pooling allocations in g.Tables)
|
||||||
// + 1 (for table->RawData allocated below)
|
// + 1 (for table->RawData allocated below)
|
||||||
// + 1 (for table->ColumnsNames, if names are used)
|
// + 1 (for table->ColumnsNames, if names are used)
|
||||||
|
// Shared allocations per number of nested tables
|
||||||
// + 1 (for table->Splitter._Channels)
|
// + 1 (for table->Splitter._Channels)
|
||||||
// + 2 * active_channels_count (for ImDrawCmd and ImDrawIdx buffers inside channels)
|
// + 2 * active_channels_count (for ImDrawCmd and ImDrawIdx buffers inside channels)
|
||||||
// Where active_channels_count is variable but often == columns_count or columns_count + 1, see TableSetupDrawChannels() for details.
|
// Where active_channels_count is variable but often == columns_count or columns_count + 1, see TableSetupDrawChannels() for details.
|
||||||
@@ -1170,7 +1170,7 @@ void ImGui::TableUpdateBorders(ImGuiTable* table)
|
|||||||
KeepAliveID(column_id);
|
KeepAliveID(column_id);
|
||||||
|
|
||||||
bool hovered = false, held = false;
|
bool hovered = false, held = false;
|
||||||
bool pressed = ButtonBehavior(hit_rect, column_id, &hovered, &held, ImGuiButtonFlags_FlattenChildren | ImGuiButtonFlags_AllowItemOverlap | ImGuiButtonFlags_PressedOnClick | ImGuiButtonFlags_PressedOnDoubleClick);
|
bool pressed = ButtonBehavior(hit_rect, column_id, &hovered, &held, ImGuiButtonFlags_FlattenChildren | ImGuiButtonFlags_AllowItemOverlap | ImGuiButtonFlags_PressedOnClick | ImGuiButtonFlags_PressedOnDoubleClick | ImGuiButtonFlags_NoNavFocus);
|
||||||
if (pressed && IsMouseDoubleClicked(0))
|
if (pressed && IsMouseDoubleClicked(0))
|
||||||
{
|
{
|
||||||
TableSetColumnWidthAutoSingle(table, column_n);
|
TableSetColumnWidthAutoSingle(table, column_n);
|
||||||
@@ -1381,9 +1381,8 @@ void ImGui::EndTable()
|
|||||||
|
|
||||||
// Clear or restore current table, if any
|
// Clear or restore current table, if any
|
||||||
IM_ASSERT(g.CurrentWindow == outer_window && g.CurrentTable == table);
|
IM_ASSERT(g.CurrentWindow == outer_window && g.CurrentTable == table);
|
||||||
IM_ASSERT(g.CurrentTableStackIdx >= 0);
|
IM_ASSERT(g.TablesTempDataStacked > 0);
|
||||||
g.CurrentTableStackIdx--;
|
temp_data = (--g.TablesTempDataStacked > 0) ? &g.TablesTempData[g.TablesTempDataStacked - 1] : NULL;
|
||||||
temp_data = g.CurrentTableStackIdx >= 0 ? &g.TablesTempDataStack[g.CurrentTableStackIdx] : NULL;
|
|
||||||
g.CurrentTable = temp_data ? g.Tables.GetByIndex(temp_data->TableIndex) : NULL;
|
g.CurrentTable = temp_data ? g.Tables.GetByIndex(temp_data->TableIndex) : NULL;
|
||||||
if (g.CurrentTable)
|
if (g.CurrentTable)
|
||||||
{
|
{
|
||||||
@@ -1479,6 +1478,7 @@ void ImGui::TableSetupScrollFreeze(int columns, int rows)
|
|||||||
table->IsUnfrozenRows = (table->FreezeRowsCount == 0); // Make sure this is set before TableUpdateLayout() so ImGuiListClipper can benefit from it.b
|
table->IsUnfrozenRows = (table->FreezeRowsCount == 0); // Make sure this is set before TableUpdateLayout() so ImGuiListClipper can benefit from it.b
|
||||||
|
|
||||||
// Ensure frozen columns are ordered in their section. We still allow multiple frozen columns to be reordered.
|
// Ensure frozen columns are ordered in their section. We still allow multiple frozen columns to be reordered.
|
||||||
|
// FIXME-TABLE: This work for preserving 2143 into 21|43. How about 4321 turning into 21|43? (preserve relative order in each section)
|
||||||
for (int column_n = 0; column_n < table->FreezeColumnsRequest; column_n++)
|
for (int column_n = 0; column_n < table->FreezeColumnsRequest; column_n++)
|
||||||
{
|
{
|
||||||
int order_n = table->DisplayOrderToIndex[column_n];
|
int order_n = table->DisplayOrderToIndex[column_n];
|
||||||
@@ -3987,7 +3987,7 @@ void ImGui::EndColumns()
|
|||||||
const float column_hit_hw = COLUMNS_HIT_RECT_HALF_WIDTH;
|
const float column_hit_hw = COLUMNS_HIT_RECT_HALF_WIDTH;
|
||||||
const ImRect column_hit_rect(ImVec2(x - column_hit_hw, y1), ImVec2(x + column_hit_hw, y2));
|
const ImRect column_hit_rect(ImVec2(x - column_hit_hw, y1), ImVec2(x + column_hit_hw, y2));
|
||||||
KeepAliveID(column_id);
|
KeepAliveID(column_id);
|
||||||
if (IsClippedEx(column_hit_rect, column_id, false))
|
if (IsClippedEx(column_hit_rect, column_id)) // FIXME: Can be removed or replaced with a lower-level test
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
bool hovered = false, held = false;
|
bool hovered = false, held = false;
|
||||||
|
|||||||
+283
-173
File diff suppressed because it is too large
Load Diff
Vendored
+65
-1
@@ -1,6 +1,71 @@
|
|||||||
|
|
||||||
This is a list of major changes in SDL's version history.
|
This is a list of major changes in SDL's version history.
|
||||||
|
|
||||||
|
---------------------------------------------------------------------------
|
||||||
|
2.0.20:
|
||||||
|
---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
General:
|
||||||
|
* SDL_RenderGeometryRaw() takes a pointer to SDL_Color, not int. You can cast color data in SDL_PIXELFORMAT_RGBA32 format (SDL_PIXELFORMAT_ABGR8888 on little endian systems) for this parameter.
|
||||||
|
* Improved accuracy of horizontal and vertical line drawing when using OpenGL or OpenGLES
|
||||||
|
* Added the hint SDL_HINT_RENDER_LINE_METHOD to control the method of line drawing used, to select speed, correctness, and compatibility.
|
||||||
|
|
||||||
|
Windows:
|
||||||
|
* Fixed size of custom cursors
|
||||||
|
|
||||||
|
Linux:
|
||||||
|
* Fixed hotplug controller detection, broken in 2.0.18
|
||||||
|
|
||||||
|
|
||||||
|
---------------------------------------------------------------------------
|
||||||
|
2.0.18:
|
||||||
|
---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
General:
|
||||||
|
* The SDL wiki documentation and development headers are automatically kept in sync
|
||||||
|
* Each function has information about in which version of SDL it was introduced
|
||||||
|
* SDL-specific CMake options are now prefixed with 'SDL_'. Be sure to update your CMake build scripts accordingly!
|
||||||
|
* Added the hint SDL_HINT_APP_NAME to let SDL know the name of your application for various places it might show up in system information
|
||||||
|
* Added SDL_RenderGeometry() and SDL_RenderGeometryRaw() to allow rendering of arbitrary shapes using the SDL 2D render API
|
||||||
|
* Added SDL_SetTextureUserData() and SDL_GetTextureUserData() to associate application data with an SDL texture
|
||||||
|
* Added SDL_RenderWindowToLogical() and SDL_RenderLogicalToWindow() to convert between window coordinates and logical render coordinates
|
||||||
|
* Added SDL_RenderSetVSync() to change whether a renderer present is synchronized with vblank at runtime
|
||||||
|
* Added SDL_PremultiplyAlpha() to premultiply alpha on a block of SDL_PIXELFORMAT_ARGB8888 pixels
|
||||||
|
* Added a window event SDL_WINDOWEVENT_DISPLAY_CHANGED which is sent when a window changes what display it's centered on
|
||||||
|
* Added SDL_GetWindowICCProfile() to query a window's ICC profile, and a window event SDL_WINDOWEVENT_ICCPROF_CHANGED that is sent when it changes
|
||||||
|
* Added the hint SDL_HINT_VIDEO_EGL_ALLOW_TRANSPARENCY to allow EGL windows to be transparent instead of opaque
|
||||||
|
* SDL_WaitEvent() has been redesigned to use less CPU in most cases
|
||||||
|
* Added SDL_SetWindowMouseRect() and SDL_GetWindowMouseRect() to confine the mouse cursor to an area of a window
|
||||||
|
* You can now read precise mouse wheel motion using 'preciseX' and 'preciseY' event fields
|
||||||
|
* Added SDL_GameControllerHasRumble() and SDL_GameControllerHasRumbleTriggers() to query whether a game controller supports rumble
|
||||||
|
* Added SDL_JoystickHasRumble() and SDL_JoystickHasRumbleTriggers() to query whether a joystick supports rumble
|
||||||
|
* SDL's hidapi implementation is now available as a public API in SDL_hidapi.h
|
||||||
|
|
||||||
|
Windows:
|
||||||
|
* Improved relative mouse motion over Windows Remote Desktop
|
||||||
|
* Added the hint SDL_HINT_IME_SHOW_UI to show native UI components instead of hiding them (defaults off)
|
||||||
|
|
||||||
|
Windows/UWP:
|
||||||
|
* WGI is used instead of XInput for better controller support in UWP apps
|
||||||
|
|
||||||
|
Linux:
|
||||||
|
* Added the hint SDL_HINT_SCREENSAVER_INHIBIT_ACTIVITY_NAME to set the activity that's displayed by the system when the screensaver is disabled
|
||||||
|
* Added the hint SDL_HINT_LINUX_JOYSTICK_CLASSIC to control whether /dev/input/js* or /dev/input/event* are used as joystick devices
|
||||||
|
* Added the hint SDL_HINT_JOYSTICK_DEVICE to allow the user to specify devices that will be opened in addition to the normal joystick detection
|
||||||
|
* Added SDL_LinuxSetThreadPriorityAndPolicy() for more control over a thread priority on Linux
|
||||||
|
|
||||||
|
Android:
|
||||||
|
* Added support for audio output and capture using AAudio on Android 8.1 and newer
|
||||||
|
* Steam Controller support is disabled by default, and can be enabled by setting the hint SDL_HINT_JOYSTICK_HIDAPI_STEAM to "1" before calling SDL_Init()
|
||||||
|
|
||||||
|
Apple Arcade:
|
||||||
|
* Added SDL_GameControllerGetAppleSFSymbolsNameForButton() and SDL_GameControllerGetAppleSFSymbolsNameForAxis() to support Apple Arcade titles
|
||||||
|
|
||||||
|
iOS:
|
||||||
|
* Added documentation that the UIApplicationSupportsIndirectInputEvents key must be set to true in your application's Info.plist in order to get real Bluetooth mouse events.
|
||||||
|
* Steam Controller support is disabled by default, and can be enabled by setting the hint SDL_HINT_JOYSTICK_HIDAPI_STEAM to "1" before calling SDL_Init()
|
||||||
|
|
||||||
|
|
||||||
---------------------------------------------------------------------------
|
---------------------------------------------------------------------------
|
||||||
2.0.16:
|
2.0.16:
|
||||||
---------------------------------------------------------------------------
|
---------------------------------------------------------------------------
|
||||||
@@ -30,7 +95,6 @@ Linux:
|
|||||||
* Added the hint SDL_HINT_AUDIO_DEVICE_STREAM_ROLE to describe the role of your application for audio control panels
|
* Added the hint SDL_HINT_AUDIO_DEVICE_STREAM_ROLE to describe the role of your application for audio control panels
|
||||||
|
|
||||||
Android:
|
Android:
|
||||||
* Added support for audio output and capture using AAudio
|
|
||||||
* Added SDL_AndroidShowToast() to show a lightweight notification
|
* Added SDL_AndroidShowToast() to show a lightweight notification
|
||||||
|
|
||||||
iOS:
|
iOS:
|
||||||
|
|||||||
Vendored
+12
-1
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
Simple DirectMedia Layer
|
Simple DirectMedia Layer
|
||||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
||||||
|
|
||||||
This software is provided 'as-is', without any express or implied
|
This software is provided 'as-is', without any express or implied
|
||||||
warranty. In no event will the authors be held liable for any damages
|
warranty. In no event will the authors be held liable for any damages
|
||||||
@@ -42,6 +42,7 @@
|
|||||||
#include "SDL_filesystem.h"
|
#include "SDL_filesystem.h"
|
||||||
#include "SDL_gamecontroller.h"
|
#include "SDL_gamecontroller.h"
|
||||||
#include "SDL_haptic.h"
|
#include "SDL_haptic.h"
|
||||||
|
#include "SDL_hidapi.h"
|
||||||
#include "SDL_hints.h"
|
#include "SDL_hints.h"
|
||||||
#include "SDL_joystick.h"
|
#include "SDL_joystick.h"
|
||||||
#include "SDL_loadso.h"
|
#include "SDL_loadso.h"
|
||||||
@@ -132,6 +133,8 @@ extern "C" {
|
|||||||
* \returns 0 on success or a negative error code on failure; call
|
* \returns 0 on success or a negative error code on failure; call
|
||||||
* SDL_GetError() for more information.
|
* SDL_GetError() for more information.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_InitSubSystem
|
* \sa SDL_InitSubSystem
|
||||||
* \sa SDL_Quit
|
* \sa SDL_Quit
|
||||||
* \sa SDL_SetMainReady
|
* \sa SDL_SetMainReady
|
||||||
@@ -148,6 +151,8 @@ extern DECLSPEC int SDLCALL SDL_Init(Uint32 flags);
|
|||||||
* \returns 0 on success or a negative error code on failure; call
|
* \returns 0 on success or a negative error code on failure; call
|
||||||
* SDL_GetError() for more information.
|
* SDL_GetError() for more information.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_Init
|
* \sa SDL_Init
|
||||||
* \sa SDL_Quit
|
* \sa SDL_Quit
|
||||||
* \sa SDL_QuitSubSystem
|
* \sa SDL_QuitSubSystem
|
||||||
@@ -169,6 +174,8 @@ extern DECLSPEC int SDLCALL SDL_InitSubSystem(Uint32 flags);
|
|||||||
*
|
*
|
||||||
* \param flags any of the flags used by SDL_Init(); see SDL_Init for details.
|
* \param flags any of the flags used by SDL_Init(); see SDL_Init for details.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_InitSubSystem
|
* \sa SDL_InitSubSystem
|
||||||
* \sa SDL_Quit
|
* \sa SDL_Quit
|
||||||
*/
|
*/
|
||||||
@@ -183,6 +190,8 @@ extern DECLSPEC void SDLCALL SDL_QuitSubSystem(Uint32 flags);
|
|||||||
*
|
*
|
||||||
* The return value does not include SDL_INIT_NOPARACHUTE.
|
* The return value does not include SDL_INIT_NOPARACHUTE.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_Init
|
* \sa SDL_Init
|
||||||
* \sa SDL_InitSubSystem
|
* \sa SDL_InitSubSystem
|
||||||
*/
|
*/
|
||||||
@@ -205,6 +214,8 @@ extern DECLSPEC Uint32 SDLCALL SDL_WasInit(Uint32 flags);
|
|||||||
* application is shutdown, but it is not wise to do this from a library or
|
* application is shutdown, but it is not wise to do this from a library or
|
||||||
* other dynamically loaded code.
|
* other dynamically loaded code.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_Init
|
* \sa SDL_Init
|
||||||
* \sa SDL_QuitSubSystem
|
* \sa SDL_QuitSubSystem
|
||||||
*/
|
*/
|
||||||
|
|||||||
+7
-1
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
Simple DirectMedia Layer
|
Simple DirectMedia Layer
|
||||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
||||||
|
|
||||||
This software is provided 'as-is', without any express or implied
|
This software is provided 'as-is', without any express or implied
|
||||||
warranty. In no event will the authors be held liable for any damages
|
warranty. In no event will the authors be held liable for any damages
|
||||||
@@ -217,6 +217,8 @@ typedef SDL_AssertState (SDLCALL *SDL_AssertionHandler)(
|
|||||||
* fails or NULL for the default handler
|
* fails or NULL for the default handler
|
||||||
* \param userdata a pointer that is passed to `handler`
|
* \param userdata a pointer that is passed to `handler`
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_GetAssertionHandler
|
* \sa SDL_GetAssertionHandler
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC void SDLCALL SDL_SetAssertionHandler(
|
extern DECLSPEC void SDLCALL SDL_SetAssertionHandler(
|
||||||
@@ -285,6 +287,8 @@ extern DECLSPEC SDL_AssertionHandler SDLCALL SDL_GetAssertionHandler(void **puse
|
|||||||
* \returns a list of all failed assertions or NULL if the list is empty. This
|
* \returns a list of all failed assertions or NULL if the list is empty. This
|
||||||
* memory should not be modified or freed by the application.
|
* memory should not be modified or freed by the application.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_ResetAssertionReport
|
* \sa SDL_ResetAssertionReport
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC const SDL_AssertData * SDLCALL SDL_GetAssertionReport(void);
|
extern DECLSPEC const SDL_AssertData * SDLCALL SDL_GetAssertionReport(void);
|
||||||
@@ -297,6 +301,8 @@ extern DECLSPEC const SDL_AssertData * SDLCALL SDL_GetAssertionReport(void);
|
|||||||
* no items. In addition, any previously-triggered assertions will be reset to
|
* no items. In addition, any previously-triggered assertions will be reset to
|
||||||
* a trigger_count of zero, and their always_ignore state will be false.
|
* a trigger_count of zero, and their always_ignore state will be false.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_GetAssertionReport
|
* \sa SDL_GetAssertionReport
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC void SDLCALL SDL_ResetAssertionReport(void);
|
extern DECLSPEC void SDLCALL SDL_ResetAssertionReport(void);
|
||||||
|
|||||||
+18
-2
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
Simple DirectMedia Layer
|
Simple DirectMedia Layer
|
||||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
||||||
|
|
||||||
This software is provided 'as-is', without any express or implied
|
This software is provided 'as-is', without any express or implied
|
||||||
warranty. In no event will the authors be held liable for any damages
|
warranty. In no event will the authors be held liable for any damages
|
||||||
@@ -98,6 +98,8 @@ typedef int SDL_SpinLock;
|
|||||||
* \returns SDL_TRUE if the lock succeeded, SDL_FALSE if the lock is already
|
* \returns SDL_TRUE if the lock succeeded, SDL_FALSE if the lock is already
|
||||||
* held.
|
* held.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_AtomicLock
|
* \sa SDL_AtomicLock
|
||||||
* \sa SDL_AtomicUnlock
|
* \sa SDL_AtomicUnlock
|
||||||
*/
|
*/
|
||||||
@@ -111,6 +113,8 @@ extern DECLSPEC SDL_bool SDLCALL SDL_AtomicTryLock(SDL_SpinLock *lock);
|
|||||||
*
|
*
|
||||||
* \param lock a pointer to a lock variable
|
* \param lock a pointer to a lock variable
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_AtomicTryLock
|
* \sa SDL_AtomicTryLock
|
||||||
* \sa SDL_AtomicUnlock
|
* \sa SDL_AtomicUnlock
|
||||||
*/
|
*/
|
||||||
@@ -148,7 +152,7 @@ void _ReadWriteBarrier(void);
|
|||||||
/* This is correct for all CPUs when using GCC or Solaris Studio 12.1+. */
|
/* This is correct for all CPUs when using GCC or Solaris Studio 12.1+. */
|
||||||
#define SDL_CompilerBarrier() __asm__ __volatile__ ("" : : : "memory")
|
#define SDL_CompilerBarrier() __asm__ __volatile__ ("" : : : "memory")
|
||||||
#elif defined(__WATCOMC__)
|
#elif defined(__WATCOMC__)
|
||||||
extern _inline void SDL_CompilerBarrier (void);
|
extern __inline void SDL_CompilerBarrier(void);
|
||||||
#pragma aux SDL_CompilerBarrier = "" parm [] modify exact [];
|
#pragma aux SDL_CompilerBarrier = "" parm [] modify exact [];
|
||||||
#else
|
#else
|
||||||
#define SDL_CompilerBarrier() \
|
#define SDL_CompilerBarrier() \
|
||||||
@@ -173,6 +177,8 @@ extern _inline void SDL_CompilerBarrier (void);
|
|||||||
*
|
*
|
||||||
* For more information on these semantics, take a look at the blog post:
|
* For more information on these semantics, take a look at the blog post:
|
||||||
* http://preshing.com/20120913/acquire-and-release-semantics
|
* http://preshing.com/20120913/acquire-and-release-semantics
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.6.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC void SDLCALL SDL_MemoryBarrierReleaseFunction(void);
|
extern DECLSPEC void SDLCALL SDL_MemoryBarrierReleaseFunction(void);
|
||||||
extern DECLSPEC void SDLCALL SDL_MemoryBarrierAcquireFunction(void);
|
extern DECLSPEC void SDLCALL SDL_MemoryBarrierAcquireFunction(void);
|
||||||
@@ -268,6 +274,8 @@ extern DECLSPEC SDL_bool SDLCALL SDL_AtomicCAS(SDL_atomic_t *a, int oldval, int
|
|||||||
* \param v the desired value
|
* \param v the desired value
|
||||||
* \returns the previous value of the atomic variable.
|
* \returns the previous value of the atomic variable.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.2.
|
||||||
|
*
|
||||||
* \sa SDL_AtomicGet
|
* \sa SDL_AtomicGet
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC int SDLCALL SDL_AtomicSet(SDL_atomic_t *a, int v);
|
extern DECLSPEC int SDLCALL SDL_AtomicSet(SDL_atomic_t *a, int v);
|
||||||
@@ -281,6 +289,8 @@ extern DECLSPEC int SDLCALL SDL_AtomicSet(SDL_atomic_t *a, int v);
|
|||||||
* \param a a pointer to an SDL_atomic_t variable
|
* \param a a pointer to an SDL_atomic_t variable
|
||||||
* \returns the current value of an atomic variable.
|
* \returns the current value of an atomic variable.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.2.
|
||||||
|
*
|
||||||
* \sa SDL_AtomicSet
|
* \sa SDL_AtomicSet
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC int SDLCALL SDL_AtomicGet(SDL_atomic_t *a);
|
extern DECLSPEC int SDLCALL SDL_AtomicGet(SDL_atomic_t *a);
|
||||||
@@ -297,6 +307,8 @@ extern DECLSPEC int SDLCALL SDL_AtomicGet(SDL_atomic_t *a);
|
|||||||
* \param v the desired value to add
|
* \param v the desired value to add
|
||||||
* \returns the previous value of the atomic variable.
|
* \returns the previous value of the atomic variable.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.2.
|
||||||
|
*
|
||||||
* \sa SDL_AtomicDecRef
|
* \sa SDL_AtomicDecRef
|
||||||
* \sa SDL_AtomicIncRef
|
* \sa SDL_AtomicIncRef
|
||||||
*/
|
*/
|
||||||
@@ -348,6 +360,8 @@ extern DECLSPEC SDL_bool SDLCALL SDL_AtomicCASPtr(void **a, void *oldval, void *
|
|||||||
* \param v the desired pointer value
|
* \param v the desired pointer value
|
||||||
* \returns the previous value of the pointer.
|
* \returns the previous value of the pointer.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.2.
|
||||||
|
*
|
||||||
* \sa SDL_AtomicCASPtr
|
* \sa SDL_AtomicCASPtr
|
||||||
* \sa SDL_AtomicGetPtr
|
* \sa SDL_AtomicGetPtr
|
||||||
*/
|
*/
|
||||||
@@ -362,6 +376,8 @@ extern DECLSPEC void* SDLCALL SDL_AtomicSetPtr(void **a, void* v);
|
|||||||
* \param a a pointer to a pointer
|
* \param a a pointer to a pointer
|
||||||
* \returns the current value of a pointer.
|
* \returns the current value of a pointer.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.2.
|
||||||
|
*
|
||||||
* \sa SDL_AtomicCASPtr
|
* \sa SDL_AtomicCASPtr
|
||||||
* \sa SDL_AtomicSetPtr
|
* \sa SDL_AtomicSetPtr
|
||||||
*/
|
*/
|
||||||
|
|||||||
+306
-27
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
Simple DirectMedia Layer
|
Simple DirectMedia Layer
|
||||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
||||||
|
|
||||||
This software is provided 'as-is', without any express or implied
|
This software is provided 'as-is', without any express or implied
|
||||||
warranty. In no event will the authors be held liable for any damages
|
warranty. In no event will the authors be held liable for any damages
|
||||||
@@ -253,7 +253,48 @@ typedef struct SDL_AudioCVT
|
|||||||
* order that they are normally initialized by default.
|
* order that they are normally initialized by default.
|
||||||
*/
|
*/
|
||||||
/* @{ */
|
/* @{ */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Use this function to get the number of built-in audio drivers.
|
||||||
|
*
|
||||||
|
* This function returns a hardcoded number. This never returns a negative
|
||||||
|
* value; if there are no drivers compiled into this build of SDL, this
|
||||||
|
* function returns zero. The presence of a driver in this list does not mean
|
||||||
|
* it will function, it just means SDL is capable of interacting with that
|
||||||
|
* interface. For example, a build of SDL might have esound support, but if
|
||||||
|
* there's no esound server available, SDL's esound driver would fail if used.
|
||||||
|
*
|
||||||
|
* By default, SDL tries all drivers, in its preferred order, until one is
|
||||||
|
* found to be usable.
|
||||||
|
*
|
||||||
|
* \returns the number of built-in audio drivers.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
|
* \sa SDL_GetAudioDriver
|
||||||
|
*/
|
||||||
extern DECLSPEC int SDLCALL SDL_GetNumAudioDrivers(void);
|
extern DECLSPEC int SDLCALL SDL_GetNumAudioDrivers(void);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Use this function to get the name of a built in audio driver.
|
||||||
|
*
|
||||||
|
* The list of audio drivers is given in the order that they are normally
|
||||||
|
* initialized by default; the drivers that seem more reasonable to choose
|
||||||
|
* first (as far as the SDL developers believe) are earlier in the list.
|
||||||
|
*
|
||||||
|
* The names of drivers are all simple, low-ASCII identifiers, like "alsa",
|
||||||
|
* "coreaudio" or "xaudio2". These never have Unicode characters, and are not
|
||||||
|
* meant to be proper names.
|
||||||
|
*
|
||||||
|
* \param index the index of the audio driver; the value ranges from 0 to
|
||||||
|
* SDL_GetNumAudioDrivers() - 1
|
||||||
|
* \returns the name of the audio driver at the requested index, or NULL if an
|
||||||
|
* invalid index was specified.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
|
* \sa SDL_GetNumAudioDrivers
|
||||||
|
*/
|
||||||
extern DECLSPEC const char *SDLCALL SDL_GetAudioDriver(int index);
|
extern DECLSPEC const char *SDLCALL SDL_GetAudioDriver(int index);
|
||||||
/* @} */
|
/* @} */
|
||||||
|
|
||||||
@@ -265,7 +306,36 @@ extern DECLSPEC const char *SDLCALL SDL_GetAudioDriver(int index);
|
|||||||
* use. You should normally use SDL_Init() or SDL_InitSubSystem().
|
* use. You should normally use SDL_Init() or SDL_InitSubSystem().
|
||||||
*/
|
*/
|
||||||
/* @{ */
|
/* @{ */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Use this function to initialize a particular audio driver.
|
||||||
|
*
|
||||||
|
* This function is used internally, and should not be used unless you have a
|
||||||
|
* specific need to designate the audio driver you want to use. You should
|
||||||
|
* normally use SDL_Init() or SDL_InitSubSystem().
|
||||||
|
*
|
||||||
|
* \param driver_name the name of the desired audio driver
|
||||||
|
* \returns 0 on success or a negative error code on failure; call
|
||||||
|
* SDL_GetError() for more information.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
|
* \sa SDL_AudioQuit
|
||||||
|
*/
|
||||||
extern DECLSPEC int SDLCALL SDL_AudioInit(const char *driver_name);
|
extern DECLSPEC int SDLCALL SDL_AudioInit(const char *driver_name);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Use this function to shut down audio if you initialized it with
|
||||||
|
* SDL_AudioInit().
|
||||||
|
*
|
||||||
|
* This function is used internally, and should not be used unless you have a
|
||||||
|
* specific need to specify the audio driver you want to use. You should
|
||||||
|
* normally use SDL_Quit() or SDL_QuitSubSystem().
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
|
* \sa SDL_AudioInit
|
||||||
|
*/
|
||||||
extern DECLSPEC void SDLCALL SDL_AudioQuit(void);
|
extern DECLSPEC void SDLCALL SDL_AudioQuit(void);
|
||||||
/* @} */
|
/* @} */
|
||||||
|
|
||||||
@@ -296,7 +366,7 @@ extern DECLSPEC const char *SDLCALL SDL_GetCurrentAudioDriver(void);
|
|||||||
*
|
*
|
||||||
* This function is roughly equivalent to:
|
* This function is roughly equivalent to:
|
||||||
*
|
*
|
||||||
* ```c++
|
* ```c
|
||||||
* SDL_OpenAudioDevice(NULL, 0, desired, obtained, SDL_AUDIO_ALLOW_ANY_CHANGE);
|
* SDL_OpenAudioDevice(NULL, 0, desired, obtained, SDL_AUDIO_ALLOW_ANY_CHANGE);
|
||||||
* ```
|
* ```
|
||||||
*
|
*
|
||||||
@@ -327,6 +397,8 @@ extern DECLSPEC const char *SDLCALL SDL_GetCurrentAudioDriver(void);
|
|||||||
* audio device or failure to set up the audio thread; call
|
* audio device or failure to set up the audio thread; call
|
||||||
* SDL_GetError() for more information.
|
* SDL_GetError() for more information.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_CloseAudio
|
* \sa SDL_CloseAudio
|
||||||
* \sa SDL_LockAudio
|
* \sa SDL_LockAudio
|
||||||
* \sa SDL_PauseAudio
|
* \sa SDL_PauseAudio
|
||||||
@@ -370,7 +442,7 @@ typedef Uint32 SDL_AudioDeviceID;
|
|||||||
* should not be called for each iteration of a loop, but rather once at the
|
* should not be called for each iteration of a loop, but rather once at the
|
||||||
* start of a loop:
|
* start of a loop:
|
||||||
*
|
*
|
||||||
* ```c++
|
* ```c
|
||||||
* // Don't do this:
|
* // Don't do this:
|
||||||
* for (int i = 0; i < SDL_GetNumAudioDevices(0); i++)
|
* for (int i = 0; i < SDL_GetNumAudioDevices(0); i++)
|
||||||
*
|
*
|
||||||
@@ -412,6 +484,8 @@ extern DECLSPEC int SDLCALL SDL_GetNumAudioDevices(int iscapture);
|
|||||||
* \returns the name of the audio device at the requested index, or NULL on
|
* \returns the name of the audio device at the requested index, or NULL on
|
||||||
* error.
|
* error.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_GetNumAudioDevices
|
* \sa SDL_GetNumAudioDevices
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC const char *SDLCALL SDL_GetAudioDeviceName(int index,
|
extern DECLSPEC const char *SDLCALL SDL_GetAudioDeviceName(int index,
|
||||||
@@ -437,6 +511,8 @@ extern DECLSPEC const char *SDLCALL SDL_GetAudioDeviceName(int index,
|
|||||||
* \param spec The SDL_AudioSpec to be initialized by this function.
|
* \param spec The SDL_AudioSpec to be initialized by this function.
|
||||||
* \returns 0 on success, nonzero on error
|
* \returns 0 on success, nonzero on error
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.16.
|
||||||
|
*
|
||||||
* \sa SDL_GetNumAudioDevices
|
* \sa SDL_GetNumAudioDevices
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC int SDLCALL SDL_GetAudioDeviceSpec(int index,
|
extern DECLSPEC int SDLCALL SDL_GetAudioDeviceSpec(int index,
|
||||||
@@ -462,6 +538,19 @@ extern DECLSPEC int SDLCALL SDL_GetAudioDeviceSpec(int index,
|
|||||||
* hostname/IP address for a remote audio server, or a filename in the
|
* hostname/IP address for a remote audio server, or a filename in the
|
||||||
* diskaudio driver.
|
* diskaudio driver.
|
||||||
*
|
*
|
||||||
|
* An opened audio device starts out paused, and should be enabled for playing
|
||||||
|
* by calling SDL_PauseAudioDevice(devid, 0) when you are ready for your audio
|
||||||
|
* callback function to be called. Since the audio driver may modify the
|
||||||
|
* requested size of the audio buffer, you should allocate any local mixing
|
||||||
|
* buffers after you open the audio device.
|
||||||
|
*
|
||||||
|
* The audio callback runs in a separate thread in most cases; you can prevent
|
||||||
|
* race conditions between your callback and other threads without fully
|
||||||
|
* pausing playback with SDL_LockAudioDevice(). For more information about the
|
||||||
|
* callback, see SDL_AudioSpec.
|
||||||
|
*
|
||||||
|
* Managing the audio spec via 'desired' and 'obtained':
|
||||||
|
*
|
||||||
* When filling in the desired audio spec structure:
|
* When filling in the desired audio spec structure:
|
||||||
*
|
*
|
||||||
* - `desired->freq` should be the frequency in sample-frames-per-second (Hz).
|
* - `desired->freq` should be the frequency in sample-frames-per-second (Hz).
|
||||||
@@ -510,20 +599,12 @@ extern DECLSPEC int SDLCALL SDL_GetAudioDeviceSpec(int index,
|
|||||||
* callback's float32 audio to int16 before feeding it to the hardware and
|
* callback's float32 audio to int16 before feeding it to the hardware and
|
||||||
* will keep the originally requested format in the `obtained` structure.
|
* will keep the originally requested format in the `obtained` structure.
|
||||||
*
|
*
|
||||||
|
* The resulting audio specs, varying depending on hardware and on what
|
||||||
|
* changes were allowed, will then be written back to `obtained`.
|
||||||
|
*
|
||||||
* If your application can only handle one specific data format, pass a zero
|
* If your application can only handle one specific data format, pass a zero
|
||||||
* for `allowed_changes` and let SDL transparently handle any differences.
|
* for `allowed_changes` and let SDL transparently handle any differences.
|
||||||
*
|
*
|
||||||
* An opened audio device starts out paused, and should be enabled for playing
|
|
||||||
* by calling SDL_PauseAudioDevice(devid, 0) when you are ready for your audio
|
|
||||||
* callback function to be called. Since the audio driver may modify the
|
|
||||||
* requested size of the audio buffer, you should allocate any local mixing
|
|
||||||
* buffers after you open the audio device.
|
|
||||||
*
|
|
||||||
* The audio callback runs in a separate thread in most cases; you can prevent
|
|
||||||
* race conditions between your callback and other threads without fully
|
|
||||||
* pausing playback with SDL_LockAudioDevice(). For more information about the
|
|
||||||
* callback, see SDL_AudioSpec.
|
|
||||||
*
|
|
||||||
* \param device a UTF-8 string reported by SDL_GetAudioDeviceName() or a
|
* \param device a UTF-8 string reported by SDL_GetAudioDeviceName() or a
|
||||||
* driver-specific name as appropriate. NULL requests the most
|
* driver-specific name as appropriate. NULL requests the most
|
||||||
* reasonable default device.
|
* reasonable default device.
|
||||||
@@ -570,7 +651,38 @@ typedef enum
|
|||||||
SDL_AUDIO_PLAYING,
|
SDL_AUDIO_PLAYING,
|
||||||
SDL_AUDIO_PAUSED
|
SDL_AUDIO_PAUSED
|
||||||
} SDL_AudioStatus;
|
} SDL_AudioStatus;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function is a legacy means of querying the audio device.
|
||||||
|
*
|
||||||
|
* New programs might want to use SDL_GetAudioDeviceStatus() instead. This
|
||||||
|
* function is equivalent to calling...
|
||||||
|
*
|
||||||
|
* ```c
|
||||||
|
* SDL_GetAudioDeviceStatus(1);
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* ...and is only useful if you used the legacy SDL_OpenAudio() function.
|
||||||
|
*
|
||||||
|
* \returns the SDL_AudioStatus of the audio device opened by SDL_OpenAudio().
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
|
* \sa SDL_GetAudioDeviceStatus
|
||||||
|
*/
|
||||||
extern DECLSPEC SDL_AudioStatus SDLCALL SDL_GetAudioStatus(void);
|
extern DECLSPEC SDL_AudioStatus SDLCALL SDL_GetAudioStatus(void);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Use this function to get the current audio state of an audio device.
|
||||||
|
*
|
||||||
|
* \param dev the ID of an audio device previously opened with
|
||||||
|
* SDL_OpenAudioDevice()
|
||||||
|
* \returns the SDL_AudioStatus of the specified audio device.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
|
* \sa SDL_PauseAudioDevice
|
||||||
|
*/
|
||||||
extern DECLSPEC SDL_AudioStatus SDLCALL SDL_GetAudioDeviceStatus(SDL_AudioDeviceID dev);
|
extern DECLSPEC SDL_AudioStatus SDLCALL SDL_GetAudioDeviceStatus(SDL_AudioDeviceID dev);
|
||||||
/* @} *//* Audio State */
|
/* @} *//* Audio State */
|
||||||
|
|
||||||
@@ -584,7 +696,56 @@ extern DECLSPEC SDL_AudioStatus SDLCALL SDL_GetAudioDeviceStatus(SDL_AudioDevice
|
|||||||
* Silence will be written to the audio device during the pause.
|
* Silence will be written to the audio device during the pause.
|
||||||
*/
|
*/
|
||||||
/* @{ */
|
/* @{ */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function is a legacy means of pausing the audio device.
|
||||||
|
*
|
||||||
|
* New programs might want to use SDL_PauseAudioDevice() instead. This
|
||||||
|
* function is equivalent to calling...
|
||||||
|
*
|
||||||
|
* ```c
|
||||||
|
* SDL_PauseAudioDevice(1, pause_on);
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* ...and is only useful if you used the legacy SDL_OpenAudio() function.
|
||||||
|
*
|
||||||
|
* \param pause_on non-zero to pause, 0 to unpause
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
|
* \sa SDL_GetAudioStatus
|
||||||
|
* \sa SDL_PauseAudioDevice
|
||||||
|
*/
|
||||||
extern DECLSPEC void SDLCALL SDL_PauseAudio(int pause_on);
|
extern DECLSPEC void SDLCALL SDL_PauseAudio(int pause_on);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Use this function to pause and unpause audio playback on a specified
|
||||||
|
* device.
|
||||||
|
*
|
||||||
|
* This function pauses and unpauses the audio callback processing for a given
|
||||||
|
* device. Newly-opened audio devices start in the paused state, so you must
|
||||||
|
* call this function with **pause_on**=0 after opening the specified audio
|
||||||
|
* device to start playing sound. This allows you to safely initialize data
|
||||||
|
* for your callback function after opening the audio device. Silence will be
|
||||||
|
* written to the audio device while paused, and the audio callback is
|
||||||
|
* guaranteed to not be called. Pausing one device does not prevent other
|
||||||
|
* unpaused devices from running their callbacks.
|
||||||
|
*
|
||||||
|
* Pausing state does not stack; even if you pause a device several times, a
|
||||||
|
* single unpause will start the device playing again, and vice versa. This is
|
||||||
|
* different from how SDL_LockAudioDevice() works.
|
||||||
|
*
|
||||||
|
* If you just need to protect a few variables from race conditions vs your
|
||||||
|
* callback, you shouldn't pause the audio device, as it will lead to dropouts
|
||||||
|
* in the audio playback. Instead, you should use SDL_LockAudioDevice().
|
||||||
|
*
|
||||||
|
* \param dev a device opened by SDL_OpenAudioDevice()
|
||||||
|
* \param pause_on non-zero to pause, 0 to unpause
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
|
* \sa SDL_LockAudioDevice
|
||||||
|
*/
|
||||||
extern DECLSPEC void SDLCALL SDL_PauseAudioDevice(SDL_AudioDeviceID dev,
|
extern DECLSPEC void SDLCALL SDL_PauseAudioDevice(SDL_AudioDeviceID dev,
|
||||||
int pause_on);
|
int pause_on);
|
||||||
/* @} *//* Pause audio functions */
|
/* @} *//* Pause audio functions */
|
||||||
@@ -633,14 +794,14 @@ extern DECLSPEC void SDLCALL SDL_PauseAudioDevice(SDL_AudioDeviceID dev,
|
|||||||
*
|
*
|
||||||
* Example:
|
* Example:
|
||||||
*
|
*
|
||||||
* ```c++
|
* ```c
|
||||||
* SDL_LoadWAV_RW(SDL_RWFromFile("sample.wav", "rb"), 1, &spec, &buf, &len);
|
* SDL_LoadWAV_RW(SDL_RWFromFile("sample.wav", "rb"), 1, &spec, &buf, &len);
|
||||||
* ```
|
* ```
|
||||||
*
|
*
|
||||||
* Note that the SDL_LoadWAV macro does this same thing for you, but in a less
|
* Note that the SDL_LoadWAV macro does this same thing for you, but in a less
|
||||||
* messy way:
|
* messy way:
|
||||||
*
|
*
|
||||||
* ```c++
|
* ```c
|
||||||
* SDL_LoadWAV("sample.wav", &spec, &buf, &len);
|
* SDL_LoadWAV("sample.wav", &spec, &buf, &len);
|
||||||
* ```
|
* ```
|
||||||
*
|
*
|
||||||
@@ -665,6 +826,8 @@ extern DECLSPEC void SDLCALL SDL_PauseAudioDevice(SDL_AudioDeviceID dev,
|
|||||||
* When the application is done with the data returned in
|
* When the application is done with the data returned in
|
||||||
* `audio_buf`, it should call SDL_FreeWAV() to dispose of it.
|
* `audio_buf`, it should call SDL_FreeWAV() to dispose of it.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_FreeWAV
|
* \sa SDL_FreeWAV
|
||||||
* \sa SDL_LoadWAV
|
* \sa SDL_LoadWAV
|
||||||
*/
|
*/
|
||||||
@@ -691,6 +854,8 @@ extern DECLSPEC SDL_AudioSpec *SDLCALL SDL_LoadWAV_RW(SDL_RWops * src,
|
|||||||
* \param audio_buf a pointer to the buffer created by SDL_LoadWAV() or
|
* \param audio_buf a pointer to the buffer created by SDL_LoadWAV() or
|
||||||
* SDL_LoadWAV_RW()
|
* SDL_LoadWAV_RW()
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_LoadWAV
|
* \sa SDL_LoadWAV
|
||||||
* \sa SDL_LoadWAV_RW
|
* \sa SDL_LoadWAV_RW
|
||||||
*/
|
*/
|
||||||
@@ -724,6 +889,8 @@ extern DECLSPEC void SDLCALL SDL_FreeWAV(Uint8 * audio_buf);
|
|||||||
* or a negative error code on failure; call SDL_GetError() for more
|
* or a negative error code on failure; call SDL_GetError() for more
|
||||||
* information.
|
* information.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_ConvertAudio
|
* \sa SDL_ConvertAudio
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC int SDLCALL SDL_BuildAudioCVT(SDL_AudioCVT * cvt,
|
extern DECLSPEC int SDLCALL SDL_BuildAudioCVT(SDL_AudioCVT * cvt,
|
||||||
@@ -768,6 +935,8 @@ extern DECLSPEC int SDLCALL SDL_BuildAudioCVT(SDL_AudioCVT * cvt,
|
|||||||
* \returns 0 if the conversion was completed successfully or a negative error
|
* \returns 0 if the conversion was completed successfully or a negative error
|
||||||
* code on failure; call SDL_GetError() for more information.
|
* code on failure; call SDL_GetError() for more information.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_BuildAudioCVT
|
* \sa SDL_BuildAudioCVT
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC int SDLCALL SDL_ConvertAudio(SDL_AudioCVT * cvt);
|
extern DECLSPEC int SDLCALL SDL_ConvertAudio(SDL_AudioCVT * cvt);
|
||||||
@@ -794,6 +963,8 @@ typedef struct _SDL_AudioStream SDL_AudioStream;
|
|||||||
* \param dst_rate The sampling rate of the desired audio output
|
* \param dst_rate The sampling rate of the desired audio output
|
||||||
* \returns 0 on success, or -1 on error.
|
* \returns 0 on success, or -1 on error.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.7.
|
||||||
|
*
|
||||||
* \sa SDL_AudioStreamPut
|
* \sa SDL_AudioStreamPut
|
||||||
* \sa SDL_AudioStreamGet
|
* \sa SDL_AudioStreamGet
|
||||||
* \sa SDL_AudioStreamAvailable
|
* \sa SDL_AudioStreamAvailable
|
||||||
@@ -816,6 +987,8 @@ extern DECLSPEC SDL_AudioStream * SDLCALL SDL_NewAudioStream(const SDL_AudioForm
|
|||||||
* \param len The number of bytes to write to the stream
|
* \param len The number of bytes to write to the stream
|
||||||
* \returns 0 on success, or -1 on error.
|
* \returns 0 on success, or -1 on error.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.7.
|
||||||
|
*
|
||||||
* \sa SDL_NewAudioStream
|
* \sa SDL_NewAudioStream
|
||||||
* \sa SDL_AudioStreamGet
|
* \sa SDL_AudioStreamGet
|
||||||
* \sa SDL_AudioStreamAvailable
|
* \sa SDL_AudioStreamAvailable
|
||||||
@@ -833,6 +1006,8 @@ extern DECLSPEC int SDLCALL SDL_AudioStreamPut(SDL_AudioStream *stream, const vo
|
|||||||
* \param len The maximum number of bytes to fill
|
* \param len The maximum number of bytes to fill
|
||||||
* \returns the number of bytes read from the stream, or -1 on error
|
* \returns the number of bytes read from the stream, or -1 on error
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.7.
|
||||||
|
*
|
||||||
* \sa SDL_NewAudioStream
|
* \sa SDL_NewAudioStream
|
||||||
* \sa SDL_AudioStreamPut
|
* \sa SDL_AudioStreamPut
|
||||||
* \sa SDL_AudioStreamAvailable
|
* \sa SDL_AudioStreamAvailable
|
||||||
@@ -849,6 +1024,8 @@ extern DECLSPEC int SDLCALL SDL_AudioStreamGet(SDL_AudioStream *stream, void *bu
|
|||||||
* resample correctly, so this number might be lower than what you expect, or
|
* resample correctly, so this number might be lower than what you expect, or
|
||||||
* even be zero. Add more data or flush the stream if you need the data now.
|
* even be zero. Add more data or flush the stream if you need the data now.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.7.
|
||||||
|
*
|
||||||
* \sa SDL_NewAudioStream
|
* \sa SDL_NewAudioStream
|
||||||
* \sa SDL_AudioStreamPut
|
* \sa SDL_AudioStreamPut
|
||||||
* \sa SDL_AudioStreamGet
|
* \sa SDL_AudioStreamGet
|
||||||
@@ -866,6 +1043,8 @@ extern DECLSPEC int SDLCALL SDL_AudioStreamAvailable(SDL_AudioStream *stream);
|
|||||||
* audio gaps in the output. Generally this is intended to signal the end of
|
* audio gaps in the output. Generally this is intended to signal the end of
|
||||||
* input, so the complete output becomes available.
|
* input, so the complete output becomes available.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.7.
|
||||||
|
*
|
||||||
* \sa SDL_NewAudioStream
|
* \sa SDL_NewAudioStream
|
||||||
* \sa SDL_AudioStreamPut
|
* \sa SDL_AudioStreamPut
|
||||||
* \sa SDL_AudioStreamGet
|
* \sa SDL_AudioStreamGet
|
||||||
@@ -878,6 +1057,8 @@ extern DECLSPEC int SDLCALL SDL_AudioStreamFlush(SDL_AudioStream *stream);
|
|||||||
/**
|
/**
|
||||||
* Clear any pending data in the stream without converting it
|
* Clear any pending data in the stream without converting it
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.7.
|
||||||
|
*
|
||||||
* \sa SDL_NewAudioStream
|
* \sa SDL_NewAudioStream
|
||||||
* \sa SDL_AudioStreamPut
|
* \sa SDL_AudioStreamPut
|
||||||
* \sa SDL_AudioStreamGet
|
* \sa SDL_AudioStreamGet
|
||||||
@@ -890,6 +1071,8 @@ extern DECLSPEC void SDLCALL SDL_AudioStreamClear(SDL_AudioStream *stream);
|
|||||||
/**
|
/**
|
||||||
* Free an audio stream
|
* Free an audio stream
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.7.
|
||||||
|
*
|
||||||
* \sa SDL_NewAudioStream
|
* \sa SDL_NewAudioStream
|
||||||
* \sa SDL_AudioStreamPut
|
* \sa SDL_AudioStreamPut
|
||||||
* \sa SDL_AudioStreamGet
|
* \sa SDL_AudioStreamGet
|
||||||
@@ -900,17 +1083,18 @@ extern DECLSPEC void SDLCALL SDL_AudioStreamClear(SDL_AudioStream *stream);
|
|||||||
extern DECLSPEC void SDLCALL SDL_FreeAudioStream(SDL_AudioStream *stream);
|
extern DECLSPEC void SDLCALL SDL_FreeAudioStream(SDL_AudioStream *stream);
|
||||||
|
|
||||||
#define SDL_MIX_MAXVOLUME 128
|
#define SDL_MIX_MAXVOLUME 128
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function is a legacy means of mixing audio.
|
* This function is a legacy means of mixing audio.
|
||||||
*
|
*
|
||||||
* This function is equivalent to calling
|
* This function is equivalent to calling...
|
||||||
*
|
*
|
||||||
* ```c++
|
* ```c
|
||||||
* SDL_MixAudioFormat(dst, src, format, len, volume);
|
* SDL_MixAudioFormat(dst, src, format, len, volume);
|
||||||
* ```
|
* ```
|
||||||
*
|
*
|
||||||
* where `format` is the obtained format of the audio device from the legacy
|
* ...where `format` is the obtained format of the audio device from the
|
||||||
* SDL_OpenAudio() function.
|
* legacy SDL_OpenAudio() function.
|
||||||
*
|
*
|
||||||
* \param dst the destination for the mixed audio
|
* \param dst the destination for the mixed audio
|
||||||
* \param src the source audio buffer to be mixed
|
* \param src the source audio buffer to be mixed
|
||||||
@@ -918,6 +1102,8 @@ extern DECLSPEC void SDLCALL SDL_FreeAudioStream(SDL_AudioStream *stream);
|
|||||||
* \param volume ranges from 0 - 128, and should be set to SDL_MIX_MAXVOLUME
|
* \param volume ranges from 0 - 128, and should be set to SDL_MIX_MAXVOLUME
|
||||||
* for full audio volume
|
* for full audio volume
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_MixAudioFormat
|
* \sa SDL_MixAudioFormat
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC void SDLCALL SDL_MixAudio(Uint8 * dst, const Uint8 * src,
|
extern DECLSPEC void SDLCALL SDL_MixAudio(Uint8 * dst, const Uint8 * src,
|
||||||
@@ -950,6 +1136,8 @@ extern DECLSPEC void SDLCALL SDL_MixAudio(Uint8 * dst, const Uint8 * src,
|
|||||||
* \param len the length of the audio buffer in bytes
|
* \param len the length of the audio buffer in bytes
|
||||||
* \param volume ranges from 0 - 128, and should be set to SDL_MIX_MAXVOLUME
|
* \param volume ranges from 0 - 128, and should be set to SDL_MIX_MAXVOLUME
|
||||||
* for full audio volume
|
* for full audio volume
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC void SDLCALL SDL_MixAudioFormat(Uint8 * dst,
|
extern DECLSPEC void SDLCALL SDL_MixAudioFormat(Uint8 * dst,
|
||||||
const Uint8 * src,
|
const Uint8 * src,
|
||||||
@@ -987,10 +1175,9 @@ extern DECLSPEC void SDLCALL SDL_MixAudioFormat(Uint8 * dst,
|
|||||||
* You should not call SDL_LockAudio() on the device before queueing; SDL
|
* You should not call SDL_LockAudio() on the device before queueing; SDL
|
||||||
* handles locking internally for this function.
|
* handles locking internally for this function.
|
||||||
*
|
*
|
||||||
* Note that SDL2
|
* Note that SDL2 does not support planar audio. You will need to resample
|
||||||
* [https://discourse.libsdl.org/t/sdl2-support-for-planar-audio/31263/3 does
|
* from planar audio formats into a non-planar one (see SDL_AudioFormat)
|
||||||
* not support planar audio]. You will need to resample from planar audio
|
* before queuing audio.
|
||||||
* formats into a non-planar one (see SDL_AudioFormat) before queuing audio.
|
|
||||||
*
|
*
|
||||||
* \param dev the device ID to which we will queue audio
|
* \param dev the device ID to which we will queue audio
|
||||||
* \param data the data to queue to the device for later playback
|
* \param data the data to queue to the device for later playback
|
||||||
@@ -1131,22 +1318,112 @@ extern DECLSPEC void SDLCALL SDL_ClearQueuedAudio(SDL_AudioDeviceID dev);
|
|||||||
* function or you will cause deadlock.
|
* function or you will cause deadlock.
|
||||||
*/
|
*/
|
||||||
/* @{ */
|
/* @{ */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function is a legacy means of locking the audio device.
|
||||||
|
*
|
||||||
|
* New programs might want to use SDL_LockAudioDevice() instead. This function
|
||||||
|
* is equivalent to calling...
|
||||||
|
*
|
||||||
|
* ```c
|
||||||
|
* SDL_LockAudioDevice(1);
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* ...and is only useful if you used the legacy SDL_OpenAudio() function.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
|
* \sa SDL_LockAudioDevice
|
||||||
|
* \sa SDL_UnlockAudio
|
||||||
|
* \sa SDL_UnlockAudioDevice
|
||||||
|
*/
|
||||||
extern DECLSPEC void SDLCALL SDL_LockAudio(void);
|
extern DECLSPEC void SDLCALL SDL_LockAudio(void);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Use this function to lock out the audio callback function for a specified
|
||||||
|
* device.
|
||||||
|
*
|
||||||
|
* The lock manipulated by these functions protects the audio callback
|
||||||
|
* function specified in SDL_OpenAudioDevice(). During a
|
||||||
|
* SDL_LockAudioDevice()/SDL_UnlockAudioDevice() pair, you can be guaranteed
|
||||||
|
* that the callback function for that device is not running, even if the
|
||||||
|
* device is not paused. While a device is locked, any other unpaused,
|
||||||
|
* unlocked devices may still run their callbacks.
|
||||||
|
*
|
||||||
|
* Calling this function from inside your audio callback is unnecessary. SDL
|
||||||
|
* obtains this lock before calling your function, and releases it when the
|
||||||
|
* function returns.
|
||||||
|
*
|
||||||
|
* You should not hold the lock longer than absolutely necessary. If you hold
|
||||||
|
* it too long, you'll experience dropouts in your audio playback. Ideally,
|
||||||
|
* your application locks the device, sets a few variables and unlocks again.
|
||||||
|
* Do not do heavy work while holding the lock for a device.
|
||||||
|
*
|
||||||
|
* It is safe to lock the audio device multiple times, as long as you unlock
|
||||||
|
* it an equivalent number of times. The callback will not run until the
|
||||||
|
* device has been unlocked completely in this way. If your application fails
|
||||||
|
* to unlock the device appropriately, your callback will never run, you might
|
||||||
|
* hear repeating bursts of audio, and SDL_CloseAudioDevice() will probably
|
||||||
|
* deadlock.
|
||||||
|
*
|
||||||
|
* Internally, the audio device lock is a mutex; if you lock from two threads
|
||||||
|
* at once, not only will you block the audio callback, you'll block the other
|
||||||
|
* thread.
|
||||||
|
*
|
||||||
|
* \param dev the ID of the device to be locked
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
|
* \sa SDL_UnlockAudioDevice
|
||||||
|
*/
|
||||||
extern DECLSPEC void SDLCALL SDL_LockAudioDevice(SDL_AudioDeviceID dev);
|
extern DECLSPEC void SDLCALL SDL_LockAudioDevice(SDL_AudioDeviceID dev);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function is a legacy means of unlocking the audio device.
|
||||||
|
*
|
||||||
|
* New programs might want to use SDL_UnlockAudioDevice() instead. This
|
||||||
|
* function is equivalent to calling...
|
||||||
|
*
|
||||||
|
* ```c
|
||||||
|
* SDL_UnlockAudioDevice(1);
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* ...and is only useful if you used the legacy SDL_OpenAudio() function.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
|
* \sa SDL_LockAudio
|
||||||
|
* \sa SDL_UnlockAudioDevice
|
||||||
|
*/
|
||||||
extern DECLSPEC void SDLCALL SDL_UnlockAudio(void);
|
extern DECLSPEC void SDLCALL SDL_UnlockAudio(void);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Use this function to unlock the audio callback function for a specified
|
||||||
|
* device.
|
||||||
|
*
|
||||||
|
* This function should be paired with a previous SDL_LockAudioDevice() call.
|
||||||
|
*
|
||||||
|
* \param dev the ID of the device to be unlocked
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
|
* \sa SDL_LockAudioDevice
|
||||||
|
*/
|
||||||
extern DECLSPEC void SDLCALL SDL_UnlockAudioDevice(SDL_AudioDeviceID dev);
|
extern DECLSPEC void SDLCALL SDL_UnlockAudioDevice(SDL_AudioDeviceID dev);
|
||||||
/* @} *//* Audio lock functions */
|
/* @} *//* Audio lock functions */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function is a legacy means of closing the audio device.
|
* This function is a legacy means of closing the audio device.
|
||||||
*
|
*
|
||||||
* This function is equivalent to calling
|
* This function is equivalent to calling...
|
||||||
*
|
*
|
||||||
* ```c++
|
* ```c
|
||||||
* SDL_CloseAudioDevice(1);
|
* SDL_CloseAudioDevice(1);
|
||||||
* ```
|
* ```
|
||||||
*
|
*
|
||||||
* and is only useful if you used the legacy SDL_OpenAudio() function.
|
* ...and is only useful if you used the legacy SDL_OpenAudio() function.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
*
|
*
|
||||||
* \sa SDL_OpenAudio
|
* \sa SDL_OpenAudio
|
||||||
*/
|
*/
|
||||||
@@ -1170,6 +1447,8 @@ extern DECLSPEC void SDLCALL SDL_CloseAudio(void);
|
|||||||
*
|
*
|
||||||
* \param dev an audio device previously opened with SDL_OpenAudioDevice()
|
* \param dev an audio device previously opened with SDL_OpenAudioDevice()
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_OpenAudioDevice
|
* \sa SDL_OpenAudioDevice
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC void SDLCALL SDL_CloseAudioDevice(SDL_AudioDeviceID dev);
|
extern DECLSPEC void SDLCALL SDL_CloseAudioDevice(SDL_AudioDeviceID dev);
|
||||||
|
|||||||
+2
-2
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
Simple DirectMedia Layer
|
Simple DirectMedia Layer
|
||||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
||||||
|
|
||||||
This software is provided 'as-is', without any express or implied
|
This software is provided 'as-is', without any express or implied
|
||||||
warranty. In no event will the authors be held liable for any damages
|
warranty. In no event will the authors be held liable for any damages
|
||||||
@@ -48,7 +48,7 @@ extern "C" {
|
|||||||
* \return the index of the most significant bit, or -1 if the value is 0.
|
* \return the index of the most significant bit, or -1 if the value is 0.
|
||||||
*/
|
*/
|
||||||
#if defined(__WATCOMC__) && defined(__386__)
|
#if defined(__WATCOMC__) && defined(__386__)
|
||||||
extern _inline int _SDL_bsr_watcom (Uint32);
|
extern __inline int _SDL_bsr_watcom(Uint32);
|
||||||
#pragma aux _SDL_bsr_watcom = \
|
#pragma aux _SDL_bsr_watcom = \
|
||||||
"bsr eax, eax" \
|
"bsr eax, eax" \
|
||||||
parm [eax] nomemory \
|
parm [eax] nomemory \
|
||||||
|
|||||||
+2
-2
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
Simple DirectMedia Layer
|
Simple DirectMedia Layer
|
||||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
||||||
|
|
||||||
This software is provided 'as-is', without any express or implied
|
This software is provided 'as-is', without any express or implied
|
||||||
warranty. In no event will the authors be held liable for any damages
|
warranty. In no event will the authors be held liable for any damages
|
||||||
@@ -175,7 +175,7 @@ typedef enum
|
|||||||
* \returns an SDL_BlendMode that represents the chosen factors and
|
* \returns an SDL_BlendMode that represents the chosen factors and
|
||||||
* operations.
|
* operations.
|
||||||
*
|
*
|
||||||
* \since This function is available in SDL 2.0.6.
|
* \since This function is available since SDL 2.0.6.
|
||||||
*
|
*
|
||||||
* \sa SDL_SetRenderDrawBlendMode
|
* \sa SDL_SetRenderDrawBlendMode
|
||||||
* \sa SDL_GetRenderDrawBlendMode
|
* \sa SDL_GetRenderDrawBlendMode
|
||||||
|
|||||||
+10
-5
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
Simple DirectMedia Layer
|
Simple DirectMedia Layer
|
||||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
||||||
|
|
||||||
This software is provided 'as-is', without any express or implied
|
This software is provided 'as-is', without any express or implied
|
||||||
warranty. In no event will the authors be held liable for any damages
|
warranty. In no event will the authors be held liable for any damages
|
||||||
@@ -45,6 +45,8 @@ extern "C" {
|
|||||||
* \returns 0 on success or a negative error code on failure; call
|
* \returns 0 on success or a negative error code on failure; call
|
||||||
* SDL_GetError() for more information.
|
* SDL_GetError() for more information.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_GetClipboardText
|
* \sa SDL_GetClipboardText
|
||||||
* \sa SDL_HasClipboardText
|
* \sa SDL_HasClipboardText
|
||||||
*/
|
*/
|
||||||
@@ -53,12 +55,15 @@ extern DECLSPEC int SDLCALL SDL_SetClipboardText(const char *text);
|
|||||||
/**
|
/**
|
||||||
* Get UTF-8 text from the clipboard, which must be freed with SDL_free().
|
* Get UTF-8 text from the clipboard, which must be freed with SDL_free().
|
||||||
*
|
*
|
||||||
* This functions returns NULL if there was not enough memory left for a copy
|
* This functions returns empty string if there was not enough memory left for
|
||||||
* of the clipboard's content.
|
* a copy of the clipboard's content.
|
||||||
*
|
*
|
||||||
* \returns the clipboard text on success or NULL on failure; call
|
* \returns the clipboard text on success or an empty string on failure; call
|
||||||
* SDL_GetError() for more information. Caller must call SDL_free()
|
* SDL_GetError() for more information. Caller must call SDL_free()
|
||||||
* on the returned pointer when done with it.
|
* on the returned pointer when done with it (even if there was an
|
||||||
|
* error).
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
*
|
*
|
||||||
* \sa SDL_HasClipboardText
|
* \sa SDL_HasClipboardText
|
||||||
* \sa SDL_SetClipboardText
|
* \sa SDL_SetClipboardText
|
||||||
|
|||||||
+24
-18
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
Simple DirectMedia Layer
|
Simple DirectMedia Layer
|
||||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
||||||
|
|
||||||
This software is provided 'as-is', without any express or implied
|
This software is provided 'as-is', without any express or implied
|
||||||
warranty. In no event will the authors be held liable for any damages
|
warranty. In no event will the authors be held liable for any damages
|
||||||
@@ -25,10 +25,23 @@
|
|||||||
|
|
||||||
#include "SDL_platform.h"
|
#include "SDL_platform.h"
|
||||||
|
|
||||||
|
/* winsdkver.h defines _WIN32_MAXVER for SDK version detection. It is present since at least the Windows 7 SDK,
|
||||||
|
* but out of caution we'll only use it if the compiler supports __has_include() to confirm its presence.
|
||||||
|
* If your compiler doesn't support __has_include() but you have winsdkver.h, define HAVE_WINSDKVER_H. */
|
||||||
|
#if !defined(HAVE_WINSDKVER_H) && defined(__has_include)
|
||||||
|
#if __has_include(<winsdkver.h>)
|
||||||
|
#define HAVE_WINSDKVER_H 1
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_WINSDKVER_H
|
||||||
|
#include <winsdkver.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
/* This is a set of defines to configure the SDL features */
|
/* This is a set of defines to configure the SDL features */
|
||||||
|
|
||||||
#if !defined(_STDINT_H_) && (!defined(HAVE_STDINT_H) || !_HAVE_STDINT_H)
|
#if !defined(_STDINT_H_) && (!defined(HAVE_STDINT_H) || !_HAVE_STDINT_H)
|
||||||
#if defined(__GNUC__) || defined(__DMC__) || defined(__WATCOMC__) || defined(__clang__)
|
#if defined(__GNUC__) || defined(__DMC__) || defined(__WATCOMC__) || defined(__clang__) || defined(__BORLANDC__) || defined(__CODEGEARC__)
|
||||||
#define HAVE_STDINT_H 1
|
#define HAVE_STDINT_H 1
|
||||||
#elif defined(_MSC_VER)
|
#elif defined(_MSC_VER)
|
||||||
typedef signed __int8 int8_t;
|
typedef signed __int8 int8_t;
|
||||||
@@ -82,8 +95,15 @@ typedef unsigned int uintptr_t;
|
|||||||
#define HAVE_DSOUND_H 1
|
#define HAVE_DSOUND_H 1
|
||||||
#define HAVE_DXGI_H 1
|
#define HAVE_DXGI_H 1
|
||||||
#define HAVE_XINPUT_H 1
|
#define HAVE_XINPUT_H 1
|
||||||
|
#if defined(_WIN32_MAXVER) && _WIN32_MAXVER >= 0x0A00 /* Windows 10 SDK */
|
||||||
|
#define HAVE_WINDOWS_GAMING_INPUT_H 1
|
||||||
|
#endif
|
||||||
|
#if defined(_WIN32_MAXVER) && _WIN32_MAXVER >= 0x0602 /* Windows 8 SDK */
|
||||||
|
#define HAVE_D3D11_H 1
|
||||||
|
#endif
|
||||||
#define HAVE_MMDEVICEAPI_H 1
|
#define HAVE_MMDEVICEAPI_H 1
|
||||||
#define HAVE_AUDIOCLIENT_H 1
|
#define HAVE_AUDIOCLIENT_H 1
|
||||||
|
#define HAVE_TPCSHRD_H 1
|
||||||
#define HAVE_SENSORSAPI_H 1
|
#define HAVE_SENSORSAPI_H 1
|
||||||
#if (defined(_M_IX86) || defined(_M_X64) || defined(_M_AMD64)) && (defined(_MSC_VER) && _MSC_VER >= 1600)
|
#if (defined(_M_IX86) || defined(_M_X64) || defined(_M_AMD64)) && (defined(_MSC_VER) && _MSC_VER >= 1600)
|
||||||
#define HAVE_IMMINTRIN_H 1
|
#define HAVE_IMMINTRIN_H 1
|
||||||
@@ -201,20 +221,6 @@ typedef unsigned int uintptr_t;
|
|||||||
#define HAVE_STDDEF_H 1
|
#define HAVE_STDDEF_H 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Check to see if we have Windows 10 build environment */
|
|
||||||
#if defined(_MSC_VER) && (_MSC_VER >= 1911) /* Visual Studio 15.3 */
|
|
||||||
#include <sdkddkver.h>
|
|
||||||
#if _WIN32_WINNT >= 0x0601 /* Windows 7 */
|
|
||||||
#define SDL_WINDOWS7_SDK
|
|
||||||
#endif
|
|
||||||
#if _WIN32_WINNT >= 0x0602 /* Windows 8 */
|
|
||||||
#define SDL_WINDOWS8_SDK
|
|
||||||
#endif
|
|
||||||
#if _WIN32_WINNT >= 0x0A00 /* Windows 10 */
|
|
||||||
#define SDL_WINDOWS10_SDK
|
|
||||||
#endif
|
|
||||||
#endif /* _MSC_VER >= 1911 */
|
|
||||||
|
|
||||||
/* Enable various audio drivers */
|
/* Enable various audio drivers */
|
||||||
#define SDL_AUDIO_DRIVER_WASAPI 1
|
#define SDL_AUDIO_DRIVER_WASAPI 1
|
||||||
#define SDL_AUDIO_DRIVER_DSOUND 1
|
#define SDL_AUDIO_DRIVER_DSOUND 1
|
||||||
@@ -229,7 +235,7 @@ typedef unsigned int uintptr_t;
|
|||||||
#define SDL_JOYSTICK_RAWINPUT 1
|
#define SDL_JOYSTICK_RAWINPUT 1
|
||||||
#endif
|
#endif
|
||||||
#define SDL_JOYSTICK_VIRTUAL 1
|
#define SDL_JOYSTICK_VIRTUAL 1
|
||||||
#ifdef SDL_WINDOWS10_SDK
|
#ifdef HAVE_WINDOWS_GAMING_INPUT_H
|
||||||
#define SDL_JOYSTICK_WGI 1
|
#define SDL_JOYSTICK_WGI 1
|
||||||
#endif
|
#endif
|
||||||
#define SDL_JOYSTICK_XINPUT 1
|
#define SDL_JOYSTICK_XINPUT 1
|
||||||
@@ -256,7 +262,7 @@ typedef unsigned int uintptr_t;
|
|||||||
#ifndef SDL_VIDEO_RENDER_D3D
|
#ifndef SDL_VIDEO_RENDER_D3D
|
||||||
#define SDL_VIDEO_RENDER_D3D 1
|
#define SDL_VIDEO_RENDER_D3D 1
|
||||||
#endif
|
#endif
|
||||||
#ifdef SDL_WINDOWS7_SDK
|
#if !defined(SDL_VIDEO_RENDER_D3D11) && defined(HAVE_D3D11_H)
|
||||||
#define SDL_VIDEO_RENDER_D3D11 1
|
#define SDL_VIDEO_RENDER_D3D11 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
+37
-2
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
Simple DirectMedia Layer
|
Simple DirectMedia Layer
|
||||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
||||||
|
|
||||||
This software is provided 'as-is', without any express or implied
|
This software is provided 'as-is', without any express or implied
|
||||||
warranty. In no event will the authors be held liable for any damages
|
warranty. In no event will the authors be held liable for any damages
|
||||||
@@ -63,6 +63,9 @@ _m_prefetch(void *__P)
|
|||||||
#ifndef __SSE2__
|
#ifndef __SSE2__
|
||||||
#define __SSE2__
|
#define __SSE2__
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef __SSE3__
|
||||||
|
#define __SSE3__
|
||||||
|
#endif
|
||||||
#elif defined(__MINGW64_VERSION_MAJOR)
|
#elif defined(__MINGW64_VERSION_MAJOR)
|
||||||
#include <intrin.h>
|
#include <intrin.h>
|
||||||
#if !defined(SDL_DISABLE_ARM_NEON_H) && defined(__ARM_NEON)
|
#if !defined(SDL_DISABLE_ARM_NEON_H) && defined(__ARM_NEON)
|
||||||
@@ -155,6 +158,8 @@ extern DECLSPEC int SDLCALL SDL_GetCPUCacheLineSize(void);
|
|||||||
*
|
*
|
||||||
* \returns SDL_TRUE if the CPU has the RDTSC instruction or SDL_FALSE if not.
|
* \returns SDL_TRUE if the CPU has the RDTSC instruction or SDL_FALSE if not.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_Has3DNow
|
* \sa SDL_Has3DNow
|
||||||
* \sa SDL_HasAltiVec
|
* \sa SDL_HasAltiVec
|
||||||
* \sa SDL_HasAVX
|
* \sa SDL_HasAVX
|
||||||
@@ -176,6 +181,8 @@ extern DECLSPEC SDL_bool SDLCALL SDL_HasRDTSC(void);
|
|||||||
*
|
*
|
||||||
* \returns SDL_TRUE if the CPU has AltiVec features or SDL_FALSE if not.
|
* \returns SDL_TRUE if the CPU has AltiVec features or SDL_FALSE if not.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_Has3DNow
|
* \sa SDL_Has3DNow
|
||||||
* \sa SDL_HasAVX
|
* \sa SDL_HasAVX
|
||||||
* \sa SDL_HasAVX2
|
* \sa SDL_HasAVX2
|
||||||
@@ -196,6 +203,8 @@ extern DECLSPEC SDL_bool SDLCALL SDL_HasAltiVec(void);
|
|||||||
*
|
*
|
||||||
* \returns SDL_TRUE if the CPU has MMX features or SDL_FALSE if not.
|
* \returns SDL_TRUE if the CPU has MMX features or SDL_FALSE if not.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_Has3DNow
|
* \sa SDL_Has3DNow
|
||||||
* \sa SDL_HasAltiVec
|
* \sa SDL_HasAltiVec
|
||||||
* \sa SDL_HasAVX
|
* \sa SDL_HasAVX
|
||||||
@@ -216,6 +225,8 @@ extern DECLSPEC SDL_bool SDLCALL SDL_HasMMX(void);
|
|||||||
*
|
*
|
||||||
* \returns SDL_TRUE if the CPU has 3DNow! features or SDL_FALSE if not.
|
* \returns SDL_TRUE if the CPU has 3DNow! features or SDL_FALSE if not.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_HasAltiVec
|
* \sa SDL_HasAltiVec
|
||||||
* \sa SDL_HasAVX
|
* \sa SDL_HasAVX
|
||||||
* \sa SDL_HasAVX2
|
* \sa SDL_HasAVX2
|
||||||
@@ -236,6 +247,8 @@ extern DECLSPEC SDL_bool SDLCALL SDL_Has3DNow(void);
|
|||||||
*
|
*
|
||||||
* \returns SDL_TRUE if the CPU has SSE features or SDL_FALSE if not.
|
* \returns SDL_TRUE if the CPU has SSE features or SDL_FALSE if not.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_Has3DNow
|
* \sa SDL_Has3DNow
|
||||||
* \sa SDL_HasAltiVec
|
* \sa SDL_HasAltiVec
|
||||||
* \sa SDL_HasAVX
|
* \sa SDL_HasAVX
|
||||||
@@ -256,6 +269,8 @@ extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE(void);
|
|||||||
*
|
*
|
||||||
* \returns SDL_TRUE if the CPU has SSE2 features or SDL_FALSE if not.
|
* \returns SDL_TRUE if the CPU has SSE2 features or SDL_FALSE if not.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_Has3DNow
|
* \sa SDL_Has3DNow
|
||||||
* \sa SDL_HasAltiVec
|
* \sa SDL_HasAltiVec
|
||||||
* \sa SDL_HasAVX
|
* \sa SDL_HasAVX
|
||||||
@@ -276,6 +291,8 @@ extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE2(void);
|
|||||||
*
|
*
|
||||||
* \returns SDL_TRUE if the CPU has SSE3 features or SDL_FALSE if not.
|
* \returns SDL_TRUE if the CPU has SSE3 features or SDL_FALSE if not.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_Has3DNow
|
* \sa SDL_Has3DNow
|
||||||
* \sa SDL_HasAltiVec
|
* \sa SDL_HasAltiVec
|
||||||
* \sa SDL_HasAVX
|
* \sa SDL_HasAVX
|
||||||
@@ -296,6 +313,8 @@ extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE3(void);
|
|||||||
*
|
*
|
||||||
* \returns SDL_TRUE if the CPU has SSE4.1 features or SDL_FALSE if not.
|
* \returns SDL_TRUE if the CPU has SSE4.1 features or SDL_FALSE if not.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_Has3DNow
|
* \sa SDL_Has3DNow
|
||||||
* \sa SDL_HasAltiVec
|
* \sa SDL_HasAltiVec
|
||||||
* \sa SDL_HasAVX
|
* \sa SDL_HasAVX
|
||||||
@@ -316,6 +335,8 @@ extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE41(void);
|
|||||||
*
|
*
|
||||||
* \returns SDL_TRUE if the CPU has SSE4.2 features or SDL_FALSE if not.
|
* \returns SDL_TRUE if the CPU has SSE4.2 features or SDL_FALSE if not.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_Has3DNow
|
* \sa SDL_Has3DNow
|
||||||
* \sa SDL_HasAltiVec
|
* \sa SDL_HasAltiVec
|
||||||
* \sa SDL_HasAVX
|
* \sa SDL_HasAVX
|
||||||
@@ -380,6 +401,8 @@ extern DECLSPEC SDL_bool SDLCALL SDL_HasAVX2(void);
|
|||||||
*
|
*
|
||||||
* \returns SDL_TRUE if the CPU has AVX-512F features or SDL_FALSE if not.
|
* \returns SDL_TRUE if the CPU has AVX-512F features or SDL_FALSE if not.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.9.
|
||||||
|
*
|
||||||
* \sa SDL_HasAVX
|
* \sa SDL_HasAVX
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC SDL_bool SDLCALL SDL_HasAVX512F(void);
|
extern DECLSPEC SDL_bool SDLCALL SDL_HasAVX512F(void);
|
||||||
@@ -393,6 +416,8 @@ extern DECLSPEC SDL_bool SDLCALL SDL_HasAVX512F(void);
|
|||||||
*
|
*
|
||||||
* \returns SDL_TRUE if the CPU has ARM SIMD features or SDL_FALSE if not.
|
* \returns SDL_TRUE if the CPU has ARM SIMD features or SDL_FALSE if not.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.12.
|
||||||
|
*
|
||||||
* \sa SDL_HasNEON
|
* \sa SDL_HasNEON
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC SDL_bool SDLCALL SDL_HasARMSIMD(void);
|
extern DECLSPEC SDL_bool SDLCALL SDL_HasARMSIMD(void);
|
||||||
@@ -403,6 +428,8 @@ extern DECLSPEC SDL_bool SDLCALL SDL_HasARMSIMD(void);
|
|||||||
* This always returns false on CPUs that aren't using ARM instruction sets.
|
* This always returns false on CPUs that aren't using ARM instruction sets.
|
||||||
*
|
*
|
||||||
* \returns SDL_TRUE if the CPU has ARM NEON features or SDL_FALSE if not.
|
* \returns SDL_TRUE if the CPU has ARM NEON features or SDL_FALSE if not.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.6.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC SDL_bool SDLCALL SDL_HasNEON(void);
|
extern DECLSPEC SDL_bool SDLCALL SDL_HasNEON(void);
|
||||||
|
|
||||||
@@ -429,6 +456,8 @@ extern DECLSPEC int SDLCALL SDL_GetSystemRAM(void);
|
|||||||
*
|
*
|
||||||
* \returns the alignment in bytes needed for available, known SIMD
|
* \returns the alignment in bytes needed for available, known SIMD
|
||||||
* instructions.
|
* instructions.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.10.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC size_t SDLCALL SDL_SIMDGetAlignment(void);
|
extern DECLSPEC size_t SDLCALL SDL_SIMDGetAlignment(void);
|
||||||
|
|
||||||
@@ -461,7 +490,9 @@ extern DECLSPEC size_t SDLCALL SDL_SIMDGetAlignment(void);
|
|||||||
*
|
*
|
||||||
* \param len The length, in bytes, of the block to allocate. The actual
|
* \param len The length, in bytes, of the block to allocate. The actual
|
||||||
* allocated block might be larger due to padding, etc.
|
* allocated block might be larger due to padding, etc.
|
||||||
* \returns a pointer to thenewly-allocated block, NULL if out of memory.
|
* \returns a pointer to the newly-allocated block, NULL if out of memory.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.10.
|
||||||
*
|
*
|
||||||
* \sa SDL_SIMDAlignment
|
* \sa SDL_SIMDAlignment
|
||||||
* \sa SDL_SIMDRealloc
|
* \sa SDL_SIMDRealloc
|
||||||
@@ -485,6 +516,8 @@ extern DECLSPEC void * SDLCALL SDL_SIMDAlloc(const size_t len);
|
|||||||
* memory.
|
* memory.
|
||||||
* \returns a pointer to the newly-reallocated block, NULL if out of memory.
|
* \returns a pointer to the newly-reallocated block, NULL if out of memory.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.14.
|
||||||
|
*
|
||||||
* \sa SDL_SIMDAlignment
|
* \sa SDL_SIMDAlignment
|
||||||
* \sa SDL_SIMDAlloc
|
* \sa SDL_SIMDAlloc
|
||||||
* \sa SDL_SIMDFree
|
* \sa SDL_SIMDFree
|
||||||
@@ -508,6 +541,8 @@ extern DECLSPEC void * SDLCALL SDL_SIMDRealloc(void *mem, const size_t len);
|
|||||||
* \param ptr The pointer, returned from SDL_SIMDAlloc or SDL_SIMDRealloc, to
|
* \param ptr The pointer, returned from SDL_SIMDAlloc or SDL_SIMDRealloc, to
|
||||||
* deallocate. NULL is a legal no-op.
|
* deallocate. NULL is a legal no-op.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.10.
|
||||||
|
*
|
||||||
* \sa SDL_SIMDAlloc
|
* \sa SDL_SIMDAlloc
|
||||||
* \sa SDL_SIMDRealloc
|
* \sa SDL_SIMDRealloc
|
||||||
*/
|
*/
|
||||||
|
|||||||
+905
-279
File diff suppressed because it is too large
Load Diff
+51
-50
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
Simple DirectMedia Layer
|
Simple DirectMedia Layer
|
||||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
||||||
|
|
||||||
This software is provided 'as-is', without any express or implied
|
This software is provided 'as-is', without any express or implied
|
||||||
warranty. In no event will the authors be held liable for any damages
|
warranty. In no event will the authors be held liable for any damages
|
||||||
@@ -30,20 +30,17 @@
|
|||||||
|
|
||||||
#include "SDL_stdinc.h"
|
#include "SDL_stdinc.h"
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#if defined(_MSC_VER) && (_MSC_VER >= 1400)
|
||||||
/* As of Clang 11, '_m_prefetchw' is conflicting with the winnt.h's version,
|
/* As of Clang 11, '_m_prefetchw' is conflicting with the winnt.h's version,
|
||||||
so we define the needed '_m_prefetch' here as a pseudo-header, until the issue is fixed. */
|
so we define the needed '_m_prefetch' here as a pseudo-header, until the issue is fixed. */
|
||||||
|
|
||||||
#ifdef __clang__
|
#ifdef __clang__
|
||||||
#ifndef __PRFCHWINTRIN_H
|
#ifndef __PRFCHWINTRIN_H
|
||||||
#define __PRFCHWINTRIN_H
|
#define __PRFCHWINTRIN_H
|
||||||
|
|
||||||
static __inline__ void __attribute__((__always_inline__, __nodebug__))
|
static __inline__ void __attribute__((__always_inline__, __nodebug__))
|
||||||
_m_prefetch(void *__P)
|
_m_prefetch(void *__P)
|
||||||
{
|
{
|
||||||
__builtin_prefetch (__P, 0, 3 /* _MM_HINT_T0 */);
|
__builtin_prefetch (__P, 0, 3 /* _MM_HINT_T0 */);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* __PRFCHWINTRIN_H */
|
#endif /* __PRFCHWINTRIN_H */
|
||||||
#endif /* __clang__ */
|
#endif /* __clang__ */
|
||||||
|
|
||||||
@@ -91,25 +88,45 @@ extern "C" {
|
|||||||
/**
|
/**
|
||||||
* \file SDL_endian.h
|
* \file SDL_endian.h
|
||||||
*/
|
*/
|
||||||
#if (defined(__clang__) && (__clang_major__ > 3 || (__clang_major__ == 3 && __clang_minor__ >= 2))) || \
|
|
||||||
(defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)))
|
/* various modern compilers may have builtin swap */
|
||||||
|
#if defined(__GNUC__) || defined(__clang__)
|
||||||
|
# define HAS_BUILTIN_BSWAP16 (_SDL_HAS_BUILTIN(__builtin_bswap16)) || \
|
||||||
|
(__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8))
|
||||||
|
# define HAS_BUILTIN_BSWAP32 (_SDL_HAS_BUILTIN(__builtin_bswap32)) || \
|
||||||
|
(__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
|
||||||
|
# define HAS_BUILTIN_BSWAP64 (_SDL_HAS_BUILTIN(__builtin_bswap64)) || \
|
||||||
|
(__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
|
||||||
|
|
||||||
|
/* this one is broken */
|
||||||
|
# define HAS_BROKEN_BSWAP (__GNUC__ == 2 && __GNUC_MINOR__ <= 95)
|
||||||
|
#else
|
||||||
|
# define HAS_BUILTIN_BSWAP16 0
|
||||||
|
# define HAS_BUILTIN_BSWAP32 0
|
||||||
|
# define HAS_BUILTIN_BSWAP64 0
|
||||||
|
# define HAS_BROKEN_BSWAP 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if HAS_BUILTIN_BSWAP16
|
||||||
#define SDL_Swap16(x) __builtin_bswap16(x)
|
#define SDL_Swap16(x) __builtin_bswap16(x)
|
||||||
#elif defined(__GNUC__) && defined(__i386__) && \
|
#elif defined(_MSC_VER) && (_MSC_VER >= 1400)
|
||||||
!(__GNUC__ == 2 && __GNUC_MINOR__ <= 95 /* broken gcc version */)
|
#pragma intrinsic(_byteswap_ushort)
|
||||||
|
#define SDL_Swap16(x) _byteswap_ushort(x)
|
||||||
|
#elif defined(__i386__) && !HAS_BROKEN_BSWAP
|
||||||
SDL_FORCE_INLINE Uint16
|
SDL_FORCE_INLINE Uint16
|
||||||
SDL_Swap16(Uint16 x)
|
SDL_Swap16(Uint16 x)
|
||||||
{
|
{
|
||||||
__asm__("xchgb %b0,%h0": "=q"(x):"0"(x));
|
__asm__("xchgb %b0,%h0": "=q"(x):"0"(x));
|
||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
#elif defined(__GNUC__) && defined(__x86_64__)
|
#elif defined(__x86_64__)
|
||||||
SDL_FORCE_INLINE Uint16
|
SDL_FORCE_INLINE Uint16
|
||||||
SDL_Swap16(Uint16 x)
|
SDL_Swap16(Uint16 x)
|
||||||
{
|
{
|
||||||
__asm__("xchgb %b0,%h0": "=Q"(x):"0"(x));
|
__asm__("xchgb %b0,%h0": "=Q"(x):"0"(x));
|
||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
#elif defined(__GNUC__) && (defined(__powerpc__) || defined(__ppc__))
|
#elif (defined(__powerpc__) || defined(__ppc__))
|
||||||
SDL_FORCE_INLINE Uint16
|
SDL_FORCE_INLINE Uint16
|
||||||
SDL_Swap16(Uint16 x)
|
SDL_Swap16(Uint16 x)
|
||||||
{
|
{
|
||||||
@@ -118,25 +135,15 @@ SDL_Swap16(Uint16 x)
|
|||||||
__asm__("rlwimi %0,%2,8,16,23": "=&r"(result):"0"(x >> 8), "r"(x));
|
__asm__("rlwimi %0,%2,8,16,23": "=&r"(result):"0"(x >> 8), "r"(x));
|
||||||
return (Uint16)result;
|
return (Uint16)result;
|
||||||
}
|
}
|
||||||
#elif defined(__GNUC__) && defined(__aarch64__)
|
#elif (defined(__m68k__) && !defined(__mcoldfire__))
|
||||||
SDL_FORCE_INLINE Uint16
|
|
||||||
SDL_Swap16(Uint16 x)
|
|
||||||
{
|
|
||||||
__asm__("rev16 %w1, %w0" : "=r"(x) : "r"(x));
|
|
||||||
return x;
|
|
||||||
}
|
|
||||||
#elif defined(__GNUC__) && (defined(__m68k__) && !defined(__mcoldfire__))
|
|
||||||
SDL_FORCE_INLINE Uint16
|
SDL_FORCE_INLINE Uint16
|
||||||
SDL_Swap16(Uint16 x)
|
SDL_Swap16(Uint16 x)
|
||||||
{
|
{
|
||||||
__asm__("rorw #8,%0": "=d"(x): "0"(x):"cc");
|
__asm__("rorw #8,%0": "=d"(x): "0"(x):"cc");
|
||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
#elif defined(_MSC_VER)
|
|
||||||
#pragma intrinsic(_byteswap_ushort)
|
|
||||||
#define SDL_Swap16(x) _byteswap_ushort(x)
|
|
||||||
#elif defined(__WATCOMC__) && defined(__386__)
|
#elif defined(__WATCOMC__) && defined(__386__)
|
||||||
extern _inline Uint16 SDL_Swap16(Uint16);
|
extern __inline Uint16 SDL_Swap16(Uint16);
|
||||||
#pragma aux SDL_Swap16 = \
|
#pragma aux SDL_Swap16 = \
|
||||||
"xchg al, ah" \
|
"xchg al, ah" \
|
||||||
parm [ax] \
|
parm [ax] \
|
||||||
@@ -149,25 +156,26 @@ SDL_Swap16(Uint16 x)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if (defined(__clang__) && (__clang_major__ > 2 || (__clang_major__ == 2 && __clang_minor__ >= 6))) || \
|
#if HAS_BUILTIN_BSWAP32
|
||||||
(defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)))
|
|
||||||
#define SDL_Swap32(x) __builtin_bswap32(x)
|
#define SDL_Swap32(x) __builtin_bswap32(x)
|
||||||
#elif defined(__GNUC__) && defined(__i386__) && \
|
#elif defined(_MSC_VER) && (_MSC_VER >= 1400)
|
||||||
!(__GNUC__ == 2 && __GNUC_MINOR__ <= 95 /* broken gcc version */)
|
#pragma intrinsic(_byteswap_ulong)
|
||||||
|
#define SDL_Swap32(x) _byteswap_ulong(x)
|
||||||
|
#elif defined(__i386__) && !HAS_BROKEN_BSWAP
|
||||||
SDL_FORCE_INLINE Uint32
|
SDL_FORCE_INLINE Uint32
|
||||||
SDL_Swap32(Uint32 x)
|
SDL_Swap32(Uint32 x)
|
||||||
{
|
{
|
||||||
__asm__("bswap %0": "=r"(x):"0"(x));
|
__asm__("bswap %0": "=r"(x):"0"(x));
|
||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
#elif defined(__GNUC__) && defined(__x86_64__)
|
#elif defined(__x86_64__)
|
||||||
SDL_FORCE_INLINE Uint32
|
SDL_FORCE_INLINE Uint32
|
||||||
SDL_Swap32(Uint32 x)
|
SDL_Swap32(Uint32 x)
|
||||||
{
|
{
|
||||||
__asm__("bswapl %0": "=r"(x):"0"(x));
|
__asm__("bswapl %0": "=r"(x):"0"(x));
|
||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
#elif defined(__GNUC__) && (defined(__powerpc__) || defined(__ppc__))
|
#elif (defined(__powerpc__) || defined(__ppc__))
|
||||||
SDL_FORCE_INLINE Uint32
|
SDL_FORCE_INLINE Uint32
|
||||||
SDL_Swap32(Uint32 x)
|
SDL_Swap32(Uint32 x)
|
||||||
{
|
{
|
||||||
@@ -178,14 +186,7 @@ SDL_Swap32(Uint32 x)
|
|||||||
__asm__("rlwimi %0,%2,24,0,7" : "=&r"(result): "0" (result), "r"(x));
|
__asm__("rlwimi %0,%2,24,0,7" : "=&r"(result): "0" (result), "r"(x));
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
#elif defined(__GNUC__) && defined(__aarch64__)
|
#elif (defined(__m68k__) && !defined(__mcoldfire__))
|
||||||
SDL_FORCE_INLINE Uint32
|
|
||||||
SDL_Swap32(Uint32 x)
|
|
||||||
{
|
|
||||||
__asm__("rev %w1, %w0": "=r"(x):"r"(x));
|
|
||||||
return x;
|
|
||||||
}
|
|
||||||
#elif defined(__GNUC__) && (defined(__m68k__) && !defined(__mcoldfire__))
|
|
||||||
SDL_FORCE_INLINE Uint32
|
SDL_FORCE_INLINE Uint32
|
||||||
SDL_Swap32(Uint32 x)
|
SDL_Swap32(Uint32 x)
|
||||||
{
|
{
|
||||||
@@ -193,14 +194,11 @@ SDL_Swap32(Uint32 x)
|
|||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
#elif defined(__WATCOMC__) && defined(__386__)
|
#elif defined(__WATCOMC__) && defined(__386__)
|
||||||
extern _inline Uint32 SDL_Swap32(Uint32);
|
extern __inline Uint32 SDL_Swap32(Uint32);
|
||||||
#pragma aux SDL_Swap32 = \
|
#pragma aux SDL_Swap32 = \
|
||||||
"bswap eax" \
|
"bswap eax" \
|
||||||
parm [eax] \
|
parm [eax] \
|
||||||
modify [eax];
|
modify [eax];
|
||||||
#elif defined(_MSC_VER)
|
|
||||||
#pragma intrinsic(_byteswap_ulong)
|
|
||||||
#define SDL_Swap32(x) _byteswap_ulong(x)
|
|
||||||
#else
|
#else
|
||||||
SDL_FORCE_INLINE Uint32
|
SDL_FORCE_INLINE Uint32
|
||||||
SDL_Swap32(Uint32 x)
|
SDL_Swap32(Uint32 x)
|
||||||
@@ -210,11 +208,12 @@ SDL_Swap32(Uint32 x)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if (defined(__clang__) && (__clang_major__ > 2 || (__clang_major__ == 2 && __clang_minor__ >= 6))) || \
|
#if HAS_BUILTIN_BSWAP64
|
||||||
(defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)))
|
|
||||||
#define SDL_Swap64(x) __builtin_bswap64(x)
|
#define SDL_Swap64(x) __builtin_bswap64(x)
|
||||||
#elif defined(__GNUC__) && defined(__i386__) && \
|
#elif defined(_MSC_VER) && (_MSC_VER >= 1400)
|
||||||
!(__GNUC__ == 2 && __GNUC_MINOR__ <= 95 /* broken gcc version */)
|
#pragma intrinsic(_byteswap_uint64)
|
||||||
|
#define SDL_Swap64(x) _byteswap_uint64(x)
|
||||||
|
#elif defined(__i386__) && !HAS_BROKEN_BSWAP
|
||||||
SDL_FORCE_INLINE Uint64
|
SDL_FORCE_INLINE Uint64
|
||||||
SDL_Swap64(Uint64 x)
|
SDL_Swap64(Uint64 x)
|
||||||
{
|
{
|
||||||
@@ -230,7 +229,7 @@ SDL_Swap64(Uint64 x)
|
|||||||
: "0" (v.s.a), "1"(v.s.b));
|
: "0" (v.s.a), "1"(v.s.b));
|
||||||
return v.u;
|
return v.u;
|
||||||
}
|
}
|
||||||
#elif defined(__GNUC__) && defined(__x86_64__)
|
#elif defined(__x86_64__)
|
||||||
SDL_FORCE_INLINE Uint64
|
SDL_FORCE_INLINE Uint64
|
||||||
SDL_Swap64(Uint64 x)
|
SDL_Swap64(Uint64 x)
|
||||||
{
|
{
|
||||||
@@ -238,16 +237,13 @@ SDL_Swap64(Uint64 x)
|
|||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
#elif defined(__WATCOMC__) && defined(__386__)
|
#elif defined(__WATCOMC__) && defined(__386__)
|
||||||
extern _inline Uint64 SDL_Swap64(Uint64);
|
extern __inline Uint64 SDL_Swap64(Uint64);
|
||||||
#pragma aux SDL_Swap64 = \
|
#pragma aux SDL_Swap64 = \
|
||||||
"bswap eax" \
|
"bswap eax" \
|
||||||
"bswap edx" \
|
"bswap edx" \
|
||||||
"xchg eax,edx" \
|
"xchg eax,edx" \
|
||||||
parm [eax edx] \
|
parm [eax edx] \
|
||||||
modify [eax edx];
|
modify [eax edx];
|
||||||
#elif defined(_MSC_VER)
|
|
||||||
#pragma intrinsic(_byteswap_uint64)
|
|
||||||
#define SDL_Swap64(x) _byteswap_uint64(x)
|
|
||||||
#else
|
#else
|
||||||
SDL_FORCE_INLINE Uint64
|
SDL_FORCE_INLINE Uint64
|
||||||
SDL_Swap64(Uint64 x)
|
SDL_Swap64(Uint64 x)
|
||||||
@@ -278,6 +274,11 @@ SDL_SwapFloat(float x)
|
|||||||
return swapper.f;
|
return swapper.f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* remove extra macros */
|
||||||
|
#undef HAS_BROKEN_BSWAP
|
||||||
|
#undef HAS_BUILTIN_BSWAP16
|
||||||
|
#undef HAS_BUILTIN_BSWAP32
|
||||||
|
#undef HAS_BUILTIN_BSWAP64
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \name Swap to native
|
* \name Swap to native
|
||||||
|
|||||||
+11
-3
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
Simple DirectMedia Layer
|
Simple DirectMedia Layer
|
||||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
||||||
|
|
||||||
This software is provided 'as-is', without any express or implied
|
This software is provided 'as-is', without any express or implied
|
||||||
warranty. In no event will the authors be held liable for any damages
|
warranty. In no event will the authors be held liable for any damages
|
||||||
@@ -58,6 +58,8 @@ extern "C" {
|
|||||||
* any
|
* any
|
||||||
* \returns always -1.
|
* \returns always -1.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_ClearError
|
* \sa SDL_ClearError
|
||||||
* \sa SDL_GetError
|
* \sa SDL_GetError
|
||||||
*/
|
*/
|
||||||
@@ -72,11 +74,11 @@ extern DECLSPEC int SDLCALL SDL_SetError(SDL_PRINTF_FORMAT_STRING const char *fm
|
|||||||
*
|
*
|
||||||
* The message is only applicable when an SDL function has signaled an error.
|
* The message is only applicable when an SDL function has signaled an error.
|
||||||
* You must check the return values of SDL function calls to determine when to
|
* You must check the return values of SDL function calls to determine when to
|
||||||
* appropriately call SDL_GetError(). You should _not_ use the results of
|
* appropriately call SDL_GetError(). You should *not* use the results of
|
||||||
* SDL_GetError() to decide if an error has occurred! Sometimes SDL will set
|
* SDL_GetError() to decide if an error has occurred! Sometimes SDL will set
|
||||||
* an error string even when reporting success.
|
* an error string even when reporting success.
|
||||||
*
|
*
|
||||||
* SDL will _not_ clear the error string for successful API calls. You _must_
|
* SDL will *not* clear the error string for successful API calls. You *must*
|
||||||
* check return values for failure cases before you can assume the error
|
* check return values for failure cases before you can assume the error
|
||||||
* string applies.
|
* string applies.
|
||||||
*
|
*
|
||||||
@@ -93,6 +95,8 @@ extern DECLSPEC int SDLCALL SDL_SetError(SDL_PRINTF_FORMAT_STRING const char *fm
|
|||||||
* return values of SDL function calls to determine when to
|
* return values of SDL function calls to determine when to
|
||||||
* appropriately call SDL_GetError().
|
* appropriately call SDL_GetError().
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_ClearError
|
* \sa SDL_ClearError
|
||||||
* \sa SDL_SetError
|
* \sa SDL_SetError
|
||||||
*/
|
*/
|
||||||
@@ -109,6 +113,8 @@ extern DECLSPEC const char *SDLCALL SDL_GetError(void);
|
|||||||
* \param maxlen The size of the buffer pointed to by the errstr parameter
|
* \param maxlen The size of the buffer pointed to by the errstr parameter
|
||||||
* \returns the pointer passed in as the `errstr` parameter.
|
* \returns the pointer passed in as the `errstr` parameter.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.14.
|
||||||
|
*
|
||||||
* \sa SDL_GetError
|
* \sa SDL_GetError
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC char * SDLCALL SDL_GetErrorMsg(char *errstr, int maxlen);
|
extern DECLSPEC char * SDLCALL SDL_GetErrorMsg(char *errstr, int maxlen);
|
||||||
@@ -116,6 +122,8 @@ extern DECLSPEC char * SDLCALL SDL_GetErrorMsg(char *errstr, int maxlen);
|
|||||||
/**
|
/**
|
||||||
* Clear any previous error message for this thread.
|
* Clear any previous error message for this thread.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_GetError
|
* \sa SDL_GetError
|
||||||
* \sa SDL_SetError
|
* \sa SDL_SetError
|
||||||
*/
|
*/
|
||||||
|
|||||||
+44
-7
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
Simple DirectMedia Layer
|
Simple DirectMedia Layer
|
||||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
||||||
|
|
||||||
This software is provided 'as-is', without any express or implied
|
This software is provided 'as-is', without any express or implied
|
||||||
warranty. In no event will the authors be held liable for any damages
|
warranty. In no event will the authors be held liable for any damages
|
||||||
@@ -160,6 +160,9 @@ typedef enum
|
|||||||
SDL_RENDER_TARGETS_RESET = 0x2000, /**< The render targets have been reset and their contents need to be updated */
|
SDL_RENDER_TARGETS_RESET = 0x2000, /**< The render targets have been reset and their contents need to be updated */
|
||||||
SDL_RENDER_DEVICE_RESET, /**< The device has been reset and all textures need to be recreated */
|
SDL_RENDER_DEVICE_RESET, /**< The device has been reset and all textures need to be recreated */
|
||||||
|
|
||||||
|
/* Internal events */
|
||||||
|
SDL_POLLSENTINEL = 0x7F00, /**< Signals the end of an event poll cycle */
|
||||||
|
|
||||||
/** Events ::SDL_USEREVENT through ::SDL_LASTEVENT are for your use,
|
/** Events ::SDL_USEREVENT through ::SDL_LASTEVENT are for your use,
|
||||||
* and should be allocated with SDL_RegisterEvents()
|
* and should be allocated with SDL_RegisterEvents()
|
||||||
*/
|
*/
|
||||||
@@ -298,6 +301,8 @@ typedef struct SDL_MouseWheelEvent
|
|||||||
Sint32 x; /**< The amount scrolled horizontally, positive to the right and negative to the left */
|
Sint32 x; /**< The amount scrolled horizontally, positive to the right and negative to the left */
|
||||||
Sint32 y; /**< The amount scrolled vertically, positive away from the user and negative toward the user */
|
Sint32 y; /**< The amount scrolled vertically, positive away from the user and negative toward the user */
|
||||||
Uint32 direction; /**< Set to one of the SDL_MOUSEWHEEL_* defines. When FLIPPED the values in X and Y will be opposite. Multiply by -1 to change them back */
|
Uint32 direction; /**< Set to one of the SDL_MOUSEWHEEL_* defines. When FLIPPED the values in X and Y will be opposite. Multiply by -1 to change them back */
|
||||||
|
float preciseX; /**< The amount scrolled horizontally, positive to the right and negative to the left, with float precision (added in 2.0.18) */
|
||||||
|
float preciseY; /**< The amount scrolled vertically, positive away from the user and negative toward the user, with float precision (added in 2.0.18) */
|
||||||
} SDL_MouseWheelEvent;
|
} SDL_MouseWheelEvent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -659,6 +664,8 @@ SDL_COMPILE_TIME_ASSERT(SDL_Event, sizeof(SDL_Event) == sizeof(((SDL_Event *)NUL
|
|||||||
* polling or waiting for events (e.g. you are filtering them), then you must
|
* polling or waiting for events (e.g. you are filtering them), then you must
|
||||||
* call SDL_PumpEvents() to force an event queue update.
|
* call SDL_PumpEvents() to force an event queue update.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_PollEvent
|
* \sa SDL_PollEvent
|
||||||
* \sa SDL_WaitEvent
|
* \sa SDL_WaitEvent
|
||||||
*/
|
*/
|
||||||
@@ -704,6 +711,8 @@ typedef enum
|
|||||||
* \returns the number of events actually stored or a negative error code on
|
* \returns the number of events actually stored or a negative error code on
|
||||||
* failure; call SDL_GetError() for more information.
|
* failure; call SDL_GetError() for more information.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_PollEvent
|
* \sa SDL_PollEvent
|
||||||
* \sa SDL_PumpEvents
|
* \sa SDL_PumpEvents
|
||||||
* \sa SDL_PushEvent
|
* \sa SDL_PushEvent
|
||||||
@@ -723,6 +732,8 @@ extern DECLSPEC int SDLCALL SDL_PeepEvents(SDL_Event * events, int numevents,
|
|||||||
* \returns SDL_TRUE if events matching `type` are present, or SDL_FALSE if
|
* \returns SDL_TRUE if events matching `type` are present, or SDL_FALSE if
|
||||||
* events matching `type` are not present.
|
* events matching `type` are not present.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_HasEvents
|
* \sa SDL_HasEvents
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC SDL_bool SDLCALL SDL_HasEvent(Uint32 type);
|
extern DECLSPEC SDL_bool SDLCALL SDL_HasEvent(Uint32 type);
|
||||||
@@ -740,6 +751,8 @@ extern DECLSPEC SDL_bool SDLCALL SDL_HasEvent(Uint32 type);
|
|||||||
* \returns SDL_TRUE if events with type >= `minType` and <= `maxType` are
|
* \returns SDL_TRUE if events with type >= `minType` and <= `maxType` are
|
||||||
* present, or SDL_FALSE if not.
|
* present, or SDL_FALSE if not.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_HasEvents
|
* \sa SDL_HasEvents
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC SDL_bool SDLCALL SDL_HasEvents(Uint32 minType, Uint32 maxType);
|
extern DECLSPEC SDL_bool SDLCALL SDL_HasEvents(Uint32 minType, Uint32 maxType);
|
||||||
@@ -760,6 +773,8 @@ extern DECLSPEC SDL_bool SDLCALL SDL_HasEvents(Uint32 minType, Uint32 maxType);
|
|||||||
*
|
*
|
||||||
* \param type the type of event to be cleared; see SDL_EventType for details
|
* \param type the type of event to be cleared; see SDL_EventType for details
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_FlushEvents
|
* \sa SDL_FlushEvents
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC void SDLCALL SDL_FlushEvent(Uint32 type);
|
extern DECLSPEC void SDLCALL SDL_FlushEvent(Uint32 type);
|
||||||
@@ -783,6 +798,8 @@ extern DECLSPEC void SDLCALL SDL_FlushEvent(Uint32 type);
|
|||||||
* \param maxType the high end of event type to be cleared, inclusive; see
|
* \param maxType the high end of event type to be cleared, inclusive; see
|
||||||
* SDL_EventType for details
|
* SDL_EventType for details
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_FlushEvent
|
* \sa SDL_FlushEvent
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC void SDLCALL SDL_FlushEvents(Uint32 minType, Uint32 maxType);
|
extern DECLSPEC void SDLCALL SDL_FlushEvents(Uint32 minType, Uint32 maxType);
|
||||||
@@ -798,8 +815,8 @@ extern DECLSPEC void SDLCALL SDL_FlushEvents(Uint32 minType, Uint32 maxType);
|
|||||||
* If `event` is NULL, it simply returns 1 if there is an event in the queue,
|
* If `event` is NULL, it simply returns 1 if there is an event in the queue,
|
||||||
* but will not remove it from the queue.
|
* but will not remove it from the queue.
|
||||||
*
|
*
|
||||||
* As this function implicitly calls SDL_PumpEvents(), you can only call this
|
* As this function may implicitly call SDL_PumpEvents(), you can only call
|
||||||
* function in the thread that set the video mode.
|
* this function in the thread that set the video mode.
|
||||||
*
|
*
|
||||||
* SDL_PollEvent() is the favored way of receiving system events since it can
|
* SDL_PollEvent() is the favored way of receiving system events since it can
|
||||||
* be done from the main loop and does not suspend the main loop while waiting
|
* be done from the main loop and does not suspend the main loop while waiting
|
||||||
@@ -823,6 +840,8 @@ extern DECLSPEC void SDLCALL SDL_FlushEvents(Uint32 minType, Uint32 maxType);
|
|||||||
* the queue, or NULL
|
* the queue, or NULL
|
||||||
* \returns 1 if there is a pending event or 0 if there are none available.
|
* \returns 1 if there is a pending event or 0 if there are none available.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_GetEventFilter
|
* \sa SDL_GetEventFilter
|
||||||
* \sa SDL_PeepEvents
|
* \sa SDL_PeepEvents
|
||||||
* \sa SDL_PushEvent
|
* \sa SDL_PushEvent
|
||||||
@@ -838,14 +857,16 @@ extern DECLSPEC int SDLCALL SDL_PollEvent(SDL_Event * event);
|
|||||||
* If `event` is not NULL, the next event is removed from the queue and stored
|
* If `event` is not NULL, the next event is removed from the queue and stored
|
||||||
* in the SDL_Event structure pointed to by `event`.
|
* in the SDL_Event structure pointed to by `event`.
|
||||||
*
|
*
|
||||||
* As this function implicitly calls SDL_PumpEvents(), you can only call this
|
* As this function may implicitly call SDL_PumpEvents(), you can only call
|
||||||
* function in the thread that initialized the video subsystem.
|
* this function in the thread that initialized the video subsystem.
|
||||||
*
|
*
|
||||||
* \param event the SDL_Event structure to be filled in with the next event
|
* \param event the SDL_Event structure to be filled in with the next event
|
||||||
* from the queue, or NULL
|
* from the queue, or NULL
|
||||||
* \returns 1 on success or 0 if there was an error while waiting for events;
|
* \returns 1 on success or 0 if there was an error while waiting for events;
|
||||||
* call SDL_GetError() for more information.
|
* call SDL_GetError() for more information.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_PollEvent
|
* \sa SDL_PollEvent
|
||||||
* \sa SDL_PumpEvents
|
* \sa SDL_PumpEvents
|
||||||
* \sa SDL_WaitEventTimeout
|
* \sa SDL_WaitEventTimeout
|
||||||
@@ -859,8 +880,8 @@ extern DECLSPEC int SDLCALL SDL_WaitEvent(SDL_Event * event);
|
|||||||
* If `event` is not NULL, the next event is removed from the queue and stored
|
* If `event` is not NULL, the next event is removed from the queue and stored
|
||||||
* in the SDL_Event structure pointed to by `event`.
|
* in the SDL_Event structure pointed to by `event`.
|
||||||
*
|
*
|
||||||
* As this function implicitly calls SDL_PumpEvents(), you can only call this
|
* As this function may implicitly call SDL_PumpEvents(), you can only call
|
||||||
* function in the thread that initialized the video subsystem.
|
* this function in the thread that initialized the video subsystem.
|
||||||
*
|
*
|
||||||
* \param event the SDL_Event structure to be filled in with the next event
|
* \param event the SDL_Event structure to be filled in with the next event
|
||||||
* from the queue, or NULL
|
* from the queue, or NULL
|
||||||
@@ -870,6 +891,8 @@ extern DECLSPEC int SDLCALL SDL_WaitEvent(SDL_Event * event);
|
|||||||
* call SDL_GetError() for more information. This also returns 0 if
|
* call SDL_GetError() for more information. This also returns 0 if
|
||||||
* the timeout elapsed without an event arriving.
|
* the timeout elapsed without an event arriving.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_PollEvent
|
* \sa SDL_PollEvent
|
||||||
* \sa SDL_PumpEvents
|
* \sa SDL_PumpEvents
|
||||||
* \sa SDL_WaitEvent
|
* \sa SDL_WaitEvent
|
||||||
@@ -903,6 +926,8 @@ extern DECLSPEC int SDLCALL SDL_WaitEventTimeout(SDL_Event * event,
|
|||||||
* code on failure; call SDL_GetError() for more information. A
|
* code on failure; call SDL_GetError() for more information. A
|
||||||
* common reason for error is the event queue being full.
|
* common reason for error is the event queue being full.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_PeepEvents
|
* \sa SDL_PeepEvents
|
||||||
* \sa SDL_PollEvent
|
* \sa SDL_PollEvent
|
||||||
* \sa SDL_RegisterEvents
|
* \sa SDL_RegisterEvents
|
||||||
@@ -957,6 +982,8 @@ typedef int (SDLCALL * SDL_EventFilter) (void *userdata, SDL_Event * event);
|
|||||||
* \param filter An SDL_EventFilter function to call when an event happens
|
* \param filter An SDL_EventFilter function to call when an event happens
|
||||||
* \param userdata a pointer that is passed to `filter`
|
* \param userdata a pointer that is passed to `filter`
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_AddEventWatch
|
* \sa SDL_AddEventWatch
|
||||||
* \sa SDL_EventState
|
* \sa SDL_EventState
|
||||||
* \sa SDL_GetEventFilter
|
* \sa SDL_GetEventFilter
|
||||||
@@ -977,6 +1004,8 @@ extern DECLSPEC void SDLCALL SDL_SetEventFilter(SDL_EventFilter filter,
|
|||||||
* be stored here
|
* be stored here
|
||||||
* \returns SDL_TRUE on success or SDL_FALSE if there is no event filter set.
|
* \returns SDL_TRUE on success or SDL_FALSE if there is no event filter set.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_SetEventFilter
|
* \sa SDL_SetEventFilter
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC SDL_bool SDLCALL SDL_GetEventFilter(SDL_EventFilter * filter,
|
extern DECLSPEC SDL_bool SDLCALL SDL_GetEventFilter(SDL_EventFilter * filter,
|
||||||
@@ -1003,6 +1032,8 @@ extern DECLSPEC SDL_bool SDLCALL SDL_GetEventFilter(SDL_EventFilter * filter,
|
|||||||
* \param filter an SDL_EventFilter function to call when an event happens.
|
* \param filter an SDL_EventFilter function to call when an event happens.
|
||||||
* \param userdata a pointer that is passed to `filter`
|
* \param userdata a pointer that is passed to `filter`
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_DelEventWatch
|
* \sa SDL_DelEventWatch
|
||||||
* \sa SDL_SetEventFilter
|
* \sa SDL_SetEventFilter
|
||||||
*/
|
*/
|
||||||
@@ -1018,6 +1049,8 @@ extern DECLSPEC void SDLCALL SDL_AddEventWatch(SDL_EventFilter filter,
|
|||||||
* \param filter the function originally passed to SDL_AddEventWatch()
|
* \param filter the function originally passed to SDL_AddEventWatch()
|
||||||
* \param userdata the pointer originally passed to SDL_AddEventWatch()
|
* \param userdata the pointer originally passed to SDL_AddEventWatch()
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_AddEventWatch
|
* \sa SDL_AddEventWatch
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC void SDLCALL SDL_DelEventWatch(SDL_EventFilter filter,
|
extern DECLSPEC void SDLCALL SDL_DelEventWatch(SDL_EventFilter filter,
|
||||||
@@ -1034,6 +1067,8 @@ extern DECLSPEC void SDLCALL SDL_DelEventWatch(SDL_EventFilter filter,
|
|||||||
* \param filter the SDL_EventFilter function to call when an event happens
|
* \param filter the SDL_EventFilter function to call when an event happens
|
||||||
* \param userdata a pointer that is passed to `filter`
|
* \param userdata a pointer that is passed to `filter`
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_GetEventFilter
|
* \sa SDL_GetEventFilter
|
||||||
* \sa SDL_SetEventFilter
|
* \sa SDL_SetEventFilter
|
||||||
*/
|
*/
|
||||||
@@ -1061,6 +1096,8 @@ extern DECLSPEC void SDLCALL SDL_FilterEvents(SDL_EventFilter filter,
|
|||||||
* \returns `SDL_DISABLE` or `SDL_ENABLE`, representing the processing state
|
* \returns `SDL_DISABLE` or `SDL_ENABLE`, representing the processing state
|
||||||
* of the event before this function makes any changes to it.
|
* of the event before this function makes any changes to it.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_GetEventState
|
* \sa SDL_GetEventState
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC Uint8 SDLCALL SDL_EventState(Uint32 type, int state);
|
extern DECLSPEC Uint8 SDLCALL SDL_EventState(Uint32 type, int state);
|
||||||
|
|||||||
+2
-2
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
Simple DirectMedia Layer
|
Simple DirectMedia Layer
|
||||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
||||||
|
|
||||||
This software is provided 'as-is', without any express or implied
|
This software is provided 'as-is', without any express or implied
|
||||||
warranty. In no event will the authors be held liable for any damages
|
warranty. In no event will the authors be held liable for any damages
|
||||||
@@ -55,7 +55,7 @@ extern "C" {
|
|||||||
*
|
*
|
||||||
* - `resource`: bundle resource directory (the default). For example:
|
* - `resource`: bundle resource directory (the default). For example:
|
||||||
* `/Applications/SDLApp/MyApp.app/Contents/Resources`
|
* `/Applications/SDLApp/MyApp.app/Contents/Resources`
|
||||||
* - `bundle`: the Bundle directory. Fpr example:
|
* - `bundle`: the Bundle directory. For example:
|
||||||
* `/Applications/SDLApp/MyApp.app/`
|
* `/Applications/SDLApp/MyApp.app/`
|
||||||
* - `parent`: the containing directory of the bundle. For example:
|
* - `parent`: the containing directory of the bundle. For example:
|
||||||
* `/Applications/SDLApp/`
|
* `/Applications/SDLApp/`
|
||||||
|
|||||||
+132
-1
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
Simple DirectMedia Layer
|
Simple DirectMedia Layer
|
||||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
||||||
|
|
||||||
This software is provided 'as-is', without any express or implied
|
This software is provided 'as-is', without any express or implied
|
||||||
warranty. In no event will the authors be held liable for any damages
|
warranty. In no event will the authors be held liable for any damages
|
||||||
@@ -189,6 +189,8 @@ extern DECLSPEC int SDLCALL SDL_GameControllerAddMappingsFromRW(SDL_RWops * rw,
|
|||||||
* \returns 1 if a new mapping is added, 0 if an existing mapping is updated,
|
* \returns 1 if a new mapping is added, 0 if an existing mapping is updated,
|
||||||
* -1 on error; call SDL_GetError() for more information.
|
* -1 on error; call SDL_GetError() for more information.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_GameControllerMapping
|
* \sa SDL_GameControllerMapping
|
||||||
* \sa SDL_GameControllerMappingForGUID
|
* \sa SDL_GameControllerMappingForGUID
|
||||||
*/
|
*/
|
||||||
@@ -198,6 +200,8 @@ extern DECLSPEC int SDLCALL SDL_GameControllerAddMapping(const char* mappingStri
|
|||||||
* Get the number of mappings installed.
|
* Get the number of mappings installed.
|
||||||
*
|
*
|
||||||
* \returns the number of mappings.
|
* \returns the number of mappings.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.6.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC int SDLCALL SDL_GameControllerNumMappings(void);
|
extern DECLSPEC int SDLCALL SDL_GameControllerNumMappings(void);
|
||||||
|
|
||||||
@@ -206,6 +210,8 @@ extern DECLSPEC int SDLCALL SDL_GameControllerNumMappings(void);
|
|||||||
*
|
*
|
||||||
* \returns the mapping string. Must be freed with SDL_free(). Returns NULL if
|
* \returns the mapping string. Must be freed with SDL_free(). Returns NULL if
|
||||||
* the index is out of range.
|
* the index is out of range.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.6.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC char * SDLCALL SDL_GameControllerMappingForIndex(int mapping_index);
|
extern DECLSPEC char * SDLCALL SDL_GameControllerMappingForIndex(int mapping_index);
|
||||||
|
|
||||||
@@ -218,6 +224,8 @@ extern DECLSPEC char * SDLCALL SDL_GameControllerMappingForIndex(int mapping_ind
|
|||||||
* \returns a mapping string or NULL on error; call SDL_GetError() for more
|
* \returns a mapping string or NULL on error; call SDL_GetError() for more
|
||||||
* information.
|
* information.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_JoystickGetDeviceGUID
|
* \sa SDL_JoystickGetDeviceGUID
|
||||||
* \sa SDL_JoystickGetGUID
|
* \sa SDL_JoystickGetGUID
|
||||||
*/
|
*/
|
||||||
@@ -289,6 +297,8 @@ extern DECLSPEC const char *SDLCALL SDL_GameControllerNameForIndex(int joystick_
|
|||||||
* \param joystick_index the device_index of a device, from zero to
|
* \param joystick_index the device_index of a device, from zero to
|
||||||
* SDL_NumJoysticks()-1
|
* SDL_NumJoysticks()-1
|
||||||
* \returns the controller type.
|
* \returns the controller type.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.12.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC SDL_GameControllerType SDLCALL SDL_GameControllerTypeForIndex(int joystick_index);
|
extern DECLSPEC SDL_GameControllerType SDLCALL SDL_GameControllerTypeForIndex(int joystick_index);
|
||||||
|
|
||||||
@@ -301,6 +311,8 @@ extern DECLSPEC SDL_GameControllerType SDLCALL SDL_GameControllerTypeForIndex(in
|
|||||||
* SDL_NumJoysticks()-1
|
* SDL_NumJoysticks()-1
|
||||||
* \returns the mapping string. Must be freed with SDL_free(). Returns NULL if
|
* \returns the mapping string. Must be freed with SDL_free(). Returns NULL if
|
||||||
* no mapping is available.
|
* no mapping is available.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.9.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC char *SDLCALL SDL_GameControllerMappingForDeviceIndex(int joystick_index);
|
extern DECLSPEC char *SDLCALL SDL_GameControllerMappingForDeviceIndex(int joystick_index);
|
||||||
|
|
||||||
@@ -349,6 +361,8 @@ extern DECLSPEC SDL_GameController *SDLCALL SDL_GameControllerFromInstanceID(SDL
|
|||||||
* instance id!
|
* instance id!
|
||||||
* \returns the SDL_GameController associated with a player index.
|
* \returns the SDL_GameController associated with a player index.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.12.
|
||||||
|
*
|
||||||
* \sa SDL_GameControllerGetPlayerIndex
|
* \sa SDL_GameControllerGetPlayerIndex
|
||||||
* \sa SDL_GameControllerSetPlayerIndex
|
* \sa SDL_GameControllerSetPlayerIndex
|
||||||
*/
|
*/
|
||||||
@@ -380,6 +394,8 @@ extern DECLSPEC const char *SDLCALL SDL_GameControllerName(SDL_GameController *g
|
|||||||
*
|
*
|
||||||
* \param gamecontroller the game controller object to query.
|
* \param gamecontroller the game controller object to query.
|
||||||
* \returns the controller type.
|
* \returns the controller type.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.12.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC SDL_GameControllerType SDLCALL SDL_GameControllerGetType(SDL_GameController *gamecontroller);
|
extern DECLSPEC SDL_GameControllerType SDLCALL SDL_GameControllerGetType(SDL_GameController *gamecontroller);
|
||||||
|
|
||||||
@@ -390,6 +406,8 @@ extern DECLSPEC SDL_GameControllerType SDLCALL SDL_GameControllerGetType(SDL_Gam
|
|||||||
*
|
*
|
||||||
* \param gamecontroller the game controller object to query.
|
* \param gamecontroller the game controller object to query.
|
||||||
* \returns the player index for controller, or -1 if it's not available.
|
* \returns the player index for controller, or -1 if it's not available.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.9.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC int SDLCALL SDL_GameControllerGetPlayerIndex(SDL_GameController *gamecontroller);
|
extern DECLSPEC int SDLCALL SDL_GameControllerGetPlayerIndex(SDL_GameController *gamecontroller);
|
||||||
|
|
||||||
@@ -398,6 +416,8 @@ extern DECLSPEC int SDLCALL SDL_GameControllerGetPlayerIndex(SDL_GameController
|
|||||||
*
|
*
|
||||||
* \param gamecontroller the game controller object to adjust.
|
* \param gamecontroller the game controller object to adjust.
|
||||||
* \param player_index Player index to assign to this controller.
|
* \param player_index Player index to assign to this controller.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.12.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC void SDLCALL SDL_GameControllerSetPlayerIndex(SDL_GameController *gamecontroller, int player_index);
|
extern DECLSPEC void SDLCALL SDL_GameControllerSetPlayerIndex(SDL_GameController *gamecontroller, int player_index);
|
||||||
|
|
||||||
@@ -408,6 +428,8 @@ extern DECLSPEC void SDLCALL SDL_GameControllerSetPlayerIndex(SDL_GameController
|
|||||||
*
|
*
|
||||||
* \param gamecontroller the game controller object to query.
|
* \param gamecontroller the game controller object to query.
|
||||||
* \return the USB vendor ID, or zero if unavailable.
|
* \return the USB vendor ID, or zero if unavailable.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.6.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC Uint16 SDLCALL SDL_GameControllerGetVendor(SDL_GameController *gamecontroller);
|
extern DECLSPEC Uint16 SDLCALL SDL_GameControllerGetVendor(SDL_GameController *gamecontroller);
|
||||||
|
|
||||||
@@ -418,6 +440,8 @@ extern DECLSPEC Uint16 SDLCALL SDL_GameControllerGetVendor(SDL_GameController *g
|
|||||||
*
|
*
|
||||||
* \param gamecontroller the game controller object to query.
|
* \param gamecontroller the game controller object to query.
|
||||||
* \return the USB product ID, or zero if unavailable.
|
* \return the USB product ID, or zero if unavailable.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.6.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC Uint16 SDLCALL SDL_GameControllerGetProduct(SDL_GameController *gamecontroller);
|
extern DECLSPEC Uint16 SDLCALL SDL_GameControllerGetProduct(SDL_GameController *gamecontroller);
|
||||||
|
|
||||||
@@ -428,6 +452,8 @@ extern DECLSPEC Uint16 SDLCALL SDL_GameControllerGetProduct(SDL_GameController *
|
|||||||
*
|
*
|
||||||
* \param gamecontroller the game controller object to query.
|
* \param gamecontroller the game controller object to query.
|
||||||
* \return the USB product version, or zero if unavailable.
|
* \return the USB product version, or zero if unavailable.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.6.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC Uint16 SDLCALL SDL_GameControllerGetProductVersion(SDL_GameController *gamecontroller);
|
extern DECLSPEC Uint16 SDLCALL SDL_GameControllerGetProductVersion(SDL_GameController *gamecontroller);
|
||||||
|
|
||||||
@@ -439,6 +465,8 @@ extern DECLSPEC Uint16 SDLCALL SDL_GameControllerGetProductVersion(SDL_GameContr
|
|||||||
*
|
*
|
||||||
* \param gamecontroller the game controller object to query.
|
* \param gamecontroller the game controller object to query.
|
||||||
* \return the serial number, or NULL if unavailable.
|
* \return the serial number, or NULL if unavailable.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.14.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC const char * SDLCALL SDL_GameControllerGetSerial(SDL_GameController *gamecontroller);
|
extern DECLSPEC const char * SDLCALL SDL_GameControllerGetSerial(SDL_GameController *gamecontroller);
|
||||||
|
|
||||||
@@ -450,6 +478,8 @@ extern DECLSPEC const char * SDLCALL SDL_GameControllerGetSerial(SDL_GameControl
|
|||||||
* \returns SDL_TRUE if the controller has been opened and is currently
|
* \returns SDL_TRUE if the controller has been opened and is currently
|
||||||
* connected, or SDL_FALSE if not.
|
* connected, or SDL_FALSE if not.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_GameControllerClose
|
* \sa SDL_GameControllerClose
|
||||||
* \sa SDL_GameControllerOpen
|
* \sa SDL_GameControllerOpen
|
||||||
*/
|
*/
|
||||||
@@ -471,6 +501,8 @@ extern DECLSPEC SDL_bool SDLCALL SDL_GameControllerGetAttached(SDL_GameControlle
|
|||||||
* \param gamecontroller the game controller object that you want to get a
|
* \param gamecontroller the game controller object that you want to get a
|
||||||
* joystick from
|
* joystick from
|
||||||
* \returns a SDL_Joystick object; call SDL_GetError() for more information.
|
* \returns a SDL_Joystick object; call SDL_GetError() for more information.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC SDL_Joystick *SDLCALL SDL_GameControllerGetJoystick(SDL_GameController *gamecontroller);
|
extern DECLSPEC SDL_Joystick *SDLCALL SDL_GameControllerGetJoystick(SDL_GameController *gamecontroller);
|
||||||
|
|
||||||
@@ -500,6 +532,8 @@ extern DECLSPEC int SDLCALL SDL_GameControllerEventState(int state);
|
|||||||
* This function is called automatically by the event loop if events are
|
* This function is called automatically by the event loop if events are
|
||||||
* enabled. Under such circumstances, it will not be necessary to call this
|
* enabled. Under such circumstances, it will not be necessary to call this
|
||||||
* function.
|
* function.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC void SDLCALL SDL_GameControllerUpdate(void);
|
extern DECLSPEC void SDLCALL SDL_GameControllerUpdate(void);
|
||||||
|
|
||||||
@@ -541,6 +575,8 @@ typedef enum
|
|||||||
* \returns the SDL_GameControllerAxis enum corresponding to the input string,
|
* \returns the SDL_GameControllerAxis enum corresponding to the input string,
|
||||||
* or `SDL_CONTROLLER_AXIS_INVALID` if no match was found.
|
* or `SDL_CONTROLLER_AXIS_INVALID` if no match was found.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_GameControllerGetStringForAxis
|
* \sa SDL_GameControllerGetStringForAxis
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC SDL_GameControllerAxis SDLCALL SDL_GameControllerGetAxisFromString(const char *str);
|
extern DECLSPEC SDL_GameControllerAxis SDLCALL SDL_GameControllerGetAxisFromString(const char *str);
|
||||||
@@ -555,6 +591,8 @@ extern DECLSPEC SDL_GameControllerAxis SDLCALL SDL_GameControllerGetAxisFromStri
|
|||||||
* specified. The string returned is of the format used by
|
* specified. The string returned is of the format used by
|
||||||
* SDL_GameController mapping strings.
|
* SDL_GameController mapping strings.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_GameControllerGetAxisFromString
|
* \sa SDL_GameControllerGetAxisFromString
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC const char* SDLCALL SDL_GameControllerGetStringForAxis(SDL_GameControllerAxis axis);
|
extern DECLSPEC const char* SDLCALL SDL_GameControllerGetStringForAxis(SDL_GameControllerAxis axis);
|
||||||
@@ -585,6 +623,8 @@ SDL_GameControllerGetBindForAxis(SDL_GameController *gamecontroller,
|
|||||||
* \param gamecontroller a game controller
|
* \param gamecontroller a game controller
|
||||||
* \param axis an axis enum value (an SDL_GameControllerAxis value)
|
* \param axis an axis enum value (an SDL_GameControllerAxis value)
|
||||||
* \returns SDL_TRUE if the controller has this axis, SDL_FALSE otherwise.
|
* \returns SDL_TRUE if the controller has this axis, SDL_FALSE otherwise.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.14.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC SDL_bool SDLCALL
|
extern DECLSPEC SDL_bool SDLCALL
|
||||||
SDL_GameControllerHasAxis(SDL_GameController *gamecontroller, SDL_GameControllerAxis axis);
|
SDL_GameControllerHasAxis(SDL_GameController *gamecontroller, SDL_GameControllerAxis axis);
|
||||||
@@ -650,6 +690,8 @@ typedef enum
|
|||||||
* \param str string representing a SDL_GameController axis
|
* \param str string representing a SDL_GameController axis
|
||||||
* \returns the SDL_GameControllerButton enum corresponding to the input
|
* \returns the SDL_GameControllerButton enum corresponding to the input
|
||||||
* string, or `SDL_CONTROLLER_AXIS_INVALID` if no match was found.
|
* string, or `SDL_CONTROLLER_AXIS_INVALID` if no match was found.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC SDL_GameControllerButton SDLCALL SDL_GameControllerGetButtonFromString(const char *str);
|
extern DECLSPEC SDL_GameControllerButton SDLCALL SDL_GameControllerGetButtonFromString(const char *str);
|
||||||
|
|
||||||
@@ -695,6 +737,8 @@ SDL_GameControllerGetBindForButton(SDL_GameController *gamecontroller,
|
|||||||
* \param gamecontroller a game controller
|
* \param gamecontroller a game controller
|
||||||
* \param button a button enum value (an SDL_GameControllerButton value)
|
* \param button a button enum value (an SDL_GameControllerButton value)
|
||||||
* \returns SDL_TRUE if the controller has this button, SDL_FALSE otherwise.
|
* \returns SDL_TRUE if the controller has this button, SDL_FALSE otherwise.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.14.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC SDL_bool SDLCALL SDL_GameControllerHasButton(SDL_GameController *gamecontroller,
|
extern DECLSPEC SDL_bool SDLCALL SDL_GameControllerHasButton(SDL_GameController *gamecontroller,
|
||||||
SDL_GameControllerButton button);
|
SDL_GameControllerButton button);
|
||||||
@@ -716,17 +760,23 @@ extern DECLSPEC Uint8 SDLCALL SDL_GameControllerGetButton(SDL_GameController *ga
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the number of touchpads on a game controller.
|
* Get the number of touchpads on a game controller.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.14.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC int SDLCALL SDL_GameControllerGetNumTouchpads(SDL_GameController *gamecontroller);
|
extern DECLSPEC int SDLCALL SDL_GameControllerGetNumTouchpads(SDL_GameController *gamecontroller);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the number of supported simultaneous fingers on a touchpad on a game
|
* Get the number of supported simultaneous fingers on a touchpad on a game
|
||||||
* controller.
|
* controller.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.14.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC int SDLCALL SDL_GameControllerGetNumTouchpadFingers(SDL_GameController *gamecontroller, int touchpad);
|
extern DECLSPEC int SDLCALL SDL_GameControllerGetNumTouchpadFingers(SDL_GameController *gamecontroller, int touchpad);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the current state of a finger on a touchpad on a game controller.
|
* Get the current state of a finger on a touchpad on a game controller.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.14.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC int SDLCALL SDL_GameControllerGetTouchpadFinger(SDL_GameController *gamecontroller, int touchpad, int finger, Uint8 *state, float *x, float *y, float *pressure);
|
extern DECLSPEC int SDLCALL SDL_GameControllerGetTouchpadFinger(SDL_GameController *gamecontroller, int touchpad, int finger, Uint8 *state, float *x, float *y, float *pressure);
|
||||||
|
|
||||||
@@ -736,6 +786,8 @@ extern DECLSPEC int SDLCALL SDL_GameControllerGetTouchpadFinger(SDL_GameControll
|
|||||||
* \param gamecontroller The controller to query
|
* \param gamecontroller The controller to query
|
||||||
* \param type The type of sensor to query
|
* \param type The type of sensor to query
|
||||||
* \returns SDL_TRUE if the sensor exists, SDL_FALSE otherwise.
|
* \returns SDL_TRUE if the sensor exists, SDL_FALSE otherwise.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.14.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC SDL_bool SDLCALL SDL_GameControllerHasSensor(SDL_GameController *gamecontroller, SDL_SensorType type);
|
extern DECLSPEC SDL_bool SDLCALL SDL_GameControllerHasSensor(SDL_GameController *gamecontroller, SDL_SensorType type);
|
||||||
|
|
||||||
@@ -746,6 +798,8 @@ extern DECLSPEC SDL_bool SDLCALL SDL_GameControllerHasSensor(SDL_GameController
|
|||||||
* \param type The type of sensor to enable/disable
|
* \param type The type of sensor to enable/disable
|
||||||
* \param enabled Whether data reporting should be enabled
|
* \param enabled Whether data reporting should be enabled
|
||||||
* \returns 0 or -1 if an error occurred.
|
* \returns 0 or -1 if an error occurred.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.14.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC int SDLCALL SDL_GameControllerSetSensorEnabled(SDL_GameController *gamecontroller, SDL_SensorType type, SDL_bool enabled);
|
extern DECLSPEC int SDLCALL SDL_GameControllerSetSensorEnabled(SDL_GameController *gamecontroller, SDL_SensorType type, SDL_bool enabled);
|
||||||
|
|
||||||
@@ -755,6 +809,8 @@ extern DECLSPEC int SDLCALL SDL_GameControllerSetSensorEnabled(SDL_GameControlle
|
|||||||
* \param gamecontroller The controller to query
|
* \param gamecontroller The controller to query
|
||||||
* \param type The type of sensor to query
|
* \param type The type of sensor to query
|
||||||
* \returns SDL_TRUE if the sensor is enabled, SDL_FALSE otherwise.
|
* \returns SDL_TRUE if the sensor is enabled, SDL_FALSE otherwise.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.14.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC SDL_bool SDLCALL SDL_GameControllerIsSensorEnabled(SDL_GameController *gamecontroller, SDL_SensorType type);
|
extern DECLSPEC SDL_bool SDLCALL SDL_GameControllerIsSensorEnabled(SDL_GameController *gamecontroller, SDL_SensorType type);
|
||||||
|
|
||||||
@@ -765,6 +821,8 @@ extern DECLSPEC SDL_bool SDLCALL SDL_GameControllerIsSensorEnabled(SDL_GameContr
|
|||||||
* \param gamecontroller The controller to query
|
* \param gamecontroller The controller to query
|
||||||
* \param type The type of sensor to query
|
* \param type The type of sensor to query
|
||||||
* \return the data rate, or 0.0f if the data rate is not available.
|
* \return the data rate, or 0.0f if the data rate is not available.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.16.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC float SDLCALL SDL_GameControllerGetSensorDataRate(SDL_GameController *gamecontroller, SDL_SensorType type);
|
extern DECLSPEC float SDLCALL SDL_GameControllerGetSensorDataRate(SDL_GameController *gamecontroller, SDL_SensorType type);
|
||||||
|
|
||||||
@@ -779,6 +837,8 @@ extern DECLSPEC float SDLCALL SDL_GameControllerGetSensorDataRate(SDL_GameContro
|
|||||||
* \param data A pointer filled with the current sensor state
|
* \param data A pointer filled with the current sensor state
|
||||||
* \param num_values The number of values to write to data
|
* \param num_values The number of values to write to data
|
||||||
* \return 0 or -1 if an error occurred.
|
* \return 0 or -1 if an error occurred.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.14.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC int SDLCALL SDL_GameControllerGetSensorData(SDL_GameController *gamecontroller, SDL_SensorType type, float *data, int num_values);
|
extern DECLSPEC int SDLCALL SDL_GameControllerGetSensorData(SDL_GameController *gamecontroller, SDL_SensorType type, float *data, int num_values);
|
||||||
|
|
||||||
@@ -795,6 +855,10 @@ extern DECLSPEC int SDLCALL SDL_GameControllerGetSensorData(SDL_GameController *
|
|||||||
* rumble motor, from 0 to 0xFFFF
|
* rumble motor, from 0 to 0xFFFF
|
||||||
* \param duration_ms The duration of the rumble effect, in milliseconds
|
* \param duration_ms The duration of the rumble effect, in milliseconds
|
||||||
* \returns 0, or -1 if rumble isn't supported on this controller
|
* \returns 0, or -1 if rumble isn't supported on this controller
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.9.
|
||||||
|
*
|
||||||
|
* \sa SDL_GameControllerHasRumble
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC int SDLCALL SDL_GameControllerRumble(SDL_GameController *gamecontroller, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble, Uint32 duration_ms);
|
extern DECLSPEC int SDLCALL SDL_GameControllerRumble(SDL_GameController *gamecontroller, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble, Uint32 duration_ms);
|
||||||
|
|
||||||
@@ -815,6 +879,10 @@ extern DECLSPEC int SDLCALL SDL_GameControllerRumble(SDL_GameController *gamecon
|
|||||||
* to 0xFFFF
|
* to 0xFFFF
|
||||||
* \param duration_ms The duration of the rumble effect, in milliseconds
|
* \param duration_ms The duration of the rumble effect, in milliseconds
|
||||||
* \returns 0, or -1 if trigger rumble isn't supported on this controller
|
* \returns 0, or -1 if trigger rumble isn't supported on this controller
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.14.
|
||||||
|
*
|
||||||
|
* \sa SDL_GameControllerHasRumbleTriggers
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC int SDLCALL SDL_GameControllerRumbleTriggers(SDL_GameController *gamecontroller, Uint16 left_rumble, Uint16 right_rumble, Uint32 duration_ms);
|
extern DECLSPEC int SDLCALL SDL_GameControllerRumbleTriggers(SDL_GameController *gamecontroller, Uint16 left_rumble, Uint16 right_rumble, Uint32 duration_ms);
|
||||||
|
|
||||||
@@ -824,9 +892,37 @@ extern DECLSPEC int SDLCALL SDL_GameControllerRumbleTriggers(SDL_GameController
|
|||||||
* \param gamecontroller The controller to query
|
* \param gamecontroller The controller to query
|
||||||
* \returns SDL_TRUE, or SDL_FALSE if this controller does not have a
|
* \returns SDL_TRUE, or SDL_FALSE if this controller does not have a
|
||||||
* modifiable LED
|
* modifiable LED
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.14.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC SDL_bool SDLCALL SDL_GameControllerHasLED(SDL_GameController *gamecontroller);
|
extern DECLSPEC SDL_bool SDLCALL SDL_GameControllerHasLED(SDL_GameController *gamecontroller);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Query whether a game controller has rumble support.
|
||||||
|
*
|
||||||
|
* \param gamecontroller The controller to query
|
||||||
|
* \returns SDL_TRUE, or SDL_FALSE if this controller does not have rumble
|
||||||
|
* support
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.18.
|
||||||
|
*
|
||||||
|
* \sa SDL_GameControllerRumble
|
||||||
|
*/
|
||||||
|
extern DECLSPEC SDL_bool SDLCALL SDL_GameControllerHasRumble(SDL_GameController *gamecontroller);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Query whether a game controller has rumble support on triggers.
|
||||||
|
*
|
||||||
|
* \param gamecontroller The controller to query
|
||||||
|
* \returns SDL_TRUE, or SDL_FALSE if this controller does not have trigger
|
||||||
|
* rumble support
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.18.
|
||||||
|
*
|
||||||
|
* \sa SDL_GameControllerRumbleTriggers
|
||||||
|
*/
|
||||||
|
extern DECLSPEC SDL_bool SDLCALL SDL_GameControllerHasRumbleTriggers(SDL_GameController *gamecontroller);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update a game controller's LED color.
|
* Update a game controller's LED color.
|
||||||
*
|
*
|
||||||
@@ -835,6 +931,8 @@ extern DECLSPEC SDL_bool SDLCALL SDL_GameControllerHasLED(SDL_GameController *ga
|
|||||||
* \param green The intensity of the green LED
|
* \param green The intensity of the green LED
|
||||||
* \param blue The intensity of the blue LED
|
* \param blue The intensity of the blue LED
|
||||||
* \returns 0, or -1 if this controller does not have a modifiable LED
|
* \returns 0, or -1 if this controller does not have a modifiable LED
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.14.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC int SDLCALL SDL_GameControllerSetLED(SDL_GameController *gamecontroller, Uint8 red, Uint8 green, Uint8 blue);
|
extern DECLSPEC int SDLCALL SDL_GameControllerSetLED(SDL_GameController *gamecontroller, Uint8 red, Uint8 green, Uint8 blue);
|
||||||
|
|
||||||
@@ -846,6 +944,8 @@ extern DECLSPEC int SDLCALL SDL_GameControllerSetLED(SDL_GameController *gamecon
|
|||||||
* \param size The size of the data to send to the controller
|
* \param size The size of the data to send to the controller
|
||||||
* \returns 0, or -1 if this controller or driver doesn't support effect
|
* \returns 0, or -1 if this controller or driver doesn't support effect
|
||||||
* packets
|
* packets
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.16.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC int SDLCALL SDL_GameControllerSendEffect(SDL_GameController *gamecontroller, const void *data, int size);
|
extern DECLSPEC int SDLCALL SDL_GameControllerSendEffect(SDL_GameController *gamecontroller, const void *data, int size);
|
||||||
|
|
||||||
@@ -855,10 +955,41 @@ extern DECLSPEC int SDLCALL SDL_GameControllerSendEffect(SDL_GameController *gam
|
|||||||
* \param gamecontroller a game controller identifier previously returned by
|
* \param gamecontroller a game controller identifier previously returned by
|
||||||
* SDL_GameControllerOpen()
|
* SDL_GameControllerOpen()
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_GameControllerOpen
|
* \sa SDL_GameControllerOpen
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC void SDLCALL SDL_GameControllerClose(SDL_GameController *gamecontroller);
|
extern DECLSPEC void SDLCALL SDL_GameControllerClose(SDL_GameController *gamecontroller);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the sfSymbolsName for a given button on a game controller on Apple
|
||||||
|
* platforms.
|
||||||
|
*
|
||||||
|
* \param gamecontroller the controller to query
|
||||||
|
* \param button a button on the game controller
|
||||||
|
* \returns the sfSymbolsName or NULL if the name can't be found
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.18.
|
||||||
|
*
|
||||||
|
* \sa SDL_GameControllerGetAppleSFSymbolsNameForAxis
|
||||||
|
*/
|
||||||
|
extern DECLSPEC const char* SDLCALL SDL_GameControllerGetAppleSFSymbolsNameForButton(SDL_GameController *gamecontroller, SDL_GameControllerButton button);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the sfSymbolsName for a given axis on a game controller on Apple
|
||||||
|
* platforms.
|
||||||
|
*
|
||||||
|
* \param gamecontroller the controller to query
|
||||||
|
* \param axis an axis on the game controller
|
||||||
|
* \returns the sfSymbolsName or NULL if the name can't be found
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.18.
|
||||||
|
*
|
||||||
|
* \sa SDL_GameControllerGetAppleSFSymbolsNameForButton
|
||||||
|
*/
|
||||||
|
extern DECLSPEC const char* SDLCALL SDL_GameControllerGetAppleSFSymbolsNameForAxis(SDL_GameController *gamecontroller, SDL_GameControllerAxis axis);
|
||||||
|
|
||||||
|
|
||||||
/* Ends C function definitions when using C++ */
|
/* Ends C function definitions when using C++ */
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
Simple DirectMedia Layer
|
Simple DirectMedia Layer
|
||||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
||||||
|
|
||||||
This software is provided 'as-is', without any express or implied
|
This software is provided 'as-is', without any express or implied
|
||||||
warranty. In no event will the authors be held liable for any damages
|
warranty. In no event will the authors be held liable for any damages
|
||||||
|
|||||||
+23
-2
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
Simple DirectMedia Layer
|
Simple DirectMedia Layer
|
||||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
||||||
|
|
||||||
This software is provided 'as-is', without any express or implied
|
This software is provided 'as-is', without any express or implied
|
||||||
warranty. In no event will the authors be held liable for any damages
|
warranty. In no event will the authors be held liable for any damages
|
||||||
@@ -76,7 +76,7 @@
|
|||||||
* }
|
* }
|
||||||
*
|
*
|
||||||
* // Create the effect
|
* // Create the effect
|
||||||
* memset( &effect, 0, sizeof(SDL_HapticEffect) ); // 0 is safe default
|
* SDL_memset( &effect, 0, sizeof(SDL_HapticEffect) ); // 0 is safe default
|
||||||
* effect.type = SDL_HAPTIC_SINE;
|
* effect.type = SDL_HAPTIC_SINE;
|
||||||
* effect.periodic.direction.type = SDL_HAPTIC_POLAR; // Polar coordinates
|
* effect.periodic.direction.type = SDL_HAPTIC_POLAR; // Polar coordinates
|
||||||
* effect.periodic.direction.dir[0] = 18000; // Force comes from south
|
* effect.periodic.direction.dir[0] = 18000; // Force comes from south
|
||||||
@@ -820,6 +820,7 @@ typedef union SDL_HapticEffect
|
|||||||
|
|
||||||
|
|
||||||
/* Function prototypes */
|
/* Function prototypes */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Count the number of haptic devices attached to the system.
|
* Count the number of haptic devices attached to the system.
|
||||||
*
|
*
|
||||||
@@ -970,6 +971,8 @@ extern DECLSPEC SDL_Haptic *SDLCALL SDL_HapticOpenFromJoystick(SDL_Joystick *
|
|||||||
*
|
*
|
||||||
* \param haptic the SDL_Haptic device to close
|
* \param haptic the SDL_Haptic device to close
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_HapticOpen
|
* \sa SDL_HapticOpen
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC void SDLCALL SDL_HapticClose(SDL_Haptic * haptic);
|
extern DECLSPEC void SDLCALL SDL_HapticClose(SDL_Haptic * haptic);
|
||||||
@@ -1033,6 +1036,8 @@ extern DECLSPEC unsigned int SDLCALL SDL_HapticQuery(SDL_Haptic * haptic);
|
|||||||
* \param haptic the SDL_Haptic device to query
|
* \param haptic the SDL_Haptic device to query
|
||||||
* \returns the number of axes on success or a negative error code on failure;
|
* \returns the number of axes on success or a negative error code on failure;
|
||||||
* call SDL_GetError() for more information.
|
* call SDL_GetError() for more information.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC int SDLCALL SDL_HapticNumAxes(SDL_Haptic * haptic);
|
extern DECLSPEC int SDLCALL SDL_HapticNumAxes(SDL_Haptic * haptic);
|
||||||
|
|
||||||
@@ -1063,6 +1068,8 @@ extern DECLSPEC int SDLCALL SDL_HapticEffectSupported(SDL_Haptic * haptic,
|
|||||||
* \returns the ID of the effect on success or a negative error code on
|
* \returns the ID of the effect on success or a negative error code on
|
||||||
* failure; call SDL_GetError() for more information.
|
* failure; call SDL_GetError() for more information.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_HapticDestroyEffect
|
* \sa SDL_HapticDestroyEffect
|
||||||
* \sa SDL_HapticRunEffect
|
* \sa SDL_HapticRunEffect
|
||||||
* \sa SDL_HapticUpdateEffect
|
* \sa SDL_HapticUpdateEffect
|
||||||
@@ -1207,6 +1214,8 @@ extern DECLSPEC int SDLCALL SDL_HapticSetGain(SDL_Haptic * haptic, int gain);
|
|||||||
* \returns 0 on success or a negative error code on failure; call
|
* \returns 0 on success or a negative error code on failure; call
|
||||||
* SDL_GetError() for more information.
|
* SDL_GetError() for more information.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_HapticQuery
|
* \sa SDL_HapticQuery
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC int SDLCALL SDL_HapticSetAutocenter(SDL_Haptic * haptic,
|
extern DECLSPEC int SDLCALL SDL_HapticSetAutocenter(SDL_Haptic * haptic,
|
||||||
@@ -1225,6 +1234,8 @@ extern DECLSPEC int SDLCALL SDL_HapticSetAutocenter(SDL_Haptic * haptic,
|
|||||||
* \returns 0 on success or a negative error code on failure; call
|
* \returns 0 on success or a negative error code on failure; call
|
||||||
* SDL_GetError() for more information.
|
* SDL_GetError() for more information.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_HapticUnpause
|
* \sa SDL_HapticUnpause
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC int SDLCALL SDL_HapticPause(SDL_Haptic * haptic);
|
extern DECLSPEC int SDLCALL SDL_HapticPause(SDL_Haptic * haptic);
|
||||||
@@ -1238,6 +1249,8 @@ extern DECLSPEC int SDLCALL SDL_HapticPause(SDL_Haptic * haptic);
|
|||||||
* \returns 0 on success or a negative error code on failure; call
|
* \returns 0 on success or a negative error code on failure; call
|
||||||
* SDL_GetError() for more information.
|
* SDL_GetError() for more information.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_HapticPause
|
* \sa SDL_HapticPause
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC int SDLCALL SDL_HapticUnpause(SDL_Haptic * haptic);
|
extern DECLSPEC int SDLCALL SDL_HapticUnpause(SDL_Haptic * haptic);
|
||||||
@@ -1248,6 +1261,8 @@ extern DECLSPEC int SDLCALL SDL_HapticUnpause(SDL_Haptic * haptic);
|
|||||||
* \param haptic the SDL_Haptic device to stop
|
* \param haptic the SDL_Haptic device to stop
|
||||||
* \returns 0 on success or a negative error code on failure; call
|
* \returns 0 on success or a negative error code on failure; call
|
||||||
* SDL_GetError() for more information.
|
* SDL_GetError() for more information.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC int SDLCALL SDL_HapticStopAll(SDL_Haptic * haptic);
|
extern DECLSPEC int SDLCALL SDL_HapticStopAll(SDL_Haptic * haptic);
|
||||||
|
|
||||||
@@ -1259,6 +1274,8 @@ extern DECLSPEC int SDLCALL SDL_HapticStopAll(SDL_Haptic * haptic);
|
|||||||
* negative error code on failure; call SDL_GetError() for more
|
* negative error code on failure; call SDL_GetError() for more
|
||||||
* information.
|
* information.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_HapticRumbleInit
|
* \sa SDL_HapticRumbleInit
|
||||||
* \sa SDL_HapticRumblePlay
|
* \sa SDL_HapticRumblePlay
|
||||||
* \sa SDL_HapticRumbleStop
|
* \sa SDL_HapticRumbleStop
|
||||||
@@ -1290,6 +1307,8 @@ extern DECLSPEC int SDLCALL SDL_HapticRumbleInit(SDL_Haptic * haptic);
|
|||||||
* \returns 0 on success or a negative error code on failure; call
|
* \returns 0 on success or a negative error code on failure; call
|
||||||
* SDL_GetError() for more information.
|
* SDL_GetError() for more information.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_HapticRumbleInit
|
* \sa SDL_HapticRumbleInit
|
||||||
* \sa SDL_HapticRumbleStop
|
* \sa SDL_HapticRumbleStop
|
||||||
* \sa SDL_HapticRumbleSupported
|
* \sa SDL_HapticRumbleSupported
|
||||||
@@ -1303,6 +1322,8 @@ extern DECLSPEC int SDLCALL SDL_HapticRumblePlay(SDL_Haptic * haptic, float stre
|
|||||||
* \returns 0 on success or a negative error code on failure; call
|
* \returns 0 on success or a negative error code on failure; call
|
||||||
* SDL_GetError() for more information.
|
* SDL_GetError() for more information.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_HapticRumbleInit
|
* \sa SDL_HapticRumbleInit
|
||||||
* \sa SDL_HapticRumblePlay
|
* \sa SDL_HapticRumblePlay
|
||||||
* \sa SDL_HapticRumbleSupported
|
* \sa SDL_HapticRumbleSupported
|
||||||
|
|||||||
+451
@@ -0,0 +1,451 @@
|
|||||||
|
/*
|
||||||
|
Simple DirectMedia Layer
|
||||||
|
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
||||||
|
|
||||||
|
This software is provided 'as-is', without any express or implied
|
||||||
|
warranty. In no event will the authors be held liable for any damages
|
||||||
|
arising from the use of this software.
|
||||||
|
|
||||||
|
Permission is granted to anyone to use this software for any purpose,
|
||||||
|
including commercial applications, and to alter it and redistribute it
|
||||||
|
freely, subject to the following restrictions:
|
||||||
|
|
||||||
|
1. The origin of this software must not be misrepresented; you must not
|
||||||
|
claim that you wrote the original software. If you use this software
|
||||||
|
in a product, an acknowledgment in the product documentation would be
|
||||||
|
appreciated but is not required.
|
||||||
|
2. Altered source versions must be plainly marked as such, and must not be
|
||||||
|
misrepresented as being the original software.
|
||||||
|
3. This notice may not be removed or altered from any source distribution.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \file SDL_hidapi.h
|
||||||
|
*
|
||||||
|
* Header file for SDL HIDAPI functions.
|
||||||
|
*
|
||||||
|
* This is an adaptation of the original HIDAPI interface by Alan Ott,
|
||||||
|
* and includes source code licensed under the following BSD license:
|
||||||
|
*
|
||||||
|
Copyright (c) 2010, Alan Ott, Signal 11 Software
|
||||||
|
All rights reserved.
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
modification, are permitted provided that the following conditions are met:
|
||||||
|
|
||||||
|
* Redistributions of source code must retain the above copyright notice,
|
||||||
|
this list of conditions and the following disclaimer.
|
||||||
|
* Redistributions in binary form must reproduce the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer in the
|
||||||
|
documentation and/or other materials provided with the distribution.
|
||||||
|
* Neither the name of Signal 11 Software nor the names of its
|
||||||
|
contributors may be used to endorse or promote products derived from
|
||||||
|
this software without specific prior written permission.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||||
|
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* If you would like a version of SDL without this code, you can build SDL
|
||||||
|
* with SDL_HIDAPI_DISABLED defined to 1. You might want to do this for example
|
||||||
|
* on iOS or tvOS to avoid a dependency on the CoreBluetooth framework.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef SDL_hidapi_h_
|
||||||
|
#define SDL_hidapi_h_
|
||||||
|
|
||||||
|
#include "SDL_stdinc.h"
|
||||||
|
|
||||||
|
#include "begin_code.h"
|
||||||
|
/* Set up for C function definitions, even when using C++ */
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief A handle representing an open HID device
|
||||||
|
*/
|
||||||
|
struct SDL_hid_device_;
|
||||||
|
typedef struct SDL_hid_device_ SDL_hid_device; /**< opaque hidapi structure */
|
||||||
|
|
||||||
|
/** hidapi info structure */
|
||||||
|
/**
|
||||||
|
* \brief Information about a connected HID device
|
||||||
|
*/
|
||||||
|
typedef struct SDL_hid_device_info
|
||||||
|
{
|
||||||
|
/** Platform-specific device path */
|
||||||
|
char *path;
|
||||||
|
/** Device Vendor ID */
|
||||||
|
unsigned short vendor_id;
|
||||||
|
/** Device Product ID */
|
||||||
|
unsigned short product_id;
|
||||||
|
/** Serial Number */
|
||||||
|
wchar_t *serial_number;
|
||||||
|
/** Device Release Number in binary-coded decimal,
|
||||||
|
also known as Device Version Number */
|
||||||
|
unsigned short release_number;
|
||||||
|
/** Manufacturer String */
|
||||||
|
wchar_t *manufacturer_string;
|
||||||
|
/** Product string */
|
||||||
|
wchar_t *product_string;
|
||||||
|
/** Usage Page for this Device/Interface
|
||||||
|
(Windows/Mac only). */
|
||||||
|
unsigned short usage_page;
|
||||||
|
/** Usage for this Device/Interface
|
||||||
|
(Windows/Mac only).*/
|
||||||
|
unsigned short usage;
|
||||||
|
/** The USB interface which this logical device
|
||||||
|
represents.
|
||||||
|
|
||||||
|
* Valid on both Linux implementations in all cases.
|
||||||
|
* Valid on the Windows implementation only if the device
|
||||||
|
contains more than one interface. */
|
||||||
|
int interface_number;
|
||||||
|
|
||||||
|
/** Additional information about the USB interface.
|
||||||
|
Valid on libusb and Android implementations. */
|
||||||
|
int interface_class;
|
||||||
|
int interface_subclass;
|
||||||
|
int interface_protocol;
|
||||||
|
|
||||||
|
/** Pointer to the next device */
|
||||||
|
struct SDL_hid_device_info *next;
|
||||||
|
} SDL_hid_device_info;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialize the HIDAPI library.
|
||||||
|
*
|
||||||
|
* This function initializes the HIDAPI library. Calling it is not strictly
|
||||||
|
* necessary, as it will be called automatically by SDL_hid_enumerate() and
|
||||||
|
* any of the SDL_hid_open_*() functions if it is needed. This function should
|
||||||
|
* be called at the beginning of execution however, if there is a chance of
|
||||||
|
* HIDAPI handles being opened by different threads simultaneously.
|
||||||
|
*
|
||||||
|
* Each call to this function should have a matching call to SDL_hid_exit()
|
||||||
|
*
|
||||||
|
* \returns 0 on success and -1 on error.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.18.
|
||||||
|
*
|
||||||
|
* \sa SDL_hid_exit
|
||||||
|
*/
|
||||||
|
extern DECLSPEC int SDLCALL SDL_hid_init(void);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Finalize the HIDAPI library.
|
||||||
|
*
|
||||||
|
* This function frees all of the static data associated with HIDAPI. It
|
||||||
|
* should be called at the end of execution to avoid memory leaks.
|
||||||
|
*
|
||||||
|
* \returns 0 on success and -1 on error.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.18.
|
||||||
|
*
|
||||||
|
* \sa SDL_hid_init
|
||||||
|
*/
|
||||||
|
extern DECLSPEC int SDLCALL SDL_hid_exit(void);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check to see if devices may have been added or removed.
|
||||||
|
*
|
||||||
|
* Enumerating the HID devices is an expensive operation, so you can call this
|
||||||
|
* to see if there have been any system device changes since the last call to
|
||||||
|
* this function. A change in the counter returned doesn't necessarily mean
|
||||||
|
* that anything has changed, but you can call SDL_hid_enumerate() to get an
|
||||||
|
* updated device list.
|
||||||
|
*
|
||||||
|
* Calling this function for the first time may cause a thread or other system
|
||||||
|
* resource to be allocated to track device change notifications.
|
||||||
|
*
|
||||||
|
* \returns a change counter that is incremented with each potential device
|
||||||
|
* change, or 0 if device change detection isn't available.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.18.
|
||||||
|
*
|
||||||
|
* \sa SDL_hid_enumerate
|
||||||
|
*/
|
||||||
|
extern DECLSPEC Uint32 SDLCALL SDL_hid_device_change_count(void);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enumerate the HID Devices.
|
||||||
|
*
|
||||||
|
* This function returns a linked list of all the HID devices attached to the
|
||||||
|
* system which match vendor_id and product_id. If `vendor_id` is set to 0
|
||||||
|
* then any vendor matches. If `product_id` is set to 0 then any product
|
||||||
|
* matches. If `vendor_id` and `product_id` are both set to 0, then all HID
|
||||||
|
* devices will be returned.
|
||||||
|
*
|
||||||
|
* \param vendor_id The Vendor ID (VID) of the types of device to open.
|
||||||
|
* \param product_id The Product ID (PID) of the types of device to open.
|
||||||
|
* \returns a pointer to a linked list of type SDL_hid_device_info, containing
|
||||||
|
* information about the HID devices attached to the system, or NULL
|
||||||
|
* in the case of failure. Free this linked list by calling
|
||||||
|
* SDL_hid_free_enumeration().
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.18.
|
||||||
|
*
|
||||||
|
* \sa SDL_hid_device_change_count
|
||||||
|
*/
|
||||||
|
extern DECLSPEC SDL_hid_device_info * SDLCALL SDL_hid_enumerate(unsigned short vendor_id, unsigned short product_id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Free an enumeration Linked List
|
||||||
|
*
|
||||||
|
* This function frees a linked list created by SDL_hid_enumerate().
|
||||||
|
*
|
||||||
|
* \param devs Pointer to a list of struct_device returned from
|
||||||
|
* SDL_hid_enumerate().
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.18.
|
||||||
|
*/
|
||||||
|
extern DECLSPEC void SDLCALL SDL_hid_free_enumeration(SDL_hid_device_info *devs);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Open a HID device using a Vendor ID (VID), Product ID (PID) and optionally
|
||||||
|
* a serial number.
|
||||||
|
*
|
||||||
|
* If `serial_number` is NULL, the first device with the specified VID and PID
|
||||||
|
* is opened.
|
||||||
|
*
|
||||||
|
* \param vendor_id The Vendor ID (VID) of the device to open.
|
||||||
|
* \param product_id The Product ID (PID) of the device to open.
|
||||||
|
* \param serial_number The Serial Number of the device to open (Optionally
|
||||||
|
* NULL).
|
||||||
|
* \returns a pointer to a SDL_hid_device object on success or NULL on
|
||||||
|
* failure.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.18.
|
||||||
|
*/
|
||||||
|
extern DECLSPEC SDL_hid_device * SDLCALL SDL_hid_open(unsigned short vendor_id, unsigned short product_id, const wchar_t *serial_number);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Open a HID device by its path name.
|
||||||
|
*
|
||||||
|
* The path name be determined by calling SDL_hid_enumerate(), or a
|
||||||
|
* platform-specific path name can be used (eg: /dev/hidraw0 on Linux).
|
||||||
|
*
|
||||||
|
* \param path The path name of the device to open
|
||||||
|
* \returns a pointer to a SDL_hid_device object on success or NULL on
|
||||||
|
* failure.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.18.
|
||||||
|
*/
|
||||||
|
extern DECLSPEC SDL_hid_device * SDLCALL SDL_hid_open_path(const char *path, int bExclusive /* = false */);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Write an Output report to a HID device.
|
||||||
|
*
|
||||||
|
* The first byte of `data` must contain the Report ID. For devices which only
|
||||||
|
* support a single report, this must be set to 0x0. The remaining bytes
|
||||||
|
* contain the report data. Since the Report ID is mandatory, calls to
|
||||||
|
* SDL_hid_write() will always contain one more byte than the report contains.
|
||||||
|
* For example, if a hid report is 16 bytes long, 17 bytes must be passed to
|
||||||
|
* SDL_hid_write(), the Report ID (or 0x0, for devices with a single report),
|
||||||
|
* followed by the report data (16 bytes). In this example, the length passed
|
||||||
|
* in would be 17.
|
||||||
|
*
|
||||||
|
* SDL_hid_write() will send the data on the first OUT endpoint, if one
|
||||||
|
* exists. If it does not, it will send the data through the Control Endpoint
|
||||||
|
* (Endpoint 0).
|
||||||
|
*
|
||||||
|
* \param dev A device handle returned from SDL_hid_open().
|
||||||
|
* \param data The data to send, including the report number as the first
|
||||||
|
* byte.
|
||||||
|
* \param length The length in bytes of the data to send.
|
||||||
|
* \returns the actual number of bytes written and -1 on error.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.18.
|
||||||
|
*/
|
||||||
|
extern DECLSPEC int SDLCALL SDL_hid_write(SDL_hid_device *dev, const unsigned char *data, size_t length);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Read an Input report from a HID device with timeout.
|
||||||
|
*
|
||||||
|
* Input reports are returned to the host through the INTERRUPT IN endpoint.
|
||||||
|
* The first byte will contain the Report number if the device uses numbered
|
||||||
|
* reports.
|
||||||
|
*
|
||||||
|
* \param dev A device handle returned from SDL_hid_open().
|
||||||
|
* \param data A buffer to put the read data into.
|
||||||
|
* \param length The number of bytes to read. For devices with multiple
|
||||||
|
* reports, make sure to read an extra byte for the report
|
||||||
|
* number.
|
||||||
|
* \param milliseconds timeout in milliseconds or -1 for blocking wait.
|
||||||
|
* \returns the actual number of bytes read and -1 on error. If no packet was
|
||||||
|
* available to be read within the timeout period, this function
|
||||||
|
* returns 0.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.18.
|
||||||
|
*/
|
||||||
|
extern DECLSPEC int SDLCALL SDL_hid_read_timeout(SDL_hid_device *dev, unsigned char *data, size_t length, int milliseconds);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Read an Input report from a HID device.
|
||||||
|
*
|
||||||
|
* Input reports are returned to the host through the INTERRUPT IN endpoint.
|
||||||
|
* The first byte will contain the Report number if the device uses numbered
|
||||||
|
* reports.
|
||||||
|
*
|
||||||
|
* \param dev A device handle returned from SDL_hid_open().
|
||||||
|
* \param data A buffer to put the read data into.
|
||||||
|
* \param length The number of bytes to read. For devices with multiple
|
||||||
|
* reports, make sure to read an extra byte for the report
|
||||||
|
* number.
|
||||||
|
* \returns the actual number of bytes read and -1 on error. If no packet was
|
||||||
|
* available to be read and the handle is in non-blocking mode, this
|
||||||
|
* function returns 0.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.18.
|
||||||
|
*/
|
||||||
|
extern DECLSPEC int SDLCALL SDL_hid_read(SDL_hid_device *dev, unsigned char *data, size_t length);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the device handle to be non-blocking.
|
||||||
|
*
|
||||||
|
* In non-blocking mode calls to SDL_hid_read() will return immediately with a
|
||||||
|
* value of 0 if there is no data to be read. In blocking mode, SDL_hid_read()
|
||||||
|
* will wait (block) until there is data to read before returning.
|
||||||
|
*
|
||||||
|
* Nonblocking can be turned on and off at any time.
|
||||||
|
*
|
||||||
|
* \param dev A device handle returned from SDL_hid_open().
|
||||||
|
* \param nonblock enable or not the nonblocking reads - 1 to enable
|
||||||
|
* nonblocking - 0 to disable nonblocking.
|
||||||
|
* \returns 0 on success and -1 on error.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.18.
|
||||||
|
*/
|
||||||
|
extern DECLSPEC int SDLCALL SDL_hid_set_nonblocking(SDL_hid_device *dev, int nonblock);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Send a Feature report to the device.
|
||||||
|
*
|
||||||
|
* Feature reports are sent over the Control endpoint as a Set_Report
|
||||||
|
* transfer. The first byte of `data` must contain the Report ID. For devices
|
||||||
|
* which only support a single report, this must be set to 0x0. The remaining
|
||||||
|
* bytes contain the report data. Since the Report ID is mandatory, calls to
|
||||||
|
* SDL_hid_send_feature_report() will always contain one more byte than the
|
||||||
|
* report contains. For example, if a hid report is 16 bytes long, 17 bytes
|
||||||
|
* must be passed to SDL_hid_send_feature_report(): the Report ID (or 0x0, for
|
||||||
|
* devices which do not use numbered reports), followed by the report data (16
|
||||||
|
* bytes). In this example, the length passed in would be 17.
|
||||||
|
*
|
||||||
|
* \param dev A device handle returned from SDL_hid_open().
|
||||||
|
* \param data The data to send, including the report number as the first
|
||||||
|
* byte.
|
||||||
|
* \param length The length in bytes of the data to send, including the report
|
||||||
|
* number.
|
||||||
|
* \returns the actual number of bytes written and -1 on error.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.18.
|
||||||
|
*/
|
||||||
|
extern DECLSPEC int SDLCALL SDL_hid_send_feature_report(SDL_hid_device *dev, const unsigned char *data, size_t length);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a feature report from a HID device.
|
||||||
|
*
|
||||||
|
* Set the first byte of `data` to the Report ID of the report to be read.
|
||||||
|
* Make sure to allow space for this extra byte in `data`. Upon return, the
|
||||||
|
* first byte will still contain the Report ID, and the report data will start
|
||||||
|
* in data[1].
|
||||||
|
*
|
||||||
|
* \param dev A device handle returned from SDL_hid_open().
|
||||||
|
* \param data A buffer to put the read data into, including the Report ID.
|
||||||
|
* Set the first byte of `data` to the Report ID of the report to
|
||||||
|
* be read, or set it to zero if your device does not use numbered
|
||||||
|
* reports.
|
||||||
|
* \param length The number of bytes to read, including an extra byte for the
|
||||||
|
* report ID. The buffer can be longer than the actual report.
|
||||||
|
* \returns the number of bytes read plus one for the report ID (which is
|
||||||
|
* still in the first byte), or -1 on error.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.18.
|
||||||
|
*/
|
||||||
|
extern DECLSPEC int SDLCALL SDL_hid_get_feature_report(SDL_hid_device *dev, unsigned char *data, size_t length);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Close a HID device.
|
||||||
|
*
|
||||||
|
* \param dev A device handle returned from SDL_hid_open().
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.18.
|
||||||
|
*/
|
||||||
|
extern DECLSPEC void SDLCALL SDL_hid_close(SDL_hid_device *dev);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get The Manufacturer String from a HID device.
|
||||||
|
*
|
||||||
|
* \param dev A device handle returned from SDL_hid_open().
|
||||||
|
* \param string A wide string buffer to put the data into.
|
||||||
|
* \param maxlen The length of the buffer in multiples of wchar_t.
|
||||||
|
* \returns 0 on success and -1 on error.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.18.
|
||||||
|
*/
|
||||||
|
extern DECLSPEC int SDLCALL SDL_hid_get_manufacturer_string(SDL_hid_device *dev, wchar_t *string, size_t maxlen);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get The Product String from a HID device.
|
||||||
|
*
|
||||||
|
* \param dev A device handle returned from SDL_hid_open().
|
||||||
|
* \param string A wide string buffer to put the data into.
|
||||||
|
* \param maxlen The length of the buffer in multiples of wchar_t.
|
||||||
|
* \returns 0 on success and -1 on error.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.18.
|
||||||
|
*/
|
||||||
|
extern DECLSPEC int SDLCALL SDL_hid_get_product_string(SDL_hid_device *dev, wchar_t *string, size_t maxlen);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get The Serial Number String from a HID device.
|
||||||
|
*
|
||||||
|
* \param dev A device handle returned from SDL_hid_open().
|
||||||
|
* \param string A wide string buffer to put the data into.
|
||||||
|
* \param maxlen The length of the buffer in multiples of wchar_t.
|
||||||
|
* \returns 0 on success and -1 on error.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.18.
|
||||||
|
*/
|
||||||
|
extern DECLSPEC int SDLCALL SDL_hid_get_serial_number_string(SDL_hid_device *dev, wchar_t *string, size_t maxlen);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a string from a HID device, based on its string index.
|
||||||
|
*
|
||||||
|
* \param dev A device handle returned from SDL_hid_open().
|
||||||
|
* \param string_index The index of the string to get.
|
||||||
|
* \param string A wide string buffer to put the data into.
|
||||||
|
* \param maxlen The length of the buffer in multiples of wchar_t.
|
||||||
|
* \returns 0 on success and -1 on error.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.18.
|
||||||
|
*/
|
||||||
|
extern DECLSPEC int SDLCALL SDL_hid_get_indexed_string(SDL_hid_device *dev, int string_index, wchar_t *string, size_t maxlen);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Start or stop a BLE scan on iOS and tvOS to pair Steam Controllers
|
||||||
|
*
|
||||||
|
* \param active SDL_TRUE to start the scan, SDL_FALSE to stop the scan
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.18.
|
||||||
|
*/
|
||||||
|
extern DECLSPEC void SDLCALL SDL_hid_ble_scan(SDL_bool active);
|
||||||
|
|
||||||
|
/* Ends C function definitions when using C++ */
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#include "close_code.h"
|
||||||
|
|
||||||
|
#endif /* SDL_hidapi_h_ */
|
||||||
|
|
||||||
|
/* vi: set sts=4 ts=4 sw=4 expandtab: */
|
||||||
+137
-10
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
Simple DirectMedia Layer
|
Simple DirectMedia Layer
|
||||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
||||||
|
|
||||||
This software is provided 'as-is', without any express or implied
|
This software is provided 'as-is', without any express or implied
|
||||||
warranty. In no event will the authors be held liable for any damages
|
warranty. In no event will the authors be held liable for any damages
|
||||||
@@ -145,6 +145,26 @@ extern "C" {
|
|||||||
*/
|
*/
|
||||||
#define SDL_HINT_ANDROID_TRAP_BACK_BUTTON "SDL_ANDROID_TRAP_BACK_BUTTON"
|
#define SDL_HINT_ANDROID_TRAP_BACK_BUTTON "SDL_ANDROID_TRAP_BACK_BUTTON"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Specify an application name.
|
||||||
|
*
|
||||||
|
* This hint lets you specify the application name sent to the OS when
|
||||||
|
* required. For example, this will often appear in volume control applets for
|
||||||
|
* audio streams, and in lists of applications which are inhibiting the
|
||||||
|
* screensaver. You should use a string that describes your program ("My Game
|
||||||
|
* 2: The Revenge")
|
||||||
|
*
|
||||||
|
* Setting this to "" or leaving it unset will have SDL use a reasonable
|
||||||
|
* default: probably the application's name or "SDL Application" if SDL
|
||||||
|
* doesn't have any better information.
|
||||||
|
*
|
||||||
|
* Note that, for audio streams, this can be overridden with
|
||||||
|
* SDL_HINT_AUDIO_DEVICE_APP_NAME.
|
||||||
|
*
|
||||||
|
* On targets where this is not supported, this hint does nothing.
|
||||||
|
*/
|
||||||
|
#define SDL_HINT_APP_NAME "SDL_APP_NAME"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief A variable controlling whether controllers used with the Apple TV
|
* \brief A variable controlling whether controllers used with the Apple TV
|
||||||
* generate UI events.
|
* generate UI events.
|
||||||
@@ -199,8 +219,9 @@ extern "C" {
|
|||||||
* that describes your program ("My Game 2: The Revenge")
|
* that describes your program ("My Game 2: The Revenge")
|
||||||
*
|
*
|
||||||
* Setting this to "" or leaving it unset will have SDL use a reasonable
|
* Setting this to "" or leaving it unset will have SDL use a reasonable
|
||||||
* default: probably the application's name or "SDL Application" if SDL
|
* default: this will be the name set with SDL_HINT_APP_NAME, if that hint is
|
||||||
* doesn't have any better information.
|
* set. Otherwise, it'll probably the application's name or "SDL Application"
|
||||||
|
* if SDL doesn't have any better information.
|
||||||
*
|
*
|
||||||
* On targets where this is not supported, this hint does nothing.
|
* On targets where this is not supported, this hint does nothing.
|
||||||
*/
|
*/
|
||||||
@@ -536,6 +557,15 @@ extern "C" {
|
|||||||
*/
|
*/
|
||||||
#define SDL_HINT_IME_INTERNAL_EDITING "SDL_IME_INTERNAL_EDITING"
|
#define SDL_HINT_IME_INTERNAL_EDITING "SDL_IME_INTERNAL_EDITING"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief A variable to control whether certain IMEs should show native UI components (such as the Candidate List) instead of suppressing them.
|
||||||
|
*
|
||||||
|
* The variable can be set to the following values:
|
||||||
|
* "0" - Native UI components are not display. (default)
|
||||||
|
* "1" - Native UI components are displayed.
|
||||||
|
*/
|
||||||
|
#define SDL_HINT_IME_SHOW_UI "SDL_IME_SHOW_UI"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief A variable controlling whether the home indicator bar on iPhone X
|
* \brief A variable controlling whether the home indicator bar on iPhone X
|
||||||
* should be hidden.
|
* should be hidden.
|
||||||
@@ -690,9 +720,10 @@ extern "C" {
|
|||||||
*
|
*
|
||||||
* This variable can be set to the following values:
|
* This variable can be set to the following values:
|
||||||
* "0" - HIDAPI driver is not used
|
* "0" - HIDAPI driver is not used
|
||||||
* "1" - HIDAPI driver is used
|
* "1" - HIDAPI driver is used for Steam Controllers, which requires Bluetooth access
|
||||||
|
* and may prompt the user for permission on iOS and Android.
|
||||||
*
|
*
|
||||||
* The default is the value of SDL_HINT_JOYSTICK_HIDAPI
|
* The default is "0"
|
||||||
*/
|
*/
|
||||||
#define SDL_HINT_JOYSTICK_HIDAPI_STEAM "SDL_JOYSTICK_HIDAPI_STEAM"
|
#define SDL_HINT_JOYSTICK_HIDAPI_STEAM "SDL_JOYSTICK_HIDAPI_STEAM"
|
||||||
|
|
||||||
@@ -711,8 +742,10 @@ extern "C" {
|
|||||||
* \brief A variable controlling whether the Home button LED should be turned on when a Nintendo Switch controller is opened
|
* \brief A variable controlling whether the Home button LED should be turned on when a Nintendo Switch controller is opened
|
||||||
*
|
*
|
||||||
* This variable can be set to the following values:
|
* This variable can be set to the following values:
|
||||||
* "0" - home button LED is left off
|
* "0" - home button LED is turned off
|
||||||
* "1" - home button LED is turned on (the default)
|
* "1" - home button LED is turned on
|
||||||
|
*
|
||||||
|
* By default the Home button LED state is not changed.
|
||||||
*/
|
*/
|
||||||
#define SDL_HINT_JOYSTICK_HIDAPI_SWITCH_HOME_LED "SDL_JOYSTICK_HIDAPI_SWITCH_HOME_LED"
|
#define SDL_HINT_JOYSTICK_HIDAPI_SWITCH_HOME_LED "SDL_JOYSTICK_HIDAPI_SWITCH_HOME_LED"
|
||||||
|
|
||||||
@@ -784,6 +817,24 @@ extern "C" {
|
|||||||
*/
|
*/
|
||||||
#define SDL_HINT_KMSDRM_REQUIRE_DRM_MASTER "SDL_KMSDRM_REQUIRE_DRM_MASTER"
|
#define SDL_HINT_KMSDRM_REQUIRE_DRM_MASTER "SDL_KMSDRM_REQUIRE_DRM_MASTER"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief A comma separated list of devices to open as joysticks
|
||||||
|
*
|
||||||
|
* This variable is currently only used by the Linux joystick driver.
|
||||||
|
*/
|
||||||
|
#define SDL_HINT_JOYSTICK_DEVICE "SDL_JOYSTICK_DEVICE"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief A variable controlling whether to use the classic /dev/input/js* joystick interface or the newer /dev/input/event* joystick interface on Linux
|
||||||
|
*
|
||||||
|
* This variable can be set to the following values:
|
||||||
|
* "0" - Use /dev/input/event*
|
||||||
|
* "1" - Use /dev/input/js*
|
||||||
|
*
|
||||||
|
* By default the /dev/input/event* interfaces are used
|
||||||
|
*/
|
||||||
|
#define SDL_HINT_LINUX_JOYSTICK_CLASSIC "SDL_LINUX_JOYSTICK_CLASSIC"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief A variable controlling whether joysticks on Linux adhere to their HID-defined deadzones or return unfiltered values.
|
* \brief A variable controlling whether joysticks on Linux adhere to their HID-defined deadzones or return unfiltered values.
|
||||||
*
|
*
|
||||||
@@ -926,6 +977,22 @@ extern "C" {
|
|||||||
*/
|
*/
|
||||||
#define SDL_HINT_ORIENTATIONS "SDL_IOS_ORIENTATIONS"
|
#define SDL_HINT_ORIENTATIONS "SDL_IOS_ORIENTATIONS"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief A variable controlling the use of a sentinel event when polling the event queue
|
||||||
|
*
|
||||||
|
* This variable can be set to the following values:
|
||||||
|
* "0" - Disable poll sentinels
|
||||||
|
* "1" - Enable poll sentinels
|
||||||
|
*
|
||||||
|
* When polling for events, SDL_PumpEvents is used to gather new events from devices.
|
||||||
|
* If a device keeps producing new events between calls to SDL_PumpEvents, a poll loop will
|
||||||
|
* become stuck until the new events stop.
|
||||||
|
* This is most noticable when moving a high frequency mouse.
|
||||||
|
*
|
||||||
|
* By default, poll sentinels are enabled.
|
||||||
|
*/
|
||||||
|
#define SDL_HINT_POLL_SENTINEL "SDL_POLL_SENTINEL"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Override for SDL_GetPreferredLocales()
|
* \brief Override for SDL_GetPreferredLocales()
|
||||||
*
|
*
|
||||||
@@ -992,6 +1059,19 @@ extern "C" {
|
|||||||
*/
|
*/
|
||||||
#define SDL_HINT_RENDER_BATCHING "SDL_RENDER_BATCHING"
|
#define SDL_HINT_RENDER_BATCHING "SDL_RENDER_BATCHING"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief A variable controlling how the 2D render API renders lines
|
||||||
|
*
|
||||||
|
* This variable can be set to the following values:
|
||||||
|
* "0" - Use the default line drawing method (Bresenham's line algorithm as of SDL 2.0.20)
|
||||||
|
* "1" - Use the driver point API using Bresenham's line algorithm (correct, draws many points)
|
||||||
|
* "2" - Use the driver line API (occasionally misses line endpoints based on hardware driver quirks, was the default before 2.0.20)
|
||||||
|
* "3" - Use the driver geometry API (correct, draws thicker diagonal lines)
|
||||||
|
*
|
||||||
|
* This variable should be set when the renderer is created.
|
||||||
|
*/
|
||||||
|
#define SDL_HINT_RENDER_LINE_METHOD "SDL_RENDER_LINE_METHOD"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief A variable controlling whether to enable Direct3D 11+'s Debug Layer.
|
* \brief A variable controlling whether to enable Direct3D 11+'s Debug Layer.
|
||||||
*
|
*
|
||||||
@@ -1101,6 +1181,26 @@ extern "C" {
|
|||||||
*/
|
*/
|
||||||
#define SDL_HINT_RPI_VIDEO_LAYER "SDL_RPI_VIDEO_LAYER"
|
#define SDL_HINT_RPI_VIDEO_LAYER "SDL_RPI_VIDEO_LAYER"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Specify an "activity name" for screensaver inhibition.
|
||||||
|
*
|
||||||
|
* Some platforms, notably Linux desktops, list the applications which are
|
||||||
|
* inhibiting the screensaver or other power-saving features.
|
||||||
|
*
|
||||||
|
* This hint lets you specify the "activity name" sent to the OS when
|
||||||
|
* SDL_DisableScreenSaver() is used (or the screensaver is automatically
|
||||||
|
* disabled). The contents of this hint are used when the screensaver is
|
||||||
|
* disabled. You should use a string that describes what your program is doing
|
||||||
|
* (and, therefore, why the screensaver is disabled). For example, "Playing a
|
||||||
|
* game" or "Watching a video".
|
||||||
|
*
|
||||||
|
* Setting this to "" or leaving it unset will have SDL use a reasonable
|
||||||
|
* default: "Playing a game" or something similar.
|
||||||
|
*
|
||||||
|
* On targets where this is not supported, this hint does nothing.
|
||||||
|
*/
|
||||||
|
#define SDL_HINT_SCREENSAVER_INHIBIT_ACTIVITY_NAME "SDL_SCREENSAVER_INHIBIT_ACTIVITY_NAME"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Specifies whether SDL_THREAD_PRIORITY_TIME_CRITICAL should be treated as realtime.
|
* \brief Specifies whether SDL_THREAD_PRIORITY_TIME_CRITICAL should be treated as realtime.
|
||||||
*
|
*
|
||||||
@@ -1218,6 +1318,17 @@ extern "C" {
|
|||||||
*/
|
*/
|
||||||
#define SDL_HINT_VIDEO_DOUBLE_BUFFER "SDL_VIDEO_DOUBLE_BUFFER"
|
#define SDL_HINT_VIDEO_DOUBLE_BUFFER "SDL_VIDEO_DOUBLE_BUFFER"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief A variable controlling whether the EGL window is allowed to be
|
||||||
|
* composited as transparent, rather than opaque.
|
||||||
|
*
|
||||||
|
* Most window systems will always render windows opaque, even if the surface
|
||||||
|
* format has an alpha channel. This is not always true, however, so by default
|
||||||
|
* SDL will try to enforce opaque composition. To override this behavior, you
|
||||||
|
* can set this hint to "1".
|
||||||
|
*/
|
||||||
|
#define SDL_HINT_VIDEO_EGL_ALLOW_TRANSPARENCY "SDL_VIDEO_EGL_ALLOW_TRANSPARENCY"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief A variable controlling whether the graphics context is externally managed.
|
* \brief A variable controlling whether the graphics context is externally managed.
|
||||||
*
|
*
|
||||||
@@ -1484,9 +1595,6 @@ extern "C" {
|
|||||||
* They offer better performance, allocate no kernel ressources and
|
* They offer better performance, allocate no kernel ressources and
|
||||||
* use less memory. SDL will fall back to Critical Sections on older
|
* use less memory. SDL will fall back to Critical Sections on older
|
||||||
* OS versions or if forced to by this hint.
|
* OS versions or if forced to by this hint.
|
||||||
* This also affects Condition Variables. When SRW mutexes are used,
|
|
||||||
* SDL will use Windows Condition Variables as well. Else, a generic
|
|
||||||
* SDL_cond implementation will be used that works with all mutexes.
|
|
||||||
*
|
*
|
||||||
* This variable can be set to the following values:
|
* This variable can be set to the following values:
|
||||||
* "0" - Use SRW Locks when available. If not, fall back to Critical Sections. (default)
|
* "0" - Use SRW Locks when available. If not, fall back to Critical Sections. (default)
|
||||||
@@ -1557,6 +1665,17 @@ extern "C" {
|
|||||||
*/
|
*/
|
||||||
#define SDL_HINT_WINDOW_FRAME_USABLE_WHILE_CURSOR_HIDDEN "SDL_WINDOW_FRAME_USABLE_WHILE_CURSOR_HIDDEN"
|
#define SDL_HINT_WINDOW_FRAME_USABLE_WHILE_CURSOR_HIDDEN "SDL_WINDOW_FRAME_USABLE_WHILE_CURSOR_HIDDEN"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief A variable controlling whether the window is activated when the SDL_ShowWindow function is called
|
||||||
|
*
|
||||||
|
* This variable can be set to the following values:
|
||||||
|
* "0" - The window is activated when the SDL_ShowWindow function is called
|
||||||
|
* "1" - The window is not activated when the SDL_ShowWindow function is called
|
||||||
|
*
|
||||||
|
* By default SDL will activate the window when the SDL_ShowWindow function is called
|
||||||
|
*/
|
||||||
|
#define SDL_HINT_WINDOW_NO_ACTIVATION_WHEN_SHOWN "SDL_WINDOW_NO_ACTIVATION_WHEN_SHOWN"
|
||||||
|
|
||||||
/** \brief Allows back-button-press events on Windows Phone to be marked as handled
|
/** \brief Allows back-button-press events on Windows Phone to be marked as handled
|
||||||
*
|
*
|
||||||
* Windows Phone devices typically feature a Back button. When pressed,
|
* Windows Phone devices typically feature a Back button. When pressed,
|
||||||
@@ -1729,6 +1848,8 @@ typedef enum
|
|||||||
* \param priority the SDL_HintPriority level for the hint
|
* \param priority the SDL_HintPriority level for the hint
|
||||||
* \returns SDL_TRUE if the hint was set, SDL_FALSE otherwise.
|
* \returns SDL_TRUE if the hint was set, SDL_FALSE otherwise.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_GetHint
|
* \sa SDL_GetHint
|
||||||
* \sa SDL_SetHint
|
* \sa SDL_SetHint
|
||||||
*/
|
*/
|
||||||
@@ -1747,6 +1868,8 @@ extern DECLSPEC SDL_bool SDLCALL SDL_SetHintWithPriority(const char *name,
|
|||||||
* \param value the value of the hint variable
|
* \param value the value of the hint variable
|
||||||
* \returns SDL_TRUE if the hint was set, SDL_FALSE otherwise.
|
* \returns SDL_TRUE if the hint was set, SDL_FALSE otherwise.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_GetHint
|
* \sa SDL_GetHint
|
||||||
* \sa SDL_SetHintWithPriority
|
* \sa SDL_SetHintWithPriority
|
||||||
*/
|
*/
|
||||||
@@ -1759,6 +1882,8 @@ extern DECLSPEC SDL_bool SDLCALL SDL_SetHint(const char *name,
|
|||||||
* \param name the hint to query
|
* \param name the hint to query
|
||||||
* \returns the string value of a hint or NULL if the hint isn't set.
|
* \returns the string value of a hint or NULL if the hint isn't set.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_SetHint
|
* \sa SDL_SetHint
|
||||||
* \sa SDL_SetHintWithPriority
|
* \sa SDL_SetHintWithPriority
|
||||||
*/
|
*/
|
||||||
@@ -1825,6 +1950,8 @@ extern DECLSPEC void SDLCALL SDL_DelHintCallback(const char *name,
|
|||||||
* Clear all hints.
|
* Clear all hints.
|
||||||
*
|
*
|
||||||
* This function is automatically called during SDL_Quit().
|
* This function is automatically called during SDL_Quit().
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC void SDLCALL SDL_ClearHints(void);
|
extern DECLSPEC void SDLCALL SDL_ClearHints(void);
|
||||||
|
|
||||||
|
|||||||
+126
-1
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
Simple DirectMedia Layer
|
Simple DirectMedia Layer
|
||||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
||||||
|
|
||||||
This software is provided 'as-is', without any express or implied
|
This software is provided 'as-is', without any express or implied
|
||||||
warranty. In no event will the authors be held liable for any damages
|
warranty. In no event will the authors be held liable for any damages
|
||||||
@@ -124,6 +124,8 @@ typedef enum
|
|||||||
* In particular, you are guaranteed that the joystick list won't change, so
|
* In particular, you are guaranteed that the joystick list won't change, so
|
||||||
* the API functions that take a joystick index will be valid, and joystick
|
* the API functions that take a joystick index will be valid, and joystick
|
||||||
* and game controller events will not be delivered.
|
* and game controller events will not be delivered.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.7.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC void SDLCALL SDL_LockJoysticks(void);
|
extern DECLSPEC void SDLCALL SDL_LockJoysticks(void);
|
||||||
|
|
||||||
@@ -137,6 +139,8 @@ extern DECLSPEC void SDLCALL SDL_LockJoysticks(void);
|
|||||||
* In particular, you are guaranteed that the joystick list won't change, so
|
* In particular, you are guaranteed that the joystick list won't change, so
|
||||||
* the API functions that take a joystick index will be valid, and joystick
|
* the API functions that take a joystick index will be valid, and joystick
|
||||||
* and game controller events will not be delivered.
|
* and game controller events will not be delivered.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.7.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC void SDLCALL SDL_UnlockJoysticks(void);
|
extern DECLSPEC void SDLCALL SDL_UnlockJoysticks(void);
|
||||||
|
|
||||||
@@ -146,6 +150,8 @@ extern DECLSPEC void SDLCALL SDL_UnlockJoysticks(void);
|
|||||||
* \returns the number of attached joysticks on success or a negative error
|
* \returns the number of attached joysticks on success or a negative error
|
||||||
* code on failure; call SDL_GetError() for more information.
|
* code on failure; call SDL_GetError() for more information.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_JoystickName
|
* \sa SDL_JoystickName
|
||||||
* \sa SDL_JoystickOpen
|
* \sa SDL_JoystickOpen
|
||||||
*/
|
*/
|
||||||
@@ -161,6 +167,8 @@ extern DECLSPEC int SDLCALL SDL_NumJoysticks(void);
|
|||||||
* \returns the name of the selected joystick. If no name can be found, this
|
* \returns the name of the selected joystick. If no name can be found, this
|
||||||
* function returns NULL; call SDL_GetError() for more information.
|
* function returns NULL; call SDL_GetError() for more information.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_JoystickName
|
* \sa SDL_JoystickName
|
||||||
* \sa SDL_JoystickOpen
|
* \sa SDL_JoystickOpen
|
||||||
*/
|
*/
|
||||||
@@ -169,6 +177,8 @@ extern DECLSPEC const char *SDLCALL SDL_JoystickNameForIndex(int device_index);
|
|||||||
/**
|
/**
|
||||||
* Get the player index of a joystick, or -1 if it's not available This can be
|
* Get the player index of a joystick, or -1 if it's not available This can be
|
||||||
* called before any joysticks are opened.
|
* called before any joysticks are opened.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.9.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC int SDLCALL SDL_JoystickGetDevicePlayerIndex(int device_index);
|
extern DECLSPEC int SDLCALL SDL_JoystickGetDevicePlayerIndex(int device_index);
|
||||||
|
|
||||||
@@ -183,6 +193,8 @@ extern DECLSPEC int SDLCALL SDL_JoystickGetDevicePlayerIndex(int device_index);
|
|||||||
* \returns the GUID of the selected joystick. If called on an invalid index,
|
* \returns the GUID of the selected joystick. If called on an invalid index,
|
||||||
* this function returns a zero GUID
|
* this function returns a zero GUID
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_JoystickGetGUID
|
* \sa SDL_JoystickGetGUID
|
||||||
* \sa SDL_JoystickGetGUIDString
|
* \sa SDL_JoystickGetGUIDString
|
||||||
*/
|
*/
|
||||||
@@ -198,6 +210,8 @@ extern DECLSPEC SDL_JoystickGUID SDLCALL SDL_JoystickGetDeviceGUID(int device_in
|
|||||||
* on the system
|
* on the system
|
||||||
* \returns the USB vendor ID of the selected joystick. If called on an
|
* \returns the USB vendor ID of the selected joystick. If called on an
|
||||||
* invalid index, this function returns zero
|
* invalid index, this function returns zero
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.6.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetDeviceVendor(int device_index);
|
extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetDeviceVendor(int device_index);
|
||||||
|
|
||||||
@@ -211,6 +225,8 @@ extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetDeviceVendor(int device_index);
|
|||||||
* on the system
|
* on the system
|
||||||
* \returns the USB product ID of the selected joystick. If called on an
|
* \returns the USB product ID of the selected joystick. If called on an
|
||||||
* invalid index, this function returns zero
|
* invalid index, this function returns zero
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.6.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetDeviceProduct(int device_index);
|
extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetDeviceProduct(int device_index);
|
||||||
|
|
||||||
@@ -224,6 +240,8 @@ extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetDeviceProduct(int device_index);
|
|||||||
* on the system
|
* on the system
|
||||||
* \returns the product version of the selected joystick. If called on an
|
* \returns the product version of the selected joystick. If called on an
|
||||||
* invalid index, this function returns zero
|
* invalid index, this function returns zero
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.6.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetDeviceProductVersion(int device_index);
|
extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetDeviceProductVersion(int device_index);
|
||||||
|
|
||||||
@@ -236,6 +254,8 @@ extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetDeviceProductVersion(int device_in
|
|||||||
* on the system
|
* on the system
|
||||||
* \returns the SDL_JoystickType of the selected joystick. If called on an
|
* \returns the SDL_JoystickType of the selected joystick. If called on an
|
||||||
* invalid index, this function returns `SDL_JOYSTICK_TYPE_UNKNOWN`
|
* invalid index, this function returns `SDL_JOYSTICK_TYPE_UNKNOWN`
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.6.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC SDL_JoystickType SDLCALL SDL_JoystickGetDeviceType(int device_index);
|
extern DECLSPEC SDL_JoystickType SDLCALL SDL_JoystickGetDeviceType(int device_index);
|
||||||
|
|
||||||
@@ -249,6 +269,8 @@ extern DECLSPEC SDL_JoystickType SDLCALL SDL_JoystickGetDeviceType(int device_in
|
|||||||
* on the system
|
* on the system
|
||||||
* \returns the instance id of the selected joystick. If called on an invalid
|
* \returns the instance id of the selected joystick. If called on an invalid
|
||||||
* index, this function returns zero
|
* index, this function returns zero
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.6.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC SDL_JoystickID SDLCALL SDL_JoystickGetDeviceInstanceID(int device_index);
|
extern DECLSPEC SDL_JoystickID SDLCALL SDL_JoystickGetDeviceInstanceID(int device_index);
|
||||||
|
|
||||||
@@ -267,6 +289,8 @@ extern DECLSPEC SDL_JoystickID SDLCALL SDL_JoystickGetDeviceInstanceID(int devic
|
|||||||
* \returns a joystick identifier or NULL if an error occurred; call
|
* \returns a joystick identifier or NULL if an error occurred; call
|
||||||
* SDL_GetError() for more information.
|
* SDL_GetError() for more information.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_JoystickClose
|
* \sa SDL_JoystickClose
|
||||||
* \sa SDL_JoystickInstanceID
|
* \sa SDL_JoystickInstanceID
|
||||||
*/
|
*/
|
||||||
@@ -289,6 +313,8 @@ extern DECLSPEC SDL_Joystick *SDLCALL SDL_JoystickFromInstanceID(SDL_JoystickID
|
|||||||
* \param player_index the player index to get the SDL_Joystick for
|
* \param player_index the player index to get the SDL_Joystick for
|
||||||
* \returns an SDL_Joystick on success or NULL on failure; call SDL_GetError()
|
* \returns an SDL_Joystick on success or NULL on failure; call SDL_GetError()
|
||||||
* for more information.
|
* for more information.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.12.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC SDL_Joystick *SDLCALL SDL_JoystickFromPlayerIndex(int player_index);
|
extern DECLSPEC SDL_Joystick *SDLCALL SDL_JoystickFromPlayerIndex(int player_index);
|
||||||
|
|
||||||
@@ -296,6 +322,8 @@ extern DECLSPEC SDL_Joystick *SDLCALL SDL_JoystickFromPlayerIndex(int player_ind
|
|||||||
* Attach a new virtual joystick.
|
* Attach a new virtual joystick.
|
||||||
*
|
*
|
||||||
* \returns the joystick's device index, or -1 if an error occurred.
|
* \returns the joystick's device index, or -1 if an error occurred.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.14.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC int SDLCALL SDL_JoystickAttachVirtual(SDL_JoystickType type,
|
extern DECLSPEC int SDLCALL SDL_JoystickAttachVirtual(SDL_JoystickType type,
|
||||||
int naxes,
|
int naxes,
|
||||||
@@ -308,6 +336,8 @@ extern DECLSPEC int SDLCALL SDL_JoystickAttachVirtual(SDL_JoystickType type,
|
|||||||
* \param device_index a value previously returned from
|
* \param device_index a value previously returned from
|
||||||
* SDL_JoystickAttachVirtual()
|
* SDL_JoystickAttachVirtual()
|
||||||
* \returns 0 on success, or -1 if an error occurred.
|
* \returns 0 on success, or -1 if an error occurred.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.14.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC int SDLCALL SDL_JoystickDetachVirtual(int device_index);
|
extern DECLSPEC int SDLCALL SDL_JoystickDetachVirtual(int device_index);
|
||||||
|
|
||||||
@@ -316,6 +346,8 @@ extern DECLSPEC int SDLCALL SDL_JoystickDetachVirtual(int device_index);
|
|||||||
*
|
*
|
||||||
* \param device_index a joystick device index.
|
* \param device_index a joystick device index.
|
||||||
* \returns SDL_TRUE if the joystick is virtual, SDL_FALSE otherwise.
|
* \returns SDL_TRUE if the joystick is virtual, SDL_FALSE otherwise.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.14.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC SDL_bool SDLCALL SDL_JoystickIsVirtual(int device_index);
|
extern DECLSPEC SDL_bool SDLCALL SDL_JoystickIsVirtual(int device_index);
|
||||||
|
|
||||||
@@ -332,6 +364,8 @@ extern DECLSPEC SDL_bool SDLCALL SDL_JoystickIsVirtual(int device_index);
|
|||||||
* \param axis the specific axis on the virtual joystick to set.
|
* \param axis the specific axis on the virtual joystick to set.
|
||||||
* \param value the new value for the specified axis.
|
* \param value the new value for the specified axis.
|
||||||
* \returns 0 on success, -1 on error.
|
* \returns 0 on success, -1 on error.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.14.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC int SDLCALL SDL_JoystickSetVirtualAxis(SDL_Joystick *joystick, int axis, Sint16 value);
|
extern DECLSPEC int SDLCALL SDL_JoystickSetVirtualAxis(SDL_Joystick *joystick, int axis, Sint16 value);
|
||||||
|
|
||||||
@@ -348,6 +382,8 @@ extern DECLSPEC int SDLCALL SDL_JoystickSetVirtualAxis(SDL_Joystick *joystick, i
|
|||||||
* \param button the specific button on the virtual joystick to set.
|
* \param button the specific button on the virtual joystick to set.
|
||||||
* \param value the new value for the specified button.
|
* \param value the new value for the specified button.
|
||||||
* \returns 0 on success, -1 on error.
|
* \returns 0 on success, -1 on error.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.14.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC int SDLCALL SDL_JoystickSetVirtualButton(SDL_Joystick *joystick, int button, Uint8 value);
|
extern DECLSPEC int SDLCALL SDL_JoystickSetVirtualButton(SDL_Joystick *joystick, int button, Uint8 value);
|
||||||
|
|
||||||
@@ -364,6 +400,8 @@ extern DECLSPEC int SDLCALL SDL_JoystickSetVirtualButton(SDL_Joystick *joystick,
|
|||||||
* \param hat the specific hat on the virtual joystick to set.
|
* \param hat the specific hat on the virtual joystick to set.
|
||||||
* \param value the new value for the specified hat.
|
* \param value the new value for the specified hat.
|
||||||
* \returns 0 on success, -1 on error.
|
* \returns 0 on success, -1 on error.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.14.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC int SDLCALL SDL_JoystickSetVirtualHat(SDL_Joystick *joystick, int hat, Uint8 value);
|
extern DECLSPEC int SDLCALL SDL_JoystickSetVirtualHat(SDL_Joystick *joystick, int hat, Uint8 value);
|
||||||
|
|
||||||
@@ -389,6 +427,8 @@ extern DECLSPEC const char *SDLCALL SDL_JoystickName(SDL_Joystick *joystick);
|
|||||||
*
|
*
|
||||||
* \param joystick the SDL_Joystick obtained from SDL_JoystickOpen()
|
* \param joystick the SDL_Joystick obtained from SDL_JoystickOpen()
|
||||||
* \returns the player index, or -1 if it's not available.
|
* \returns the player index, or -1 if it's not available.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.9.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC int SDLCALL SDL_JoystickGetPlayerIndex(SDL_Joystick *joystick);
|
extern DECLSPEC int SDLCALL SDL_JoystickGetPlayerIndex(SDL_Joystick *joystick);
|
||||||
|
|
||||||
@@ -397,6 +437,8 @@ extern DECLSPEC int SDLCALL SDL_JoystickGetPlayerIndex(SDL_Joystick *joystick);
|
|||||||
*
|
*
|
||||||
* \param joystick the SDL_Joystick obtained from SDL_JoystickOpen()
|
* \param joystick the SDL_Joystick obtained from SDL_JoystickOpen()
|
||||||
* \param player_index the player index to set.
|
* \param player_index the player index to set.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.12.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC void SDLCALL SDL_JoystickSetPlayerIndex(SDL_Joystick *joystick, int player_index);
|
extern DECLSPEC void SDLCALL SDL_JoystickSetPlayerIndex(SDL_Joystick *joystick, int player_index);
|
||||||
|
|
||||||
@@ -410,6 +452,8 @@ extern DECLSPEC void SDLCALL SDL_JoystickSetPlayerIndex(SDL_Joystick *joystick,
|
|||||||
* this function returns a zero GUID; call SDL_GetError() for more
|
* this function returns a zero GUID; call SDL_GetError() for more
|
||||||
* information.
|
* information.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_JoystickGetDeviceGUID
|
* \sa SDL_JoystickGetDeviceGUID
|
||||||
* \sa SDL_JoystickGetGUIDString
|
* \sa SDL_JoystickGetGUIDString
|
||||||
*/
|
*/
|
||||||
@@ -422,6 +466,8 @@ extern DECLSPEC SDL_JoystickGUID SDLCALL SDL_JoystickGetGUID(SDL_Joystick *joyst
|
|||||||
*
|
*
|
||||||
* \param joystick the SDL_Joystick obtained from SDL_JoystickOpen()
|
* \param joystick the SDL_Joystick obtained from SDL_JoystickOpen()
|
||||||
* \returns the USB vendor ID of the selected joystick, or 0 if unavailable.
|
* \returns the USB vendor ID of the selected joystick, or 0 if unavailable.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.6.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetVendor(SDL_Joystick *joystick);
|
extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetVendor(SDL_Joystick *joystick);
|
||||||
|
|
||||||
@@ -432,6 +478,8 @@ extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetVendor(SDL_Joystick *joystick);
|
|||||||
*
|
*
|
||||||
* \param joystick the SDL_Joystick obtained from SDL_JoystickOpen()
|
* \param joystick the SDL_Joystick obtained from SDL_JoystickOpen()
|
||||||
* \returns the USB product ID of the selected joystick, or 0 if unavailable.
|
* \returns the USB product ID of the selected joystick, or 0 if unavailable.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.6.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetProduct(SDL_Joystick *joystick);
|
extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetProduct(SDL_Joystick *joystick);
|
||||||
|
|
||||||
@@ -442,6 +490,8 @@ extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetProduct(SDL_Joystick *joystick);
|
|||||||
*
|
*
|
||||||
* \param joystick the SDL_Joystick obtained from SDL_JoystickOpen()
|
* \param joystick the SDL_Joystick obtained from SDL_JoystickOpen()
|
||||||
* \returns the product version of the selected joystick, or 0 if unavailable.
|
* \returns the product version of the selected joystick, or 0 if unavailable.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.6.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetProductVersion(SDL_Joystick *joystick);
|
extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetProductVersion(SDL_Joystick *joystick);
|
||||||
|
|
||||||
@@ -453,6 +503,8 @@ extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetProductVersion(SDL_Joystick *joyst
|
|||||||
* \param joystick the SDL_Joystick obtained from SDL_JoystickOpen()
|
* \param joystick the SDL_Joystick obtained from SDL_JoystickOpen()
|
||||||
* \returns the serial number of the selected joystick, or NULL if
|
* \returns the serial number of the selected joystick, or NULL if
|
||||||
* unavailable.
|
* unavailable.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.14.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC const char * SDLCALL SDL_JoystickGetSerial(SDL_Joystick *joystick);
|
extern DECLSPEC const char * SDLCALL SDL_JoystickGetSerial(SDL_Joystick *joystick);
|
||||||
|
|
||||||
@@ -461,6 +513,8 @@ extern DECLSPEC const char * SDLCALL SDL_JoystickGetSerial(SDL_Joystick *joystic
|
|||||||
*
|
*
|
||||||
* \param joystick the SDL_Joystick obtained from SDL_JoystickOpen()
|
* \param joystick the SDL_Joystick obtained from SDL_JoystickOpen()
|
||||||
* \returns the SDL_JoystickType of the selected joystick.
|
* \returns the SDL_JoystickType of the selected joystick.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.6.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC SDL_JoystickType SDLCALL SDL_JoystickGetType(SDL_Joystick *joystick);
|
extern DECLSPEC SDL_JoystickType SDLCALL SDL_JoystickGetType(SDL_Joystick *joystick);
|
||||||
|
|
||||||
@@ -473,6 +527,8 @@ extern DECLSPEC SDL_JoystickType SDLCALL SDL_JoystickGetType(SDL_Joystick *joyst
|
|||||||
* \param pszGUID buffer in which to write the ASCII string
|
* \param pszGUID buffer in which to write the ASCII string
|
||||||
* \param cbGUID the size of pszGUID
|
* \param cbGUID the size of pszGUID
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_JoystickGetDeviceGUID
|
* \sa SDL_JoystickGetDeviceGUID
|
||||||
* \sa SDL_JoystickGetGUID
|
* \sa SDL_JoystickGetGUID
|
||||||
* \sa SDL_JoystickGetGUIDFromString
|
* \sa SDL_JoystickGetGUIDFromString
|
||||||
@@ -489,6 +545,8 @@ extern DECLSPEC void SDLCALL SDL_JoystickGetGUIDString(SDL_JoystickGUID guid, ch
|
|||||||
* \param pchGUID string containing an ASCII representation of a GUID
|
* \param pchGUID string containing an ASCII representation of a GUID
|
||||||
* \returns a SDL_JoystickGUID structure.
|
* \returns a SDL_JoystickGUID structure.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_JoystickGetGUIDString
|
* \sa SDL_JoystickGetGUIDString
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC SDL_JoystickGUID SDLCALL SDL_JoystickGetGUIDFromString(const char *pchGUID);
|
extern DECLSPEC SDL_JoystickGUID SDLCALL SDL_JoystickGetGUIDFromString(const char *pchGUID);
|
||||||
@@ -500,6 +558,8 @@ extern DECLSPEC SDL_JoystickGUID SDLCALL SDL_JoystickGetGUIDFromString(const cha
|
|||||||
* \returns SDL_TRUE if the joystick has been opened, SDL_FALSE if it has not;
|
* \returns SDL_TRUE if the joystick has been opened, SDL_FALSE if it has not;
|
||||||
* call SDL_GetError() for more information.
|
* call SDL_GetError() for more information.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_JoystickClose
|
* \sa SDL_JoystickClose
|
||||||
* \sa SDL_JoystickOpen
|
* \sa SDL_JoystickOpen
|
||||||
*/
|
*/
|
||||||
@@ -512,6 +572,8 @@ extern DECLSPEC SDL_bool SDLCALL SDL_JoystickGetAttached(SDL_Joystick *joystick)
|
|||||||
* \returns the instance ID of the specified joystick on success or a negative
|
* \returns the instance ID of the specified joystick on success or a negative
|
||||||
* error code on failure; call SDL_GetError() for more information.
|
* error code on failure; call SDL_GetError() for more information.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_JoystickOpen
|
* \sa SDL_JoystickOpen
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC SDL_JoystickID SDLCALL SDL_JoystickInstanceID(SDL_Joystick *joystick);
|
extern DECLSPEC SDL_JoystickID SDLCALL SDL_JoystickInstanceID(SDL_Joystick *joystick);
|
||||||
@@ -528,6 +590,8 @@ extern DECLSPEC SDL_JoystickID SDLCALL SDL_JoystickInstanceID(SDL_Joystick *joys
|
|||||||
* negative error code on failure; call SDL_GetError() for more
|
* negative error code on failure; call SDL_GetError() for more
|
||||||
* information.
|
* information.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_JoystickGetAxis
|
* \sa SDL_JoystickGetAxis
|
||||||
* \sa SDL_JoystickOpen
|
* \sa SDL_JoystickOpen
|
||||||
*/
|
*/
|
||||||
@@ -545,6 +609,8 @@ extern DECLSPEC int SDLCALL SDL_JoystickNumAxes(SDL_Joystick *joystick);
|
|||||||
* \returns the number of trackballs on success or a negative error code on
|
* \returns the number of trackballs on success or a negative error code on
|
||||||
* failure; call SDL_GetError() for more information.
|
* failure; call SDL_GetError() for more information.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_JoystickGetBall
|
* \sa SDL_JoystickGetBall
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC int SDLCALL SDL_JoystickNumBalls(SDL_Joystick *joystick);
|
extern DECLSPEC int SDLCALL SDL_JoystickNumBalls(SDL_Joystick *joystick);
|
||||||
@@ -556,6 +622,8 @@ extern DECLSPEC int SDLCALL SDL_JoystickNumBalls(SDL_Joystick *joystick);
|
|||||||
* \returns the number of POV hats on success or a negative error code on
|
* \returns the number of POV hats on success or a negative error code on
|
||||||
* failure; call SDL_GetError() for more information.
|
* failure; call SDL_GetError() for more information.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_JoystickGetHat
|
* \sa SDL_JoystickGetHat
|
||||||
* \sa SDL_JoystickOpen
|
* \sa SDL_JoystickOpen
|
||||||
*/
|
*/
|
||||||
@@ -568,6 +636,8 @@ extern DECLSPEC int SDLCALL SDL_JoystickNumHats(SDL_Joystick *joystick);
|
|||||||
* \returns the number of buttons on success or a negative error code on
|
* \returns the number of buttons on success or a negative error code on
|
||||||
* failure; call SDL_GetError() for more information.
|
* failure; call SDL_GetError() for more information.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_JoystickGetButton
|
* \sa SDL_JoystickGetButton
|
||||||
* \sa SDL_JoystickOpen
|
* \sa SDL_JoystickOpen
|
||||||
*/
|
*/
|
||||||
@@ -579,6 +649,8 @@ extern DECLSPEC int SDLCALL SDL_JoystickNumButtons(SDL_Joystick *joystick);
|
|||||||
* This is called automatically by the event loop if any joystick events are
|
* This is called automatically by the event loop if any joystick events are
|
||||||
* enabled.
|
* enabled.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_JoystickEventState
|
* \sa SDL_JoystickEventState
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC void SDLCALL SDL_JoystickUpdate(void);
|
extern DECLSPEC void SDLCALL SDL_JoystickUpdate(void);
|
||||||
@@ -602,12 +674,15 @@ extern DECLSPEC void SDLCALL SDL_JoystickUpdate(void);
|
|||||||
* If `state` is `SDL_QUERY` then the current state is returned,
|
* If `state` is `SDL_QUERY` then the current state is returned,
|
||||||
* otherwise the new processing state is returned.
|
* otherwise the new processing state is returned.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_GameControllerEventState
|
* \sa SDL_GameControllerEventState
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC int SDLCALL SDL_JoystickEventState(int state);
|
extern DECLSPEC int SDLCALL SDL_JoystickEventState(int state);
|
||||||
|
|
||||||
#define SDL_JOYSTICK_AXIS_MAX 32767
|
#define SDL_JOYSTICK_AXIS_MAX 32767
|
||||||
#define SDL_JOYSTICK_AXIS_MIN -32768
|
#define SDL_JOYSTICK_AXIS_MIN -32768
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the current state of an axis control on a joystick.
|
* Get the current state of an axis control on a joystick.
|
||||||
*
|
*
|
||||||
@@ -626,6 +701,8 @@ extern DECLSPEC int SDLCALL SDL_JoystickEventState(int state);
|
|||||||
* \returns a 16-bit signed integer representing the current position of the
|
* \returns a 16-bit signed integer representing the current position of the
|
||||||
* axis or 0 on failure; call SDL_GetError() for more information.
|
* axis or 0 on failure; call SDL_GetError() for more information.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_JoystickNumAxes
|
* \sa SDL_JoystickNumAxes
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC Sint16 SDLCALL SDL_JoystickGetAxis(SDL_Joystick *joystick,
|
extern DECLSPEC Sint16 SDLCALL SDL_JoystickGetAxis(SDL_Joystick *joystick,
|
||||||
@@ -642,6 +719,8 @@ extern DECLSPEC Sint16 SDLCALL SDL_JoystickGetAxis(SDL_Joystick *joystick,
|
|||||||
* \param axis the axis to query; the axis indices start at index 0
|
* \param axis the axis to query; the axis indices start at index 0
|
||||||
* \param state Upon return, the initial value is supplied here.
|
* \param state Upon return, the initial value is supplied here.
|
||||||
* \return SDL_TRUE if this axis has any initial value, or SDL_FALSE if not.
|
* \return SDL_TRUE if this axis has any initial value, or SDL_FALSE if not.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.6.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC SDL_bool SDLCALL SDL_JoystickGetAxisInitialState(SDL_Joystick *joystick,
|
extern DECLSPEC SDL_bool SDLCALL SDL_JoystickGetAxisInitialState(SDL_Joystick *joystick,
|
||||||
int axis, Sint16 *state);
|
int axis, Sint16 *state);
|
||||||
@@ -680,6 +759,8 @@ extern DECLSPEC SDL_bool SDLCALL SDL_JoystickGetAxisInitialState(SDL_Joystick *j
|
|||||||
* \param hat the hat index to get the state from; indices start at index 0
|
* \param hat the hat index to get the state from; indices start at index 0
|
||||||
* \returns the current hat position.
|
* \returns the current hat position.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_JoystickNumHats
|
* \sa SDL_JoystickNumHats
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC Uint8 SDLCALL SDL_JoystickGetHat(SDL_Joystick *joystick,
|
extern DECLSPEC Uint8 SDLCALL SDL_JoystickGetHat(SDL_Joystick *joystick,
|
||||||
@@ -700,6 +781,8 @@ extern DECLSPEC Uint8 SDLCALL SDL_JoystickGetHat(SDL_Joystick *joystick,
|
|||||||
* \returns 0 on success or a negative error code on failure; call
|
* \returns 0 on success or a negative error code on failure; call
|
||||||
* SDL_GetError() for more information.
|
* SDL_GetError() for more information.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_JoystickNumBalls
|
* \sa SDL_JoystickNumBalls
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC int SDLCALL SDL_JoystickGetBall(SDL_Joystick *joystick,
|
extern DECLSPEC int SDLCALL SDL_JoystickGetBall(SDL_Joystick *joystick,
|
||||||
@@ -713,6 +796,8 @@ extern DECLSPEC int SDLCALL SDL_JoystickGetBall(SDL_Joystick *joystick,
|
|||||||
* index 0
|
* index 0
|
||||||
* \returns 1 if the specified button is pressed, 0 otherwise.
|
* \returns 1 if the specified button is pressed, 0 otherwise.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_JoystickNumButtons
|
* \sa SDL_JoystickNumButtons
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC Uint8 SDLCALL SDL_JoystickGetButton(SDL_Joystick *joystick,
|
extern DECLSPEC Uint8 SDLCALL SDL_JoystickGetButton(SDL_Joystick *joystick,
|
||||||
@@ -731,6 +816,10 @@ extern DECLSPEC Uint8 SDLCALL SDL_JoystickGetButton(SDL_Joystick *joystick,
|
|||||||
* rumble motor, from 0 to 0xFFFF
|
* rumble motor, from 0 to 0xFFFF
|
||||||
* \param duration_ms The duration of the rumble effect, in milliseconds
|
* \param duration_ms The duration of the rumble effect, in milliseconds
|
||||||
* \returns 0, or -1 if rumble isn't supported on this joystick
|
* \returns 0, or -1 if rumble isn't supported on this joystick
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.9.
|
||||||
|
*
|
||||||
|
* \sa SDL_JoystickHasRumble
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC int SDLCALL SDL_JoystickRumble(SDL_Joystick *joystick, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble, Uint32 duration_ms);
|
extern DECLSPEC int SDLCALL SDL_JoystickRumble(SDL_Joystick *joystick, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble, Uint32 duration_ms);
|
||||||
|
|
||||||
@@ -752,6 +841,10 @@ extern DECLSPEC int SDLCALL SDL_JoystickRumble(SDL_Joystick *joystick, Uint16 lo
|
|||||||
* to 0xFFFF
|
* to 0xFFFF
|
||||||
* \param duration_ms The duration of the rumble effect, in milliseconds
|
* \param duration_ms The duration of the rumble effect, in milliseconds
|
||||||
* \returns 0, or -1 if trigger rumble isn't supported on this joystick
|
* \returns 0, or -1 if trigger rumble isn't supported on this joystick
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.14.
|
||||||
|
*
|
||||||
|
* \sa SDL_JoystickHasRumbleTriggers
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC int SDLCALL SDL_JoystickRumbleTriggers(SDL_Joystick *joystick, Uint16 left_rumble, Uint16 right_rumble, Uint32 duration_ms);
|
extern DECLSPEC int SDLCALL SDL_JoystickRumbleTriggers(SDL_Joystick *joystick, Uint16 left_rumble, Uint16 right_rumble, Uint32 duration_ms);
|
||||||
|
|
||||||
@@ -763,9 +856,35 @@ extern DECLSPEC int SDLCALL SDL_JoystickRumbleTriggers(SDL_Joystick *joystick, U
|
|||||||
*
|
*
|
||||||
* \param joystick The joystick to query
|
* \param joystick The joystick to query
|
||||||
* \return SDL_TRUE if the joystick has a modifiable LED, SDL_FALSE otherwise.
|
* \return SDL_TRUE if the joystick has a modifiable LED, SDL_FALSE otherwise.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.14.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC SDL_bool SDLCALL SDL_JoystickHasLED(SDL_Joystick *joystick);
|
extern DECLSPEC SDL_bool SDLCALL SDL_JoystickHasLED(SDL_Joystick *joystick);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Query whether a joystick has rumble support.
|
||||||
|
*
|
||||||
|
* \param joystick The joystick to query
|
||||||
|
* \return SDL_TRUE if the joystick has rumble, SDL_FALSE otherwise.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.18.
|
||||||
|
*
|
||||||
|
* \sa SDL_JoystickRumble
|
||||||
|
*/
|
||||||
|
extern DECLSPEC SDL_bool SDLCALL SDL_JoystickHasRumble(SDL_Joystick *joystick);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Query whether a joystick has rumble support on triggers.
|
||||||
|
*
|
||||||
|
* \param joystick The joystick to query
|
||||||
|
* \return SDL_TRUE if the joystick has trigger rumble, SDL_FALSE otherwise.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.18.
|
||||||
|
*
|
||||||
|
* \sa SDL_JoystickRumbleTriggers
|
||||||
|
*/
|
||||||
|
extern DECLSPEC SDL_bool SDLCALL SDL_JoystickHasRumbleTriggers(SDL_Joystick *joystick);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update a joystick's LED color.
|
* Update a joystick's LED color.
|
||||||
*
|
*
|
||||||
@@ -777,6 +896,8 @@ extern DECLSPEC SDL_bool SDLCALL SDL_JoystickHasLED(SDL_Joystick *joystick);
|
|||||||
* \param green The intensity of the green LED
|
* \param green The intensity of the green LED
|
||||||
* \param blue The intensity of the blue LED
|
* \param blue The intensity of the blue LED
|
||||||
* \returns 0 on success, -1 if this joystick does not have a modifiable LED
|
* \returns 0 on success, -1 if this joystick does not have a modifiable LED
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.14.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC int SDLCALL SDL_JoystickSetLED(SDL_Joystick *joystick, Uint8 red, Uint8 green, Uint8 blue);
|
extern DECLSPEC int SDLCALL SDL_JoystickSetLED(SDL_Joystick *joystick, Uint8 red, Uint8 green, Uint8 blue);
|
||||||
|
|
||||||
@@ -787,6 +908,8 @@ extern DECLSPEC int SDLCALL SDL_JoystickSetLED(SDL_Joystick *joystick, Uint8 red
|
|||||||
* \param data The data to send to the joystick
|
* \param data The data to send to the joystick
|
||||||
* \param size The size of the data to send to the joystick
|
* \param size The size of the data to send to the joystick
|
||||||
* \returns 0, or -1 if this joystick or driver doesn't support effect packets
|
* \returns 0, or -1 if this joystick or driver doesn't support effect packets
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.16.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC int SDLCALL SDL_JoystickSendEffect(SDL_Joystick *joystick, const void *data, int size);
|
extern DECLSPEC int SDLCALL SDL_JoystickSendEffect(SDL_Joystick *joystick, const void *data, int size);
|
||||||
|
|
||||||
@@ -795,6 +918,8 @@ extern DECLSPEC int SDLCALL SDL_JoystickSendEffect(SDL_Joystick *joystick, const
|
|||||||
*
|
*
|
||||||
* \param joystick The joystick device to close
|
* \param joystick The joystick device to close
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_JoystickOpen
|
* \sa SDL_JoystickOpen
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC void SDLCALL SDL_JoystickClose(SDL_Joystick *joystick);
|
extern DECLSPEC void SDLCALL SDL_JoystickClose(SDL_Joystick *joystick);
|
||||||
|
|||||||
+23
-1
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
Simple DirectMedia Layer
|
Simple DirectMedia Layer
|
||||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
||||||
|
|
||||||
This software is provided 'as-is', without any express or implied
|
This software is provided 'as-is', without any express or implied
|
||||||
warranty. In no event will the authors be held liable for any damages
|
warranty. In no event will the authors be held liable for any damages
|
||||||
@@ -58,6 +58,8 @@ typedef struct SDL_Keysym
|
|||||||
* Query the window which currently has keyboard focus.
|
* Query the window which currently has keyboard focus.
|
||||||
*
|
*
|
||||||
* \returns the window with keyboard focus.
|
* \returns the window with keyboard focus.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC SDL_Window * SDLCALL SDL_GetKeyboardFocus(void);
|
extern DECLSPEC SDL_Window * SDLCALL SDL_GetKeyboardFocus(void);
|
||||||
|
|
||||||
@@ -85,6 +87,8 @@ extern DECLSPEC SDL_Window * SDLCALL SDL_GetKeyboardFocus(void);
|
|||||||
* \param numkeys if non-NULL, receives the length of the returned array
|
* \param numkeys if non-NULL, receives the length of the returned array
|
||||||
* \returns a pointer to an array of key states.
|
* \returns a pointer to an array of key states.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_PumpEvents
|
* \sa SDL_PumpEvents
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC const Uint8 *SDLCALL SDL_GetKeyboardState(int *numkeys);
|
extern DECLSPEC const Uint8 *SDLCALL SDL_GetKeyboardState(int *numkeys);
|
||||||
@@ -95,6 +99,8 @@ extern DECLSPEC const Uint8 *SDLCALL SDL_GetKeyboardState(int *numkeys);
|
|||||||
* \returns an OR'd combination of the modifier keys for the keyboard. See
|
* \returns an OR'd combination of the modifier keys for the keyboard. See
|
||||||
* SDL_Keymod for details.
|
* SDL_Keymod for details.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_GetKeyboardState
|
* \sa SDL_GetKeyboardState
|
||||||
* \sa SDL_SetModState
|
* \sa SDL_SetModState
|
||||||
*/
|
*/
|
||||||
@@ -113,6 +119,8 @@ extern DECLSPEC SDL_Keymod SDLCALL SDL_GetModState(void);
|
|||||||
*
|
*
|
||||||
* \param modstate the desired SDL_Keymod for the keyboard
|
* \param modstate the desired SDL_Keymod for the keyboard
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_GetModState
|
* \sa SDL_GetModState
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC void SDLCALL SDL_SetModState(SDL_Keymod modstate);
|
extern DECLSPEC void SDLCALL SDL_SetModState(SDL_Keymod modstate);
|
||||||
@@ -126,6 +134,8 @@ extern DECLSPEC void SDLCALL SDL_SetModState(SDL_Keymod modstate);
|
|||||||
* \param scancode the desired SDL_Scancode to query
|
* \param scancode the desired SDL_Scancode to query
|
||||||
* \returns the SDL_Keycode that corresponds to the given SDL_Scancode.
|
* \returns the SDL_Keycode that corresponds to the given SDL_Scancode.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_GetKeyName
|
* \sa SDL_GetKeyName
|
||||||
* \sa SDL_GetScancodeFromKey
|
* \sa SDL_GetScancodeFromKey
|
||||||
*/
|
*/
|
||||||
@@ -140,6 +150,8 @@ extern DECLSPEC SDL_Keycode SDLCALL SDL_GetKeyFromScancode(SDL_Scancode scancode
|
|||||||
* \param key the desired SDL_Keycode to query
|
* \param key the desired SDL_Keycode to query
|
||||||
* \returns the SDL_Scancode that corresponds to the given SDL_Keycode.
|
* \returns the SDL_Scancode that corresponds to the given SDL_Keycode.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_GetKeyFromScancode
|
* \sa SDL_GetKeyFromScancode
|
||||||
* \sa SDL_GetScancodeName
|
* \sa SDL_GetScancodeName
|
||||||
*/
|
*/
|
||||||
@@ -196,6 +208,8 @@ extern DECLSPEC SDL_Scancode SDLCALL SDL_GetScancodeFromName(const char *name);
|
|||||||
* must copy it. If the key doesn't have a name, this function
|
* must copy it. If the key doesn't have a name, this function
|
||||||
* returns an empty string ("").
|
* returns an empty string ("").
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_GetKeyFromName
|
* \sa SDL_GetKeyFromName
|
||||||
* \sa SDL_GetKeyFromScancode
|
* \sa SDL_GetKeyFromScancode
|
||||||
* \sa SDL_GetScancodeFromKey
|
* \sa SDL_GetScancodeFromKey
|
||||||
@@ -209,6 +223,8 @@ extern DECLSPEC const char *SDLCALL SDL_GetKeyName(SDL_Keycode key);
|
|||||||
* \returns key code, or `SDLK_UNKNOWN` if the name wasn't recognized; call
|
* \returns key code, or `SDLK_UNKNOWN` if the name wasn't recognized; call
|
||||||
* SDL_GetError() for more information.
|
* SDL_GetError() for more information.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_GetKeyFromScancode
|
* \sa SDL_GetKeyFromScancode
|
||||||
* \sa SDL_GetKeyName
|
* \sa SDL_GetKeyName
|
||||||
* \sa SDL_GetScancodeFromName
|
* \sa SDL_GetScancodeFromName
|
||||||
@@ -225,6 +241,8 @@ extern DECLSPEC SDL_Keycode SDLCALL SDL_GetKeyFromName(const char *name);
|
|||||||
*
|
*
|
||||||
* On some platforms using this function activates the screen keyboard.
|
* On some platforms using this function activates the screen keyboard.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_SetTextInputRect
|
* \sa SDL_SetTextInputRect
|
||||||
* \sa SDL_StopTextInput
|
* \sa SDL_StopTextInput
|
||||||
*/
|
*/
|
||||||
@@ -244,6 +262,8 @@ extern DECLSPEC SDL_bool SDLCALL SDL_IsTextInputActive(void);
|
|||||||
/**
|
/**
|
||||||
* Stop receiving any text input events.
|
* Stop receiving any text input events.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_StartTextInput
|
* \sa SDL_StartTextInput
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC void SDLCALL SDL_StopTextInput(void);
|
extern DECLSPEC void SDLCALL SDL_StopTextInput(void);
|
||||||
@@ -254,6 +274,8 @@ extern DECLSPEC void SDLCALL SDL_StopTextInput(void);
|
|||||||
* \param rect the SDL_Rect structure representing the rectangle to receive
|
* \param rect the SDL_Rect structure representing the rectangle to receive
|
||||||
* text (ignored if NULL)
|
* text (ignored if NULL)
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_StartTextInput
|
* \sa SDL_StartTextInput
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC void SDLCALL SDL_SetTextInputRect(SDL_Rect *rect);
|
extern DECLSPEC void SDLCALL SDL_SetTextInputRect(SDL_Rect *rect);
|
||||||
|
|||||||
+5
-3
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
Simple DirectMedia Layer
|
Simple DirectMedia Layer
|
||||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
||||||
|
|
||||||
This software is provided 'as-is', without any express or implied
|
This software is provided 'as-is', without any express or implied
|
||||||
warranty. In no event will the authors be held liable for any damages
|
warranty. In no event will the authors be held liable for any damages
|
||||||
@@ -338,12 +338,14 @@ typedef enum
|
|||||||
KMOD_NUM = 0x1000,
|
KMOD_NUM = 0x1000,
|
||||||
KMOD_CAPS = 0x2000,
|
KMOD_CAPS = 0x2000,
|
||||||
KMOD_MODE = 0x4000,
|
KMOD_MODE = 0x4000,
|
||||||
KMOD_RESERVED = 0x8000,
|
KMOD_SCROLL = 0x8000,
|
||||||
|
|
||||||
KMOD_CTRL = KMOD_LCTRL | KMOD_RCTRL,
|
KMOD_CTRL = KMOD_LCTRL | KMOD_RCTRL,
|
||||||
KMOD_SHIFT = KMOD_LSHIFT | KMOD_RSHIFT,
|
KMOD_SHIFT = KMOD_LSHIFT | KMOD_RSHIFT,
|
||||||
KMOD_ALT = KMOD_LALT | KMOD_RALT,
|
KMOD_ALT = KMOD_LALT | KMOD_RALT,
|
||||||
KMOD_GUI = KMOD_LGUI | KMOD_RGUI
|
KMOD_GUI = KMOD_LGUI | KMOD_RGUI,
|
||||||
|
|
||||||
|
KMOD_RESERVED = KMOD_SCROLL /* This is for source-level compatibility with SDL 2.0.0. */
|
||||||
} SDL_Keymod;
|
} SDL_Keymod;
|
||||||
|
|
||||||
#endif /* SDL_keycode_h_ */
|
#endif /* SDL_keycode_h_ */
|
||||||
|
|||||||
+7
-1
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
Simple DirectMedia Layer
|
Simple DirectMedia Layer
|
||||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
||||||
|
|
||||||
This software is provided 'as-is', without any express or implied
|
This software is provided 'as-is', without any express or implied
|
||||||
warranty. In no event will the authors be held liable for any damages
|
warranty. In no event will the authors be held liable for any damages
|
||||||
@@ -57,6 +57,8 @@ extern "C" {
|
|||||||
* \returns an opaque pointer to the object handle or NULL if there was an
|
* \returns an opaque pointer to the object handle or NULL if there was an
|
||||||
* error; call SDL_GetError() for more information.
|
* error; call SDL_GetError() for more information.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_LoadFunction
|
* \sa SDL_LoadFunction
|
||||||
* \sa SDL_UnloadObject
|
* \sa SDL_UnloadObject
|
||||||
*/
|
*/
|
||||||
@@ -82,6 +84,8 @@ extern DECLSPEC void *SDLCALL SDL_LoadObject(const char *sofile);
|
|||||||
* \returns a pointer to the function or NULL if there was an error; call
|
* \returns a pointer to the function or NULL if there was an error; call
|
||||||
* SDL_GetError() for more information.
|
* SDL_GetError() for more information.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_LoadObject
|
* \sa SDL_LoadObject
|
||||||
* \sa SDL_UnloadObject
|
* \sa SDL_UnloadObject
|
||||||
*/
|
*/
|
||||||
@@ -93,6 +97,8 @@ extern DECLSPEC void *SDLCALL SDL_LoadFunction(void *handle,
|
|||||||
*
|
*
|
||||||
* \param handle a valid shared object handle returned by SDL_LoadObject()
|
* \param handle a valid shared object handle returned by SDL_LoadObject()
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_LoadFunction
|
* \sa SDL_LoadFunction
|
||||||
* \sa SDL_LoadObject
|
* \sa SDL_LoadObject
|
||||||
*/
|
*/
|
||||||
|
|||||||
+3
-1
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
Simple DirectMedia Layer
|
Simple DirectMedia Layer
|
||||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
||||||
|
|
||||||
This software is provided 'as-is', without any express or implied
|
This software is provided 'as-is', without any express or implied
|
||||||
warranty. In no event will the authors be held liable for any damages
|
warranty. In no event will the authors be held liable for any damages
|
||||||
@@ -85,6 +85,8 @@ typedef struct SDL_Locale
|
|||||||
*
|
*
|
||||||
* \return array of locales, terminated with a locale with a NULL language
|
* \return array of locales, terminated with a locale with a NULL language
|
||||||
* field. Will return NULL on error.
|
* field. Will return NULL on error.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.14.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC SDL_Locale * SDLCALL SDL_GetPreferredLocales(void);
|
extern DECLSPEC SDL_Locale * SDLCALL SDL_GetPreferredLocales(void);
|
||||||
|
|
||||||
|
|||||||
+29
-1
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
Simple DirectMedia Layer
|
Simple DirectMedia Layer
|
||||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
||||||
|
|
||||||
This software is provided 'as-is', without any express or implied
|
This software is provided 'as-is', without any express or implied
|
||||||
warranty. In no event will the authors be held liable for any damages
|
warranty. In no event will the authors be held liable for any damages
|
||||||
@@ -116,6 +116,8 @@ typedef enum
|
|||||||
*
|
*
|
||||||
* \param priority the SDL_LogPriority to assign
|
* \param priority the SDL_LogPriority to assign
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_LogSetPriority
|
* \sa SDL_LogSetPriority
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC void SDLCALL SDL_LogSetAllPriority(SDL_LogPriority priority);
|
extern DECLSPEC void SDLCALL SDL_LogSetAllPriority(SDL_LogPriority priority);
|
||||||
@@ -126,6 +128,8 @@ extern DECLSPEC void SDLCALL SDL_LogSetAllPriority(SDL_LogPriority priority);
|
|||||||
* \param category the category to assign a priority to
|
* \param category the category to assign a priority to
|
||||||
* \param priority the SDL_LogPriority to assign
|
* \param priority the SDL_LogPriority to assign
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_LogGetPriority
|
* \sa SDL_LogGetPriority
|
||||||
* \sa SDL_LogSetAllPriority
|
* \sa SDL_LogSetAllPriority
|
||||||
*/
|
*/
|
||||||
@@ -138,6 +142,8 @@ extern DECLSPEC void SDLCALL SDL_LogSetPriority(int category,
|
|||||||
* \param category the category to query
|
* \param category the category to query
|
||||||
* \returns the SDL_LogPriority for the requested category
|
* \returns the SDL_LogPriority for the requested category
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_LogSetPriority
|
* \sa SDL_LogSetPriority
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC SDL_LogPriority SDLCALL SDL_LogGetPriority(int category);
|
extern DECLSPEC SDL_LogPriority SDLCALL SDL_LogGetPriority(int category);
|
||||||
@@ -147,6 +153,8 @@ extern DECLSPEC SDL_LogPriority SDLCALL SDL_LogGetPriority(int category);
|
|||||||
*
|
*
|
||||||
* This is called by SDL_Quit().
|
* This is called by SDL_Quit().
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_LogSetAllPriority
|
* \sa SDL_LogSetAllPriority
|
||||||
* \sa SDL_LogSetPriority
|
* \sa SDL_LogSetPriority
|
||||||
*/
|
*/
|
||||||
@@ -160,6 +168,8 @@ extern DECLSPEC void SDLCALL SDL_LogResetPriorities(void);
|
|||||||
* \param ... additional parameters matching % tokens in the `fmt` string, if
|
* \param ... additional parameters matching % tokens in the `fmt` string, if
|
||||||
* any
|
* any
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_LogCritical
|
* \sa SDL_LogCritical
|
||||||
* \sa SDL_LogDebug
|
* \sa SDL_LogDebug
|
||||||
* \sa SDL_LogError
|
* \sa SDL_LogError
|
||||||
@@ -179,6 +189,8 @@ extern DECLSPEC void SDLCALL SDL_Log(SDL_PRINTF_FORMAT_STRING const char *fmt, .
|
|||||||
* \param ... additional parameters matching % tokens in the **fmt** string,
|
* \param ... additional parameters matching % tokens in the **fmt** string,
|
||||||
* if any
|
* if any
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_Log
|
* \sa SDL_Log
|
||||||
* \sa SDL_LogCritical
|
* \sa SDL_LogCritical
|
||||||
* \sa SDL_LogDebug
|
* \sa SDL_LogDebug
|
||||||
@@ -198,6 +210,8 @@ extern DECLSPEC void SDLCALL SDL_LogVerbose(int category, SDL_PRINTF_FORMAT_STRI
|
|||||||
* \param ... additional parameters matching % tokens in the **fmt** string,
|
* \param ... additional parameters matching % tokens in the **fmt** string,
|
||||||
* if any
|
* if any
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_Log
|
* \sa SDL_Log
|
||||||
* \sa SDL_LogCritical
|
* \sa SDL_LogCritical
|
||||||
* \sa SDL_LogError
|
* \sa SDL_LogError
|
||||||
@@ -217,6 +231,8 @@ extern DECLSPEC void SDLCALL SDL_LogDebug(int category, SDL_PRINTF_FORMAT_STRING
|
|||||||
* \param ... additional parameters matching % tokens in the **fmt** string,
|
* \param ... additional parameters matching % tokens in the **fmt** string,
|
||||||
* if any
|
* if any
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_Log
|
* \sa SDL_Log
|
||||||
* \sa SDL_LogCritical
|
* \sa SDL_LogCritical
|
||||||
* \sa SDL_LogDebug
|
* \sa SDL_LogDebug
|
||||||
@@ -236,6 +252,8 @@ extern DECLSPEC void SDLCALL SDL_LogInfo(int category, SDL_PRINTF_FORMAT_STRING
|
|||||||
* \param ... additional parameters matching % tokens in the **fmt** string,
|
* \param ... additional parameters matching % tokens in the **fmt** string,
|
||||||
* if any
|
* if any
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_Log
|
* \sa SDL_Log
|
||||||
* \sa SDL_LogCritical
|
* \sa SDL_LogCritical
|
||||||
* \sa SDL_LogDebug
|
* \sa SDL_LogDebug
|
||||||
@@ -255,6 +273,8 @@ extern DECLSPEC void SDLCALL SDL_LogWarn(int category, SDL_PRINTF_FORMAT_STRING
|
|||||||
* \param ... additional parameters matching % tokens in the **fmt** string,
|
* \param ... additional parameters matching % tokens in the **fmt** string,
|
||||||
* if any
|
* if any
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_Log
|
* \sa SDL_Log
|
||||||
* \sa SDL_LogCritical
|
* \sa SDL_LogCritical
|
||||||
* \sa SDL_LogDebug
|
* \sa SDL_LogDebug
|
||||||
@@ -274,6 +294,8 @@ extern DECLSPEC void SDLCALL SDL_LogError(int category, SDL_PRINTF_FORMAT_STRING
|
|||||||
* \param ... additional parameters matching % tokens in the **fmt** string,
|
* \param ... additional parameters matching % tokens in the **fmt** string,
|
||||||
* if any
|
* if any
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_Log
|
* \sa SDL_Log
|
||||||
* \sa SDL_LogDebug
|
* \sa SDL_LogDebug
|
||||||
* \sa SDL_LogError
|
* \sa SDL_LogError
|
||||||
@@ -294,6 +316,8 @@ extern DECLSPEC void SDLCALL SDL_LogCritical(int category, SDL_PRINTF_FORMAT_STR
|
|||||||
* \param ... additional parameters matching % tokens in the **fmt** string,
|
* \param ... additional parameters matching % tokens in the **fmt** string,
|
||||||
* if any
|
* if any
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_Log
|
* \sa SDL_Log
|
||||||
* \sa SDL_LogCritical
|
* \sa SDL_LogCritical
|
||||||
* \sa SDL_LogDebug
|
* \sa SDL_LogDebug
|
||||||
@@ -350,6 +374,8 @@ typedef void (SDLCALL *SDL_LogOutputFunction)(void *userdata, int category, SDL_
|
|||||||
* \param userdata a pointer filled in with the pointer that is passed to
|
* \param userdata a pointer filled in with the pointer that is passed to
|
||||||
* `callback`
|
* `callback`
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_LogSetOutputFunction
|
* \sa SDL_LogSetOutputFunction
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC void SDLCALL SDL_LogGetOutputFunction(SDL_LogOutputFunction *callback, void **userdata);
|
extern DECLSPEC void SDLCALL SDL_LogGetOutputFunction(SDL_LogOutputFunction *callback, void **userdata);
|
||||||
@@ -360,6 +386,8 @@ extern DECLSPEC void SDLCALL SDL_LogGetOutputFunction(SDL_LogOutputFunction *cal
|
|||||||
* \param callback an SDL_LogOutputFunction to call instead of the default
|
* \param callback an SDL_LogOutputFunction to call instead of the default
|
||||||
* \param userdata a pointer that is passed to `callback`
|
* \param userdata a pointer that is passed to `callback`
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_LogGetOutputFunction
|
* \sa SDL_LogGetOutputFunction
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC void SDLCALL SDL_LogSetOutputFunction(SDL_LogOutputFunction callback, void *userdata);
|
extern DECLSPEC void SDLCALL SDL_LogSetOutputFunction(SDL_LogOutputFunction callback, void *userdata);
|
||||||
|
|||||||
+52
-3
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
Simple DirectMedia Layer
|
Simple DirectMedia Layer
|
||||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
||||||
|
|
||||||
This software is provided 'as-is', without any express or implied
|
This software is provided 'as-is', without any express or implied
|
||||||
warranty. In no event will the authors be held liable for any damages
|
warranty. In no event will the authors be held liable for any damages
|
||||||
@@ -83,6 +83,15 @@
|
|||||||
*/
|
*/
|
||||||
#define SDL_MAIN_NEEDED
|
#define SDL_MAIN_NEEDED
|
||||||
|
|
||||||
|
#elif defined(__PSP__)
|
||||||
|
/* On PSP SDL provides a main function that sets the module info,
|
||||||
|
activates the GPU and starts the thread required to be able to exit
|
||||||
|
the software.
|
||||||
|
|
||||||
|
If you provide this yourself, you may define SDL_MAIN_HANDLED
|
||||||
|
*/
|
||||||
|
#define SDL_MAIN_AVAILABLE
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
#endif /* SDL_MAIN_HANDLED */
|
#endif /* SDL_MAIN_HANDLED */
|
||||||
|
|
||||||
@@ -130,6 +139,8 @@ extern SDLMAIN_DECLSPEC int SDL_main(int argc, char *argv[]);
|
|||||||
* will not be changed it is necessary to define SDL_MAIN_HANDLED before
|
* will not be changed it is necessary to define SDL_MAIN_HANDLED before
|
||||||
* including SDL.h.
|
* including SDL.h.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_Init
|
* \sa SDL_Init
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC void SDLCALL SDL_SetMainReady(void);
|
extern DECLSPEC void SDLCALL SDL_SetMainReady(void);
|
||||||
@@ -137,9 +148,45 @@ extern DECLSPEC void SDLCALL SDL_SetMainReady(void);
|
|||||||
#ifdef __WIN32__
|
#ifdef __WIN32__
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This can be called to set the application class at startup
|
* Register a win32 window class for SDL's use.
|
||||||
|
*
|
||||||
|
* This can be called to set the application window class at startup. It is
|
||||||
|
* safe to call this multiple times, as long as every call is eventually
|
||||||
|
* paired with a call to SDL_UnregisterApp, but a second registration attempt
|
||||||
|
* while a previous registration is still active will be ignored, other than
|
||||||
|
* to increment a counter.
|
||||||
|
*
|
||||||
|
* Most applications do not need to, and should not, call this directly; SDL
|
||||||
|
* will call it when initializing the video subsystem.
|
||||||
|
*
|
||||||
|
* \param name the window class name, in UTF-8 encoding. If NULL, SDL
|
||||||
|
* currently uses "SDL_app" but this isn't guaranteed.
|
||||||
|
* \param style the value to use in WNDCLASSEX::style. If `name` is NULL, SDL
|
||||||
|
* currently uses `(CS_BYTEALIGNCLIENT | CS_OWNDC)` regardless of
|
||||||
|
* what is specified here.
|
||||||
|
* \param hInst the HINSTANCE to use in WNDCLASSEX::hInstance. If zero, SDL
|
||||||
|
* will use `GetModuleHandle(NULL)` instead.
|
||||||
|
* \returns 0 on success, -1 on error. SDL_GetError() may have details.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.2.
|
||||||
|
*/
|
||||||
|
extern DECLSPEC int SDLCALL SDL_RegisterApp(const char *name, Uint32 style, void *hInst);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Deregister the win32 window class from an SDL_RegisterApp call.
|
||||||
|
*
|
||||||
|
* This can be called to undo the effects of SDL_RegisterApp.
|
||||||
|
*
|
||||||
|
* Most applications do not need to, and should not, call this directly; SDL
|
||||||
|
* will call it when deinitializing the video subsystem.
|
||||||
|
*
|
||||||
|
* It is safe to call this multiple times, as long as every call is eventually
|
||||||
|
* paired with a prior call to SDL_RegisterApp. The window class will only be
|
||||||
|
* deregistered when the registration counter in SDL_RegisterApp decrements to
|
||||||
|
* zero through calls to this function.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.2.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC int SDLCALL SDL_RegisterApp(char *name, Uint32 style, void *hInst);
|
|
||||||
extern DECLSPEC void SDLCALL SDL_UnregisterApp(void);
|
extern DECLSPEC void SDLCALL SDL_UnregisterApp(void);
|
||||||
|
|
||||||
#endif /* __WIN32__ */
|
#endif /* __WIN32__ */
|
||||||
@@ -170,6 +217,8 @@ extern DECLSPEC int SDLCALL SDL_WinRTRunApp(SDL_main_func mainFunction, void * r
|
|||||||
* \param argv The argv parameter from the application's main() function
|
* \param argv The argv parameter from the application's main() function
|
||||||
* \param mainFunction The SDL app's C-style main(), an SDL_main_func
|
* \param mainFunction The SDL app's C-style main(), an SDL_main_func
|
||||||
* \return the return value from mainFunction
|
* \return the return value from mainFunction
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.10.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC int SDLCALL SDL_UIKitRunApp(int argc, char *argv[], SDL_main_func mainFunction);
|
extern DECLSPEC int SDLCALL SDL_UIKitRunApp(int argc, char *argv[], SDL_main_func mainFunction);
|
||||||
|
|
||||||
|
|||||||
+3
-1
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
Simple DirectMedia Layer
|
Simple DirectMedia Layer
|
||||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
||||||
|
|
||||||
This software is provided 'as-is', without any express or implied
|
This software is provided 'as-is', without any express or implied
|
||||||
warranty. In no event will the authors be held liable for any damages
|
warranty. In no event will the authors be held liable for any damages
|
||||||
@@ -175,6 +175,8 @@ extern DECLSPEC int SDLCALL SDL_ShowMessageBox(const SDL_MessageBoxData *message
|
|||||||
* \returns 0 on success or a negative error code on failure; call
|
* \returns 0 on success or a negative error code on failure; call
|
||||||
* SDL_GetError() for more information.
|
* SDL_GetError() for more information.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_ShowMessageBox
|
* \sa SDL_ShowMessageBox
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC int SDLCALL SDL_ShowSimpleMessageBox(Uint32 flags, const char *title, const char *message, SDL_Window *window);
|
extern DECLSPEC int SDLCALL SDL_ShowSimpleMessageBox(Uint32 flags, const char *title, const char *message, SDL_Window *window);
|
||||||
|
|||||||
+9
-1
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
Simple DirectMedia Layer
|
Simple DirectMedia Layer
|
||||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
||||||
|
|
||||||
This software is provided 'as-is', without any express or implied
|
This software is provided 'as-is', without any express or implied
|
||||||
warranty. In no event will the authors be held liable for any damages
|
warranty. In no event will the authors be held liable for any damages
|
||||||
@@ -58,6 +58,8 @@ typedef void *SDL_MetalView;
|
|||||||
* The returned handle can be casted directly to a NSView or UIView. To access
|
* The returned handle can be casted directly to a NSView or UIView. To access
|
||||||
* the backing CAMetalLayer, call SDL_Metal_GetLayer().
|
* the backing CAMetalLayer, call SDL_Metal_GetLayer().
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.12.
|
||||||
|
*
|
||||||
* \sa SDL_Metal_DestroyView
|
* \sa SDL_Metal_DestroyView
|
||||||
* \sa SDL_Metal_GetLayer
|
* \sa SDL_Metal_GetLayer
|
||||||
*/
|
*/
|
||||||
@@ -69,6 +71,8 @@ extern DECLSPEC SDL_MetalView SDLCALL SDL_Metal_CreateView(SDL_Window * window);
|
|||||||
* This should be called before SDL_DestroyWindow, if SDL_Metal_CreateView was
|
* This should be called before SDL_DestroyWindow, if SDL_Metal_CreateView was
|
||||||
* called after SDL_CreateWindow.
|
* called after SDL_CreateWindow.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.12.
|
||||||
|
*
|
||||||
* \sa SDL_Metal_CreateView
|
* \sa SDL_Metal_CreateView
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC void SDLCALL SDL_Metal_DestroyView(SDL_MetalView view);
|
extern DECLSPEC void SDLCALL SDL_Metal_DestroyView(SDL_MetalView view);
|
||||||
@@ -76,6 +80,8 @@ extern DECLSPEC void SDLCALL SDL_Metal_DestroyView(SDL_MetalView view);
|
|||||||
/**
|
/**
|
||||||
* Get a pointer to the backing CAMetalLayer for the given view.
|
* Get a pointer to the backing CAMetalLayer for the given view.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.14.
|
||||||
|
*
|
||||||
* \sa SDL_MetalCreateView
|
* \sa SDL_MetalCreateView
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC void *SDLCALL SDL_Metal_GetLayer(SDL_MetalView view);
|
extern DECLSPEC void *SDLCALL SDL_Metal_GetLayer(SDL_MetalView view);
|
||||||
@@ -87,6 +93,8 @@ extern DECLSPEC void *SDLCALL SDL_Metal_GetLayer(SDL_MetalView view);
|
|||||||
* \param window SDL_Window from which the drawable size should be queried
|
* \param window SDL_Window from which the drawable size should be queried
|
||||||
* \param w Pointer to variable for storing the width in pixels, may be NULL
|
* \param w Pointer to variable for storing the width in pixels, may be NULL
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.14.
|
||||||
|
*
|
||||||
* \sa SDL_GetWindowSize
|
* \sa SDL_GetWindowSize
|
||||||
* \sa SDL_CreateWindow
|
* \sa SDL_CreateWindow
|
||||||
*/
|
*/
|
||||||
|
|||||||
+2
-2
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
Simple DirectMedia Layer
|
Simple DirectMedia Layer
|
||||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
||||||
|
|
||||||
This software is provided 'as-is', without any express or implied
|
This software is provided 'as-is', without any express or implied
|
||||||
warranty. In no event will the authors be held liable for any damages
|
warranty. In no event will the authors be held liable for any damages
|
||||||
@@ -64,7 +64,7 @@ extern "C" {
|
|||||||
* \returns 0 on success, or -1 on error; call SDL_GetError() for more
|
* \returns 0 on success, or -1 on error; call SDL_GetError() for more
|
||||||
* information.
|
* information.
|
||||||
*
|
*
|
||||||
* \since This function is available in SDL 2.0.14 and newer
|
* \since This function is available since SDL 2.0.14.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC int SDLCALL SDL_OpenURL(const char *url);
|
extern DECLSPEC int SDLCALL SDL_OpenURL(const char *url);
|
||||||
|
|
||||||
|
|||||||
+23
-1
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
Simple DirectMedia Layer
|
Simple DirectMedia Layer
|
||||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
||||||
|
|
||||||
This software is provided 'as-is', without any express or implied
|
This software is provided 'as-is', without any express or implied
|
||||||
warranty. In no event will the authors be held liable for any damages
|
warranty. In no event will the authors be held liable for any damages
|
||||||
@@ -75,6 +75,8 @@ typedef enum
|
|||||||
* Get the window which currently has mouse focus.
|
* Get the window which currently has mouse focus.
|
||||||
*
|
*
|
||||||
* \returns the window with mouse focus.
|
* \returns the window with mouse focus.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC SDL_Window * SDLCALL SDL_GetMouseFocus(void);
|
extern DECLSPEC SDL_Window * SDLCALL SDL_GetMouseFocus(void);
|
||||||
|
|
||||||
@@ -93,6 +95,8 @@ extern DECLSPEC SDL_Window * SDLCALL SDL_GetMouseFocus(void);
|
|||||||
* focus window
|
* focus window
|
||||||
* \returns a 32-bit button bitmask of the current button state.
|
* \returns a 32-bit button bitmask of the current button state.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_GetGlobalMouseState
|
* \sa SDL_GetGlobalMouseState
|
||||||
* \sa SDL_GetRelativeMouseState
|
* \sa SDL_GetRelativeMouseState
|
||||||
* \sa SDL_PumpEvents
|
* \sa SDL_PumpEvents
|
||||||
@@ -141,6 +145,8 @@ extern DECLSPEC Uint32 SDLCALL SDL_GetGlobalMouseState(int *x, int *y);
|
|||||||
* \param y a pointer filled with the last recorded y coordinate of the mouse
|
* \param y a pointer filled with the last recorded y coordinate of the mouse
|
||||||
* \returns a 32-bit button bitmask of the relative button state.
|
* \returns a 32-bit button bitmask of the relative button state.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_GetMouseState
|
* \sa SDL_GetMouseState
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC Uint32 SDLCALL SDL_GetRelativeMouseState(int *x, int *y);
|
extern DECLSPEC Uint32 SDLCALL SDL_GetRelativeMouseState(int *x, int *y);
|
||||||
@@ -158,6 +164,8 @@ extern DECLSPEC Uint32 SDLCALL SDL_GetRelativeMouseState(int *x, int *y);
|
|||||||
* \param x the x coordinate within the window
|
* \param x the x coordinate within the window
|
||||||
* \param y the y coordinate within the window
|
* \param y the y coordinate within the window
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_WarpMouseGlobal
|
* \sa SDL_WarpMouseGlobal
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC void SDLCALL SDL_WarpMouseInWindow(SDL_Window * window,
|
extern DECLSPEC void SDLCALL SDL_WarpMouseInWindow(SDL_Window * window,
|
||||||
@@ -204,6 +212,8 @@ extern DECLSPEC int SDLCALL SDL_WarpMouseGlobal(int x, int y);
|
|||||||
*
|
*
|
||||||
* If relative mode is not supported, this returns -1.
|
* If relative mode is not supported, this returns -1.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_GetRelativeMouseMode
|
* \sa SDL_GetRelativeMouseMode
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC int SDLCALL SDL_SetRelativeMouseMode(SDL_bool enabled);
|
extern DECLSPEC int SDLCALL SDL_SetRelativeMouseMode(SDL_bool enabled);
|
||||||
@@ -250,6 +260,8 @@ extern DECLSPEC int SDLCALL SDL_CaptureMouse(SDL_bool enabled);
|
|||||||
*
|
*
|
||||||
* \returns SDL_TRUE if relative mode is enabled or SDL_FALSE otherwise.
|
* \returns SDL_TRUE if relative mode is enabled or SDL_FALSE otherwise.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_SetRelativeMouseMode
|
* \sa SDL_SetRelativeMouseMode
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC SDL_bool SDLCALL SDL_GetRelativeMouseMode(void);
|
extern DECLSPEC SDL_bool SDLCALL SDL_GetRelativeMouseMode(void);
|
||||||
@@ -289,6 +301,8 @@ extern DECLSPEC SDL_bool SDLCALL SDL_GetRelativeMouseMode(void);
|
|||||||
* \returns a new cursor with the specified parameters on success or NULL on
|
* \returns a new cursor with the specified parameters on success or NULL on
|
||||||
* failure; call SDL_GetError() for more information.
|
* failure; call SDL_GetError() for more information.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_FreeCursor
|
* \sa SDL_FreeCursor
|
||||||
* \sa SDL_SetCursor
|
* \sa SDL_SetCursor
|
||||||
* \sa SDL_ShowCursor
|
* \sa SDL_ShowCursor
|
||||||
@@ -339,6 +353,8 @@ extern DECLSPEC SDL_Cursor *SDLCALL SDL_CreateSystemCursor(SDL_SystemCursor id);
|
|||||||
*
|
*
|
||||||
* \param cursor a cursor to make active
|
* \param cursor a cursor to make active
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_CreateCursor
|
* \sa SDL_CreateCursor
|
||||||
* \sa SDL_GetCursor
|
* \sa SDL_GetCursor
|
||||||
* \sa SDL_ShowCursor
|
* \sa SDL_ShowCursor
|
||||||
@@ -353,6 +369,8 @@ extern DECLSPEC void SDLCALL SDL_SetCursor(SDL_Cursor * cursor);
|
|||||||
*
|
*
|
||||||
* \returns the active cursor or NULL if there is no mouse.
|
* \returns the active cursor or NULL if there is no mouse.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_SetCursor
|
* \sa SDL_SetCursor
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC SDL_Cursor *SDLCALL SDL_GetCursor(void);
|
extern DECLSPEC SDL_Cursor *SDLCALL SDL_GetCursor(void);
|
||||||
@@ -376,6 +394,8 @@ extern DECLSPEC SDL_Cursor *SDLCALL SDL_GetDefaultCursor(void);
|
|||||||
*
|
*
|
||||||
* \param cursor the cursor to free
|
* \param cursor the cursor to free
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_CreateColorCursor
|
* \sa SDL_CreateColorCursor
|
||||||
* \sa SDL_CreateCursor
|
* \sa SDL_CreateCursor
|
||||||
* \sa SDL_CreateSystemCursor
|
* \sa SDL_CreateSystemCursor
|
||||||
@@ -397,6 +417,8 @@ extern DECLSPEC void SDLCALL SDL_FreeCursor(SDL_Cursor * cursor);
|
|||||||
* cursor is hidden, or a negative error code on failure; call
|
* cursor is hidden, or a negative error code on failure; call
|
||||||
* SDL_GetError() for more information.
|
* SDL_GetError() for more information.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_CreateCursor
|
* \sa SDL_CreateCursor
|
||||||
* \sa SDL_SetCursor
|
* \sa SDL_SetCursor
|
||||||
*/
|
*/
|
||||||
|
|||||||
+37
-1
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
Simple DirectMedia Layer
|
Simple DirectMedia Layer
|
||||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
||||||
|
|
||||||
This software is provided 'as-is', without any express or implied
|
This software is provided 'as-is', without any express or implied
|
||||||
warranty. In no event will the authors be held liable for any damages
|
warranty. In no event will the authors be held liable for any damages
|
||||||
@@ -71,6 +71,8 @@ typedef struct SDL_mutex SDL_mutex;
|
|||||||
* \returns the initialized and unlocked mutex or NULL on failure; call
|
* \returns the initialized and unlocked mutex or NULL on failure; call
|
||||||
* SDL_GetError() for more information.
|
* SDL_GetError() for more information.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_DestroyMutex
|
* \sa SDL_DestroyMutex
|
||||||
* \sa SDL_LockMutex
|
* \sa SDL_LockMutex
|
||||||
* \sa SDL_TryLockMutex
|
* \sa SDL_TryLockMutex
|
||||||
@@ -91,6 +93,8 @@ extern DECLSPEC SDL_mutex *SDLCALL SDL_CreateMutex(void);
|
|||||||
*
|
*
|
||||||
* \param mutex the mutex to lock
|
* \param mutex the mutex to lock
|
||||||
* \return 0, or -1 on error.
|
* \return 0, or -1 on error.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC int SDLCALL SDL_LockMutex(SDL_mutex * mutex);
|
extern DECLSPEC int SDLCALL SDL_LockMutex(SDL_mutex * mutex);
|
||||||
#define SDL_mutexP(m) SDL_LockMutex(m)
|
#define SDL_mutexP(m) SDL_LockMutex(m)
|
||||||
@@ -108,6 +112,8 @@ extern DECLSPEC int SDLCALL SDL_LockMutex(SDL_mutex * mutex);
|
|||||||
* \returns 0, `SDL_MUTEX_TIMEDOUT`, or -1 on error; call SDL_GetError() for
|
* \returns 0, `SDL_MUTEX_TIMEDOUT`, or -1 on error; call SDL_GetError() for
|
||||||
* more information.
|
* more information.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_CreateMutex
|
* \sa SDL_CreateMutex
|
||||||
* \sa SDL_DestroyMutex
|
* \sa SDL_DestroyMutex
|
||||||
* \sa SDL_LockMutex
|
* \sa SDL_LockMutex
|
||||||
@@ -129,6 +135,8 @@ extern DECLSPEC int SDLCALL SDL_TryLockMutex(SDL_mutex * mutex);
|
|||||||
*
|
*
|
||||||
* \param mutex the mutex to unlock.
|
* \param mutex the mutex to unlock.
|
||||||
* \returns 0, or -1 on error.
|
* \returns 0, or -1 on error.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC int SDLCALL SDL_UnlockMutex(SDL_mutex * mutex);
|
extern DECLSPEC int SDLCALL SDL_UnlockMutex(SDL_mutex * mutex);
|
||||||
#define SDL_mutexV(m) SDL_UnlockMutex(m)
|
#define SDL_mutexV(m) SDL_UnlockMutex(m)
|
||||||
@@ -144,6 +152,8 @@ extern DECLSPEC int SDLCALL SDL_UnlockMutex(SDL_mutex * mutex);
|
|||||||
*
|
*
|
||||||
* \param mutex the mutex to destroy
|
* \param mutex the mutex to destroy
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_CreateMutex
|
* \sa SDL_CreateMutex
|
||||||
* \sa SDL_LockMutex
|
* \sa SDL_LockMutex
|
||||||
* \sa SDL_TryLockMutex
|
* \sa SDL_TryLockMutex
|
||||||
@@ -176,6 +186,8 @@ typedef struct SDL_semaphore SDL_sem;
|
|||||||
* \returns a new semaphore or NULL on failure; call SDL_GetError() for more
|
* \returns a new semaphore or NULL on failure; call SDL_GetError() for more
|
||||||
* information.
|
* information.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_DestroySemaphore
|
* \sa SDL_DestroySemaphore
|
||||||
* \sa SDL_SemPost
|
* \sa SDL_SemPost
|
||||||
* \sa SDL_SemTryWait
|
* \sa SDL_SemTryWait
|
||||||
@@ -193,6 +205,8 @@ extern DECLSPEC SDL_sem *SDLCALL SDL_CreateSemaphore(Uint32 initial_value);
|
|||||||
*
|
*
|
||||||
* \param sem the semaphore to destroy
|
* \param sem the semaphore to destroy
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_CreateSemaphore
|
* \sa SDL_CreateSemaphore
|
||||||
* \sa SDL_SemPost
|
* \sa SDL_SemPost
|
||||||
* \sa SDL_SemTryWait
|
* \sa SDL_SemTryWait
|
||||||
@@ -217,6 +231,8 @@ extern DECLSPEC void SDLCALL SDL_DestroySemaphore(SDL_sem * sem);
|
|||||||
* \returns 0 on success or a negative error code on failure; call
|
* \returns 0 on success or a negative error code on failure; call
|
||||||
* SDL_GetError() for more information.
|
* SDL_GetError() for more information.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_CreateSemaphore
|
* \sa SDL_CreateSemaphore
|
||||||
* \sa SDL_DestroySemaphore
|
* \sa SDL_DestroySemaphore
|
||||||
* \sa SDL_SemPost
|
* \sa SDL_SemPost
|
||||||
@@ -240,6 +256,8 @@ extern DECLSPEC int SDLCALL SDL_SemWait(SDL_sem * sem);
|
|||||||
* block, or a negative error code on failure; call SDL_GetError()
|
* block, or a negative error code on failure; call SDL_GetError()
|
||||||
* for more information.
|
* for more information.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_CreateSemaphore
|
* \sa SDL_CreateSemaphore
|
||||||
* \sa SDL_DestroySemaphore
|
* \sa SDL_DestroySemaphore
|
||||||
* \sa SDL_SemPost
|
* \sa SDL_SemPost
|
||||||
@@ -263,6 +281,8 @@ extern DECLSPEC int SDLCALL SDL_SemTryWait(SDL_sem * sem);
|
|||||||
* succeed in the allotted time, or a negative error code on failure;
|
* succeed in the allotted time, or a negative error code on failure;
|
||||||
* call SDL_GetError() for more information.
|
* call SDL_GetError() for more information.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_CreateSemaphore
|
* \sa SDL_CreateSemaphore
|
||||||
* \sa SDL_DestroySemaphore
|
* \sa SDL_DestroySemaphore
|
||||||
* \sa SDL_SemPost
|
* \sa SDL_SemPost
|
||||||
@@ -279,6 +299,8 @@ extern DECLSPEC int SDLCALL SDL_SemWaitTimeout(SDL_sem * sem, Uint32 ms);
|
|||||||
* \returns 0 on success or a negative error code on failure; call
|
* \returns 0 on success or a negative error code on failure; call
|
||||||
* SDL_GetError() for more information.
|
* SDL_GetError() for more information.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_CreateSemaphore
|
* \sa SDL_CreateSemaphore
|
||||||
* \sa SDL_DestroySemaphore
|
* \sa SDL_DestroySemaphore
|
||||||
* \sa SDL_SemTryWait
|
* \sa SDL_SemTryWait
|
||||||
@@ -294,6 +316,8 @@ extern DECLSPEC int SDLCALL SDL_SemPost(SDL_sem * sem);
|
|||||||
* \param sem the semaphore to query
|
* \param sem the semaphore to query
|
||||||
* \returns the current value of the semaphore.
|
* \returns the current value of the semaphore.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_CreateSemaphore
|
* \sa SDL_CreateSemaphore
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC Uint32 SDLCALL SDL_SemValue(SDL_sem * sem);
|
extern DECLSPEC Uint32 SDLCALL SDL_SemValue(SDL_sem * sem);
|
||||||
@@ -316,6 +340,8 @@ typedef struct SDL_cond SDL_cond;
|
|||||||
* \returns a new condition variable or NULL on failure; call SDL_GetError()
|
* \returns a new condition variable or NULL on failure; call SDL_GetError()
|
||||||
* for more information.
|
* for more information.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_CondBroadcast
|
* \sa SDL_CondBroadcast
|
||||||
* \sa SDL_CondSignal
|
* \sa SDL_CondSignal
|
||||||
* \sa SDL_CondWait
|
* \sa SDL_CondWait
|
||||||
@@ -329,6 +355,8 @@ extern DECLSPEC SDL_cond *SDLCALL SDL_CreateCond(void);
|
|||||||
*
|
*
|
||||||
* \param cond the condition variable to destroy
|
* \param cond the condition variable to destroy
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_CondBroadcast
|
* \sa SDL_CondBroadcast
|
||||||
* \sa SDL_CondSignal
|
* \sa SDL_CondSignal
|
||||||
* \sa SDL_CondWait
|
* \sa SDL_CondWait
|
||||||
@@ -344,6 +372,8 @@ extern DECLSPEC void SDLCALL SDL_DestroyCond(SDL_cond * cond);
|
|||||||
* \returns 0 on success or a negative error code on failure; call
|
* \returns 0 on success or a negative error code on failure; call
|
||||||
* SDL_GetError() for more information.
|
* SDL_GetError() for more information.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_CondBroadcast
|
* \sa SDL_CondBroadcast
|
||||||
* \sa SDL_CondWait
|
* \sa SDL_CondWait
|
||||||
* \sa SDL_CondWaitTimeout
|
* \sa SDL_CondWaitTimeout
|
||||||
@@ -359,6 +389,8 @@ extern DECLSPEC int SDLCALL SDL_CondSignal(SDL_cond * cond);
|
|||||||
* \returns 0 on success or a negative error code on failure; call
|
* \returns 0 on success or a negative error code on failure; call
|
||||||
* SDL_GetError() for more information.
|
* SDL_GetError() for more information.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_CondSignal
|
* \sa SDL_CondSignal
|
||||||
* \sa SDL_CondWait
|
* \sa SDL_CondWait
|
||||||
* \sa SDL_CondWaitTimeout
|
* \sa SDL_CondWaitTimeout
|
||||||
@@ -385,6 +417,8 @@ extern DECLSPEC int SDLCALL SDL_CondBroadcast(SDL_cond * cond);
|
|||||||
* \returns 0 when it is signaled or a negative error code on failure; call
|
* \returns 0 when it is signaled or a negative error code on failure; call
|
||||||
* SDL_GetError() for more information.
|
* SDL_GetError() for more information.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_CondBroadcast
|
* \sa SDL_CondBroadcast
|
||||||
* \sa SDL_CondSignal
|
* \sa SDL_CondSignal
|
||||||
* \sa SDL_CondWaitTimeout
|
* \sa SDL_CondWaitTimeout
|
||||||
@@ -412,6 +446,8 @@ extern DECLSPEC int SDLCALL SDL_CondWait(SDL_cond * cond, SDL_mutex * mutex);
|
|||||||
* the condition is not signaled in the allotted time, or a negative
|
* the condition is not signaled in the allotted time, or a negative
|
||||||
* error code on failure; call SDL_GetError() for more information.
|
* error code on failure; call SDL_GetError() for more information.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_CondBroadcast
|
* \sa SDL_CondBroadcast
|
||||||
* \sa SDL_CondSignal
|
* \sa SDL_CondSignal
|
||||||
* \sa SDL_CondWait
|
* \sa SDL_CondWait
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
Simple DirectMedia Layer
|
Simple DirectMedia Layer
|
||||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
||||||
|
|
||||||
This software is provided 'as-is', without any express or implied
|
This software is provided 'as-is', without any express or implied
|
||||||
warranty. In no event will the authors be held liable for any damages
|
warranty. In no event will the authors be held liable for any damages
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
Simple DirectMedia Layer
|
Simple DirectMedia Layer
|
||||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
||||||
|
|
||||||
This software is provided 'as-is', without any express or implied
|
This software is provided 'as-is', without any express or implied
|
||||||
warranty. In no event will the authors be held liable for any damages
|
warranty. In no event will the authors be held liable for any damages
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
Simple DirectMedia Layer
|
Simple DirectMedia Layer
|
||||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
||||||
|
|
||||||
This software is provided 'as-is', without any express or implied
|
This software is provided 'as-is', without any express or implied
|
||||||
warranty. In no event will the authors be held liable for any damages
|
warranty. In no event will the authors be held liable for any damages
|
||||||
|
|||||||
+2
-2
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
Simple DirectMedia Layer
|
Simple DirectMedia Layer
|
||||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
||||||
|
|
||||||
This software is provided 'as-is', without any express or implied
|
This software is provided 'as-is', without any express or implied
|
||||||
warranty. In no event will the authors be held liable for any damages
|
warranty. In no event will the authors be held liable for any damages
|
||||||
@@ -26,7 +26,7 @@
|
|||||||
*/
|
*/
|
||||||
#include "SDL_config.h"
|
#include "SDL_config.h"
|
||||||
|
|
||||||
#ifndef _MSC_VER
|
#if !defined(_MSC_VER) && !defined(SDL_USE_BUILTIN_OPENGL_DEFINITIONS)
|
||||||
|
|
||||||
#ifdef __IPHONEOS__
|
#ifdef __IPHONEOS__
|
||||||
#include <OpenGLES/ES2/gl.h>
|
#include <OpenGLES/ES2/gl.h>
|
||||||
|
|||||||
+32
-1
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
Simple DirectMedia Layer
|
Simple DirectMedia Layer
|
||||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
||||||
|
|
||||||
This software is provided 'as-is', without any express or implied
|
This software is provided 'as-is', without any express or implied
|
||||||
warranty. In no event will the authors be held liable for any damages
|
warranty. In no event will the authors be held liable for any damages
|
||||||
@@ -301,6 +301,11 @@ typedef enum
|
|||||||
SDL_DEFINE_PIXELFOURCC('O', 'E', 'S', ' ')
|
SDL_DEFINE_PIXELFOURCC('O', 'E', 'S', ' ')
|
||||||
} SDL_PixelFormatEnum;
|
} SDL_PixelFormatEnum;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The bits of this structure can be directly reinterpreted as an integer-packed
|
||||||
|
* color which uses the SDL_PIXELFORMAT_RGBA32 format (SDL_PIXELFORMAT_ABGR8888
|
||||||
|
* on little-endian systems and SDL_PIXELFORMAT_RGBA8888 on big-endian systems).
|
||||||
|
*/
|
||||||
typedef struct SDL_Color
|
typedef struct SDL_Color
|
||||||
{
|
{
|
||||||
Uint8 r;
|
Uint8 r;
|
||||||
@@ -367,6 +372,8 @@ extern DECLSPEC const char* SDLCALL SDL_GetPixelFormatName(Uint32 format);
|
|||||||
* \returns SDL_TRUE on success or SDL_FALSE if the conversion wasn't
|
* \returns SDL_TRUE on success or SDL_FALSE if the conversion wasn't
|
||||||
* possible; call SDL_GetError() for more information.
|
* possible; call SDL_GetError() for more information.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_MasksToPixelFormatEnum
|
* \sa SDL_MasksToPixelFormatEnum
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC SDL_bool SDLCALL SDL_PixelFormatEnumToMasks(Uint32 format,
|
extern DECLSPEC SDL_bool SDLCALL SDL_PixelFormatEnumToMasks(Uint32 format,
|
||||||
@@ -389,6 +396,8 @@ extern DECLSPEC SDL_bool SDLCALL SDL_PixelFormatEnumToMasks(Uint32 format,
|
|||||||
* \param Amask the alpha mask for the format
|
* \param Amask the alpha mask for the format
|
||||||
* \returns one of the SDL_PixelFormatEnum values
|
* \returns one of the SDL_PixelFormatEnum values
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_PixelFormatEnumToMasks
|
* \sa SDL_PixelFormatEnumToMasks
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC Uint32 SDLCALL SDL_MasksToPixelFormatEnum(int bpp,
|
extern DECLSPEC Uint32 SDLCALL SDL_MasksToPixelFormatEnum(int bpp,
|
||||||
@@ -408,6 +417,8 @@ extern DECLSPEC Uint32 SDLCALL SDL_MasksToPixelFormatEnum(int bpp,
|
|||||||
* \returns the new SDL_PixelFormat structure or NULL on failure; call
|
* \returns the new SDL_PixelFormat structure or NULL on failure; call
|
||||||
* SDL_GetError() for more information.
|
* SDL_GetError() for more information.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_FreeFormat
|
* \sa SDL_FreeFormat
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC SDL_PixelFormat * SDLCALL SDL_AllocFormat(Uint32 pixel_format);
|
extern DECLSPEC SDL_PixelFormat * SDLCALL SDL_AllocFormat(Uint32 pixel_format);
|
||||||
@@ -417,6 +428,8 @@ extern DECLSPEC SDL_PixelFormat * SDLCALL SDL_AllocFormat(Uint32 pixel_format);
|
|||||||
*
|
*
|
||||||
* \param format the SDL_PixelFormat structure to free
|
* \param format the SDL_PixelFormat structure to free
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_AllocFormat
|
* \sa SDL_AllocFormat
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC void SDLCALL SDL_FreeFormat(SDL_PixelFormat *format);
|
extern DECLSPEC void SDLCALL SDL_FreeFormat(SDL_PixelFormat *format);
|
||||||
@@ -431,6 +444,8 @@ extern DECLSPEC void SDLCALL SDL_FreeFormat(SDL_PixelFormat *format);
|
|||||||
* there wasn't enough memory); call SDL_GetError() for more
|
* there wasn't enough memory); call SDL_GetError() for more
|
||||||
* information.
|
* information.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_FreePalette
|
* \sa SDL_FreePalette
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC SDL_Palette *SDLCALL SDL_AllocPalette(int ncolors);
|
extern DECLSPEC SDL_Palette *SDLCALL SDL_AllocPalette(int ncolors);
|
||||||
@@ -443,6 +458,8 @@ extern DECLSPEC SDL_Palette *SDLCALL SDL_AllocPalette(int ncolors);
|
|||||||
* \returns 0 on success or a negative error code on failure; call
|
* \returns 0 on success or a negative error code on failure; call
|
||||||
* SDL_GetError() for more information.
|
* SDL_GetError() for more information.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_AllocPalette
|
* \sa SDL_AllocPalette
|
||||||
* \sa SDL_FreePalette
|
* \sa SDL_FreePalette
|
||||||
*/
|
*/
|
||||||
@@ -459,6 +476,8 @@ extern DECLSPEC int SDLCALL SDL_SetPixelFormatPalette(SDL_PixelFormat * format,
|
|||||||
* \returns 0 on success or a negative error code if not all of the colors
|
* \returns 0 on success or a negative error code if not all of the colors
|
||||||
* could be set; call SDL_GetError() for more information.
|
* could be set; call SDL_GetError() for more information.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_AllocPalette
|
* \sa SDL_AllocPalette
|
||||||
* \sa SDL_CreateRGBSurface
|
* \sa SDL_CreateRGBSurface
|
||||||
*/
|
*/
|
||||||
@@ -471,6 +490,8 @@ extern DECLSPEC int SDLCALL SDL_SetPaletteColors(SDL_Palette * palette,
|
|||||||
*
|
*
|
||||||
* \param palette the SDL_Palette structure to be freed
|
* \param palette the SDL_Palette structure to be freed
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_AllocPalette
|
* \sa SDL_AllocPalette
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC void SDLCALL SDL_FreePalette(SDL_Palette * palette);
|
extern DECLSPEC void SDLCALL SDL_FreePalette(SDL_Palette * palette);
|
||||||
@@ -499,6 +520,8 @@ extern DECLSPEC void SDLCALL SDL_FreePalette(SDL_Palette * palette);
|
|||||||
* \param b the blue component of the pixel in the range 0-255
|
* \param b the blue component of the pixel in the range 0-255
|
||||||
* \returns a pixel value
|
* \returns a pixel value
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_GetRGB
|
* \sa SDL_GetRGB
|
||||||
* \sa SDL_GetRGBA
|
* \sa SDL_GetRGBA
|
||||||
* \sa SDL_MapRGBA
|
* \sa SDL_MapRGBA
|
||||||
@@ -532,6 +555,8 @@ extern DECLSPEC Uint32 SDLCALL SDL_MapRGB(const SDL_PixelFormat * format,
|
|||||||
* \param a the alpha component of the pixel in the range 0-255
|
* \param a the alpha component of the pixel in the range 0-255
|
||||||
* \returns a pixel value
|
* \returns a pixel value
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_GetRGB
|
* \sa SDL_GetRGB
|
||||||
* \sa SDL_GetRGBA
|
* \sa SDL_GetRGBA
|
||||||
* \sa SDL_MapRGB
|
* \sa SDL_MapRGB
|
||||||
@@ -555,6 +580,8 @@ extern DECLSPEC Uint32 SDLCALL SDL_MapRGBA(const SDL_PixelFormat * format,
|
|||||||
* \param g a pointer filled in with the green component
|
* \param g a pointer filled in with the green component
|
||||||
* \param b a pointer filled in with the blue component
|
* \param b a pointer filled in with the blue component
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_GetRGBA
|
* \sa SDL_GetRGBA
|
||||||
* \sa SDL_MapRGB
|
* \sa SDL_MapRGB
|
||||||
* \sa SDL_MapRGBA
|
* \sa SDL_MapRGBA
|
||||||
@@ -582,6 +609,8 @@ extern DECLSPEC void SDLCALL SDL_GetRGB(Uint32 pixel,
|
|||||||
* \param b a pointer filled in with the blue component
|
* \param b a pointer filled in with the blue component
|
||||||
* \param a a pointer filled in with the alpha component
|
* \param a a pointer filled in with the alpha component
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_GetRGB
|
* \sa SDL_GetRGB
|
||||||
* \sa SDL_MapRGB
|
* \sa SDL_MapRGB
|
||||||
* \sa SDL_MapRGBA
|
* \sa SDL_MapRGBA
|
||||||
@@ -597,6 +626,8 @@ extern DECLSPEC void SDLCALL SDL_GetRGBA(Uint32 pixel,
|
|||||||
* \param gamma a gamma value where 0.0 is black and 1.0 is identity
|
* \param gamma a gamma value where 0.0 is black and 1.0 is identity
|
||||||
* \param ramp an array of 256 values filled in with the gamma ramp
|
* \param ramp an array of 256 values filled in with the gamma ramp
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_SetWindowGammaRamp
|
* \sa SDL_SetWindowGammaRamp
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC void SDLCALL SDL_CalculateGammaRamp(float gamma, Uint16 * ramp);
|
extern DECLSPEC void SDLCALL SDL_CalculateGammaRamp(float gamma, Uint16 * ramp);
|
||||||
|
|||||||
+3
-1
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
Simple DirectMedia Layer
|
Simple DirectMedia Layer
|
||||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
||||||
|
|
||||||
This software is provided 'as-is', without any express or implied
|
This software is provided 'as-is', without any express or implied
|
||||||
warranty. In no event will the authors be held liable for any damages
|
warranty. In no event will the authors be held liable for any damages
|
||||||
@@ -219,6 +219,8 @@ extern "C" {
|
|||||||
*
|
*
|
||||||
* \returns the name of the platform. If the correct platform name is not
|
* \returns the name of the platform. If the correct platform name is not
|
||||||
* available, returns a string beginning with the text "Unknown".
|
* available, returns a string beginning with the text "Unknown".
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC const char * SDLCALL SDL_GetPlatform (void);
|
extern DECLSPEC const char * SDLCALL SDL_GetPlatform (void);
|
||||||
|
|
||||||
|
|||||||
+3
-1
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
Simple DirectMedia Layer
|
Simple DirectMedia Layer
|
||||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
||||||
|
|
||||||
This software is provided 'as-is', without any express or implied
|
This software is provided 'as-is', without any express or implied
|
||||||
warranty. In no event will the authors be held liable for any damages
|
warranty. In no event will the authors be held liable for any damages
|
||||||
@@ -72,6 +72,8 @@ typedef enum
|
|||||||
* a NULL here if you don't care, will return -1 if we can't
|
* a NULL here if you don't care, will return -1 if we can't
|
||||||
* determine a value, or we're not running on a battery
|
* determine a value, or we're not running on a battery
|
||||||
* \returns an SDL_PowerState enum representing the current battery state.
|
* \returns an SDL_PowerState enum representing the current battery state.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC SDL_PowerState SDLCALL SDL_GetPowerInfo(int *secs, int *pct);
|
extern DECLSPEC SDL_PowerState SDLCALL SDL_GetPowerInfo(int *secs, int *pct);
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
Simple DirectMedia Layer
|
Simple DirectMedia Layer
|
||||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
||||||
|
|
||||||
This software is provided 'as-is', without any express or implied
|
This software is provided 'as-is', without any express or implied
|
||||||
warranty. In no event will the authors be held liable for any damages
|
warranty. In no event will the authors be held liable for any damages
|
||||||
|
|||||||
+7
-1
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
Simple DirectMedia Layer
|
Simple DirectMedia Layer
|
||||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
||||||
|
|
||||||
This software is provided 'as-is', without any express or implied
|
This software is provided 'as-is', without any express or implied
|
||||||
warranty. In no event will the authors be held liable for any damages
|
warranty. In no event will the authors be held liable for any damages
|
||||||
@@ -161,6 +161,8 @@ extern DECLSPEC SDL_bool SDLCALL SDL_IntersectRect(const SDL_Rect * A,
|
|||||||
* \param B an SDL_Rect structure representing the second rectangle
|
* \param B an SDL_Rect structure representing the second rectangle
|
||||||
* \param result an SDL_Rect structure filled in with the union of rectangles
|
* \param result an SDL_Rect structure filled in with the union of rectangles
|
||||||
* `A` and `B`
|
* `A` and `B`
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC void SDLCALL SDL_UnionRect(const SDL_Rect * A,
|
extern DECLSPEC void SDLCALL SDL_UnionRect(const SDL_Rect * A,
|
||||||
const SDL_Rect * B,
|
const SDL_Rect * B,
|
||||||
@@ -180,6 +182,8 @@ extern DECLSPEC void SDLCALL SDL_UnionRect(const SDL_Rect * A,
|
|||||||
* rectangle
|
* rectangle
|
||||||
* \returns SDL_TRUE if any points were enclosed or SDL_FALSE if all the
|
* \returns SDL_TRUE if any points were enclosed or SDL_FALSE if all the
|
||||||
* points were outside of the clipping rectangle.
|
* points were outside of the clipping rectangle.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC SDL_bool SDLCALL SDL_EnclosePoints(const SDL_Point * points,
|
extern DECLSPEC SDL_bool SDLCALL SDL_EnclosePoints(const SDL_Point * points,
|
||||||
int count,
|
int count,
|
||||||
@@ -201,6 +205,8 @@ extern DECLSPEC SDL_bool SDLCALL SDL_EnclosePoints(const SDL_Point * points,
|
|||||||
* \param X2 a pointer to the ending X-coordinate of the line
|
* \param X2 a pointer to the ending X-coordinate of the line
|
||||||
* \param Y2 a pointer to the ending Y-coordinate of the line
|
* \param Y2 a pointer to the ending Y-coordinate of the line
|
||||||
* \returns SDL_TRUE if there is an intersection, SDL_FALSE otherwise.
|
* \returns SDL_TRUE if there is an intersection, SDL_FALSE otherwise.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC SDL_bool SDLCALL SDL_IntersectRectAndLine(const SDL_Rect *
|
extern DECLSPEC SDL_bool SDLCALL SDL_IntersectRectAndLine(const SDL_Rect *
|
||||||
rect, int *X1,
|
rect, int *X1,
|
||||||
|
|||||||
+269
-4
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
Simple DirectMedia Layer
|
Simple DirectMedia Layer
|
||||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
||||||
|
|
||||||
This software is provided 'as-is', without any express or implied
|
This software is provided 'as-is', without any express or implied
|
||||||
warranty. In no event will the authors be held liable for any damages
|
warranty. In no event will the authors be held liable for any damages
|
||||||
@@ -85,6 +85,16 @@ typedef struct SDL_RendererInfo
|
|||||||
int max_texture_height; /**< The maximum texture height */
|
int max_texture_height; /**< The maximum texture height */
|
||||||
} SDL_RendererInfo;
|
} SDL_RendererInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Vertex structure
|
||||||
|
*/
|
||||||
|
typedef struct SDL_Vertex
|
||||||
|
{
|
||||||
|
SDL_FPoint position; /**< Vertex position, in SDL_Renderer coordinates */
|
||||||
|
SDL_Color color; /**< Vertex color */
|
||||||
|
SDL_FPoint tex_coord; /**< Normalized texture coordinates, if needed */
|
||||||
|
} SDL_Vertex;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The scaling mode for a texture.
|
* The scaling mode for a texture.
|
||||||
*/
|
*/
|
||||||
@@ -137,7 +147,6 @@ typedef struct SDL_Renderer SDL_Renderer;
|
|||||||
struct SDL_Texture;
|
struct SDL_Texture;
|
||||||
typedef struct SDL_Texture SDL_Texture;
|
typedef struct SDL_Texture SDL_Texture;
|
||||||
|
|
||||||
|
|
||||||
/* Function prototypes */
|
/* Function prototypes */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -168,6 +177,8 @@ extern DECLSPEC int SDLCALL SDL_GetNumRenderDrivers(void);
|
|||||||
* \returns 0 on success or a negative error code on failure; call
|
* \returns 0 on success or a negative error code on failure; call
|
||||||
* SDL_GetError() for more information.
|
* SDL_GetError() for more information.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_CreateRenderer
|
* \sa SDL_CreateRenderer
|
||||||
* \sa SDL_GetNumRenderDrivers
|
* \sa SDL_GetNumRenderDrivers
|
||||||
*/
|
*/
|
||||||
@@ -186,6 +197,8 @@ extern DECLSPEC int SDLCALL SDL_GetRenderDriverInfo(int index,
|
|||||||
* \returns 0 on success, or -1 on error; call SDL_GetError() for more
|
* \returns 0 on success, or -1 on error; call SDL_GetError() for more
|
||||||
* information.
|
* information.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_CreateRenderer
|
* \sa SDL_CreateRenderer
|
||||||
* \sa SDL_CreateWindow
|
* \sa SDL_CreateWindow
|
||||||
*/
|
*/
|
||||||
@@ -204,6 +217,8 @@ extern DECLSPEC int SDLCALL SDL_CreateWindowAndRenderer(
|
|||||||
* \returns a valid rendering context or NULL if there was an error; call
|
* \returns a valid rendering context or NULL if there was an error; call
|
||||||
* SDL_GetError() for more information.
|
* SDL_GetError() for more information.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_CreateSoftwareRenderer
|
* \sa SDL_CreateSoftwareRenderer
|
||||||
* \sa SDL_DestroyRenderer
|
* \sa SDL_DestroyRenderer
|
||||||
* \sa SDL_GetNumRenderDrivers
|
* \sa SDL_GetNumRenderDrivers
|
||||||
@@ -225,6 +240,8 @@ extern DECLSPEC SDL_Renderer * SDLCALL SDL_CreateRenderer(SDL_Window * window,
|
|||||||
* \returns a valid rendering context or NULL if there was an error; call
|
* \returns a valid rendering context or NULL if there was an error; call
|
||||||
* SDL_GetError() for more information.
|
* SDL_GetError() for more information.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_CreateRenderer
|
* \sa SDL_CreateRenderer
|
||||||
* \sa SDL_CreateWindowRenderer
|
* \sa SDL_CreateWindowRenderer
|
||||||
* \sa SDL_DestroyRenderer
|
* \sa SDL_DestroyRenderer
|
||||||
@@ -238,6 +255,8 @@ extern DECLSPEC SDL_Renderer * SDLCALL SDL_CreateSoftwareRenderer(SDL_Surface *
|
|||||||
* \returns the rendering context on success or NULL on failure; call
|
* \returns the rendering context on success or NULL on failure; call
|
||||||
* SDL_GetError() for more information.
|
* SDL_GetError() for more information.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_CreateRenderer
|
* \sa SDL_CreateRenderer
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC SDL_Renderer * SDLCALL SDL_GetRenderer(SDL_Window * window);
|
extern DECLSPEC SDL_Renderer * SDLCALL SDL_GetRenderer(SDL_Window * window);
|
||||||
@@ -251,6 +270,8 @@ extern DECLSPEC SDL_Renderer * SDLCALL SDL_GetRenderer(SDL_Window * window);
|
|||||||
* \returns 0 on success or a negative error code on failure; call
|
* \returns 0 on success or a negative error code on failure; call
|
||||||
* SDL_GetError() for more information.
|
* SDL_GetError() for more information.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_CreateRenderer
|
* \sa SDL_CreateRenderer
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC int SDLCALL SDL_GetRendererInfo(SDL_Renderer * renderer,
|
extern DECLSPEC int SDLCALL SDL_GetRendererInfo(SDL_Renderer * renderer,
|
||||||
@@ -291,6 +312,8 @@ extern DECLSPEC int SDLCALL SDL_GetRendererOutputSize(SDL_Renderer * renderer,
|
|||||||
* was active, the format was unsupported, or the width or height
|
* was active, the format was unsupported, or the width or height
|
||||||
* were out of range; call SDL_GetError() for more information.
|
* were out of range; call SDL_GetError() for more information.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_CreateTextureFromSurface
|
* \sa SDL_CreateTextureFromSurface
|
||||||
* \sa SDL_DestroyTexture
|
* \sa SDL_DestroyTexture
|
||||||
* \sa SDL_QueryTexture
|
* \sa SDL_QueryTexture
|
||||||
@@ -319,6 +342,8 @@ extern DECLSPEC SDL_Texture * SDLCALL SDL_CreateTexture(SDL_Renderer * renderer,
|
|||||||
* \returns the created texture or NULL on failure; call SDL_GetError() for
|
* \returns the created texture or NULL on failure; call SDL_GetError() for
|
||||||
* more information.
|
* more information.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_CreateTexture
|
* \sa SDL_CreateTexture
|
||||||
* \sa SDL_DestroyTexture
|
* \sa SDL_DestroyTexture
|
||||||
* \sa SDL_QueryTexture
|
* \sa SDL_QueryTexture
|
||||||
@@ -339,6 +364,8 @@ extern DECLSPEC SDL_Texture * SDLCALL SDL_CreateTextureFromSurface(SDL_Renderer
|
|||||||
* \returns 0 on success or a negative error code on failure; call
|
* \returns 0 on success or a negative error code on failure; call
|
||||||
* SDL_GetError() for more information.
|
* SDL_GetError() for more information.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_CreateTexture
|
* \sa SDL_CreateTexture
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC int SDLCALL SDL_QueryTexture(SDL_Texture * texture,
|
extern DECLSPEC int SDLCALL SDL_QueryTexture(SDL_Texture * texture,
|
||||||
@@ -364,6 +391,8 @@ extern DECLSPEC int SDLCALL SDL_QueryTexture(SDL_Texture * texture,
|
|||||||
* \returns 0 on success or a negative error code on failure; call
|
* \returns 0 on success or a negative error code on failure; call
|
||||||
* SDL_GetError() for more information.
|
* SDL_GetError() for more information.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_GetTextureColorMod
|
* \sa SDL_GetTextureColorMod
|
||||||
* \sa SDL_SetTextureAlphaMod
|
* \sa SDL_SetTextureAlphaMod
|
||||||
*/
|
*/
|
||||||
@@ -381,6 +410,8 @@ extern DECLSPEC int SDLCALL SDL_SetTextureColorMod(SDL_Texture * texture,
|
|||||||
* \returns 0 on success or a negative error code on failure; call
|
* \returns 0 on success or a negative error code on failure; call
|
||||||
* SDL_GetError() for more information.
|
* SDL_GetError() for more information.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_GetTextureAlphaMod
|
* \sa SDL_GetTextureAlphaMod
|
||||||
* \sa SDL_SetTextureColorMod
|
* \sa SDL_SetTextureColorMod
|
||||||
*/
|
*/
|
||||||
@@ -404,6 +435,8 @@ extern DECLSPEC int SDLCALL SDL_GetTextureColorMod(SDL_Texture * texture,
|
|||||||
* \returns 0 on success or a negative error code on failure; call
|
* \returns 0 on success or a negative error code on failure; call
|
||||||
* SDL_GetError() for more information.
|
* SDL_GetError() for more information.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_GetTextureAlphaMod
|
* \sa SDL_GetTextureAlphaMod
|
||||||
* \sa SDL_SetTextureColorMod
|
* \sa SDL_SetTextureColorMod
|
||||||
*/
|
*/
|
||||||
@@ -418,6 +451,8 @@ extern DECLSPEC int SDLCALL SDL_SetTextureAlphaMod(SDL_Texture * texture,
|
|||||||
* \returns 0 on success or a negative error code on failure; call
|
* \returns 0 on success or a negative error code on failure; call
|
||||||
* SDL_GetError() for more information.
|
* SDL_GetError() for more information.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_GetTextureColorMod
|
* \sa SDL_GetTextureColorMod
|
||||||
* \sa SDL_SetTextureAlphaMod
|
* \sa SDL_SetTextureAlphaMod
|
||||||
*/
|
*/
|
||||||
@@ -435,6 +470,8 @@ extern DECLSPEC int SDLCALL SDL_GetTextureAlphaMod(SDL_Texture * texture,
|
|||||||
* \returns 0 on success or a negative error code on failure; call
|
* \returns 0 on success or a negative error code on failure; call
|
||||||
* SDL_GetError() for more information.
|
* SDL_GetError() for more information.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_GetTextureBlendMode
|
* \sa SDL_GetTextureBlendMode
|
||||||
* \sa SDL_RenderCopy
|
* \sa SDL_RenderCopy
|
||||||
*/
|
*/
|
||||||
@@ -449,6 +486,8 @@ extern DECLSPEC int SDLCALL SDL_SetTextureBlendMode(SDL_Texture * texture,
|
|||||||
* \returns 0 on success or a negative error code on failure; call
|
* \returns 0 on success or a negative error code on failure; call
|
||||||
* SDL_GetError() for more information.
|
* SDL_GetError() for more information.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_SetTextureBlendMode
|
* \sa SDL_SetTextureBlendMode
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC int SDLCALL SDL_GetTextureBlendMode(SDL_Texture * texture,
|
extern DECLSPEC int SDLCALL SDL_GetTextureBlendMode(SDL_Texture * texture,
|
||||||
@@ -463,6 +502,8 @@ extern DECLSPEC int SDLCALL SDL_GetTextureBlendMode(SDL_Texture * texture,
|
|||||||
* \param scaleMode the SDL_ScaleMode to use for texture scaling.
|
* \param scaleMode the SDL_ScaleMode to use for texture scaling.
|
||||||
* \returns 0 on success, or -1 if the texture is not valid.
|
* \returns 0 on success, or -1 if the texture is not valid.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.12.
|
||||||
|
*
|
||||||
* \sa SDL_GetTextureScaleMode
|
* \sa SDL_GetTextureScaleMode
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC int SDLCALL SDL_SetTextureScaleMode(SDL_Texture * texture,
|
extern DECLSPEC int SDLCALL SDL_SetTextureScaleMode(SDL_Texture * texture,
|
||||||
@@ -475,11 +516,40 @@ extern DECLSPEC int SDLCALL SDL_SetTextureScaleMode(SDL_Texture * texture,
|
|||||||
* \param scaleMode a pointer filled in with the current scale mode.
|
* \param scaleMode a pointer filled in with the current scale mode.
|
||||||
* \return 0 on success, or -1 if the texture is not valid.
|
* \return 0 on success, or -1 if the texture is not valid.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.12.
|
||||||
|
*
|
||||||
* \sa SDL_SetTextureScaleMode
|
* \sa SDL_SetTextureScaleMode
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC int SDLCALL SDL_GetTextureScaleMode(SDL_Texture * texture,
|
extern DECLSPEC int SDLCALL SDL_GetTextureScaleMode(SDL_Texture * texture,
|
||||||
SDL_ScaleMode *scaleMode);
|
SDL_ScaleMode *scaleMode);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Associate a user-specified pointer with a texture.
|
||||||
|
*
|
||||||
|
* \param texture the texture to update.
|
||||||
|
* \param userdata the pointer to associate with the texture.
|
||||||
|
* \returns 0 on success, or -1 if the texture is not valid.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.18.
|
||||||
|
*
|
||||||
|
* \sa SDL_GetTextureUserData
|
||||||
|
*/
|
||||||
|
extern DECLSPEC int SDLCALL SDL_SetTextureUserData(SDL_Texture * texture,
|
||||||
|
void *userdata);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the user-specified pointer associated with a texture
|
||||||
|
*
|
||||||
|
* \param texture the texture to query.
|
||||||
|
* \return the pointer associated with the texture, or NULL if the texture is
|
||||||
|
* not valid.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.18.
|
||||||
|
*
|
||||||
|
* \sa SDL_SetTextureUserData
|
||||||
|
*/
|
||||||
|
extern DECLSPEC void * SDLCALL SDL_GetTextureUserData(SDL_Texture * texture);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update the given texture rectangle with new pixel data.
|
* Update the given texture rectangle with new pixel data.
|
||||||
*
|
*
|
||||||
@@ -503,6 +573,8 @@ extern DECLSPEC int SDLCALL SDL_GetTextureScaleMode(SDL_Texture * texture,
|
|||||||
* \returns 0 on success or a negative error code on failure; call
|
* \returns 0 on success or a negative error code on failure; call
|
||||||
* SDL_GetError() for more information.
|
* SDL_GetError() for more information.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_CreateTexture
|
* \sa SDL_CreateTexture
|
||||||
* \sa SDL_LockTexture
|
* \sa SDL_LockTexture
|
||||||
* \sa SDL_UnlockTexture
|
* \sa SDL_UnlockTexture
|
||||||
@@ -561,6 +633,8 @@ extern DECLSPEC int SDLCALL SDL_UpdateYUVTexture(SDL_Texture * texture,
|
|||||||
* \param UVpitch the number of bytes between rows of pixel data for the UV
|
* \param UVpitch the number of bytes between rows of pixel data for the UV
|
||||||
* plane.
|
* plane.
|
||||||
* \return 0 on success, or -1 if the texture is not valid.
|
* \return 0 on success, or -1 if the texture is not valid.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.16.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC int SDLCALL SDL_UpdateNVTexture(SDL_Texture * texture,
|
extern DECLSPEC int SDLCALL SDL_UpdateNVTexture(SDL_Texture * texture,
|
||||||
const SDL_Rect * rect,
|
const SDL_Rect * rect,
|
||||||
@@ -590,6 +664,8 @@ extern DECLSPEC int SDLCALL SDL_UpdateNVTexture(SDL_Texture * texture,
|
|||||||
* or was not created with `SDL_TEXTUREACCESS_STREAMING`; call
|
* or was not created with `SDL_TEXTUREACCESS_STREAMING`; call
|
||||||
* SDL_GetError() for more information.
|
* SDL_GetError() for more information.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_UnlockTexture
|
* \sa SDL_UnlockTexture
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC int SDLCALL SDL_LockTexture(SDL_Texture * texture,
|
extern DECLSPEC int SDLCALL SDL_LockTexture(SDL_Texture * texture,
|
||||||
@@ -623,6 +699,8 @@ extern DECLSPEC int SDLCALL SDL_LockTexture(SDL_Texture * texture,
|
|||||||
* \returns 0 on success, or -1 if the texture is not valid or was not created
|
* \returns 0 on success, or -1 if the texture is not valid or was not created
|
||||||
* with `SDL_TEXTUREACCESS_STREAMING`
|
* with `SDL_TEXTUREACCESS_STREAMING`
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.12.
|
||||||
|
*
|
||||||
* \sa SDL_LockTexture
|
* \sa SDL_LockTexture
|
||||||
* \sa SDL_UnlockTexture
|
* \sa SDL_UnlockTexture
|
||||||
*/
|
*/
|
||||||
@@ -634,7 +712,7 @@ extern DECLSPEC int SDLCALL SDL_LockTextureToSurface(SDL_Texture *texture,
|
|||||||
* Unlock a texture, uploading the changes to video memory, if needed.
|
* Unlock a texture, uploading the changes to video memory, if needed.
|
||||||
*
|
*
|
||||||
* **Warning**: Please note that SDL_LockTexture() is intended to be
|
* **Warning**: Please note that SDL_LockTexture() is intended to be
|
||||||
* write-only; it will notguarantee the previous contents of the texture will
|
* write-only; it will not guarantee the previous contents of the texture will
|
||||||
* be provided. You must fully initialize any area of a texture that you lock
|
* be provided. You must fully initialize any area of a texture that you lock
|
||||||
* before unlocking it, as the pixels might otherwise be uninitialized memory.
|
* before unlocking it, as the pixels might otherwise be uninitialized memory.
|
||||||
*
|
*
|
||||||
@@ -643,6 +721,8 @@ extern DECLSPEC int SDLCALL SDL_LockTextureToSurface(SDL_Texture *texture,
|
|||||||
*
|
*
|
||||||
* \param texture a texture locked by SDL_LockTexture()
|
* \param texture a texture locked by SDL_LockTexture()
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_LockTexture
|
* \sa SDL_LockTexture
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC void SDLCALL SDL_UnlockTexture(SDL_Texture * texture);
|
extern DECLSPEC void SDLCALL SDL_UnlockTexture(SDL_Texture * texture);
|
||||||
@@ -789,6 +869,8 @@ extern DECLSPEC SDL_bool SDLCALL SDL_RenderGetIntegerScale(SDL_Renderer * render
|
|||||||
* \returns 0 on success or a negative error code on failure; call
|
* \returns 0 on success or a negative error code on failure; call
|
||||||
* SDL_GetError() for more information.
|
* SDL_GetError() for more information.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_RenderGetViewport
|
* \sa SDL_RenderGetViewport
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC int SDLCALL SDL_RenderSetViewport(SDL_Renderer * renderer,
|
extern DECLSPEC int SDLCALL SDL_RenderSetViewport(SDL_Renderer * renderer,
|
||||||
@@ -800,6 +882,8 @@ extern DECLSPEC int SDLCALL SDL_RenderSetViewport(SDL_Renderer * renderer,
|
|||||||
* \param renderer the rendering context
|
* \param renderer the rendering context
|
||||||
* \param rect an SDL_Rect structure filled in with the current drawing area
|
* \param rect an SDL_Rect structure filled in with the current drawing area
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_RenderSetViewport
|
* \sa SDL_RenderSetViewport
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC void SDLCALL SDL_RenderGetViewport(SDL_Renderer * renderer,
|
extern DECLSPEC void SDLCALL SDL_RenderGetViewport(SDL_Renderer * renderer,
|
||||||
@@ -815,6 +899,8 @@ extern DECLSPEC void SDLCALL SDL_RenderGetViewport(SDL_Renderer * renderer,
|
|||||||
* \returns 0 on success or a negative error code on failure; call
|
* \returns 0 on success or a negative error code on failure; call
|
||||||
* SDL_GetError() for more information.
|
* SDL_GetError() for more information.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_RenderGetClipRect
|
* \sa SDL_RenderGetClipRect
|
||||||
* \sa SDL_RenderIsClipEnabled
|
* \sa SDL_RenderIsClipEnabled
|
||||||
*/
|
*/
|
||||||
@@ -829,6 +915,8 @@ extern DECLSPEC int SDLCALL SDL_RenderSetClipRect(SDL_Renderer * renderer,
|
|||||||
* \param rect an SDL_Rect structure filled in with the current clipping area
|
* \param rect an SDL_Rect structure filled in with the current clipping area
|
||||||
* or an empty rectangle if clipping is disabled
|
* or an empty rectangle if clipping is disabled
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_RenderIsClipEnabled
|
* \sa SDL_RenderIsClipEnabled
|
||||||
* \sa SDL_RenderSetClipRect
|
* \sa SDL_RenderSetClipRect
|
||||||
*/
|
*/
|
||||||
@@ -889,6 +977,53 @@ extern DECLSPEC int SDLCALL SDL_RenderSetScale(SDL_Renderer * renderer,
|
|||||||
extern DECLSPEC void SDLCALL SDL_RenderGetScale(SDL_Renderer * renderer,
|
extern DECLSPEC void SDLCALL SDL_RenderGetScale(SDL_Renderer * renderer,
|
||||||
float *scaleX, float *scaleY);
|
float *scaleX, float *scaleY);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get logical coordinates of point in renderer when given real coordinates of
|
||||||
|
* point in window.
|
||||||
|
*
|
||||||
|
* Logical coordinates will differ from real coordinates when render is scaled
|
||||||
|
* and logical renderer size set
|
||||||
|
*
|
||||||
|
* \param renderer the renderer from which the logical coordinates should be
|
||||||
|
* calcualted
|
||||||
|
* \param windowX the real X coordinate in the window
|
||||||
|
* \param windowY the real Y coordinate in the window
|
||||||
|
* \param logicalX the pointer filled with the logical x coordinate
|
||||||
|
* \param logicalY the pointer filled with the logical y coordinate
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.18.
|
||||||
|
*
|
||||||
|
* \sa SDL_RenderGetScale
|
||||||
|
* \sa SDL_RenderSetScale
|
||||||
|
* \sa SDL_RenderGetLogicalSize
|
||||||
|
* \sa SDL_RenderSetLogicalSize
|
||||||
|
*/
|
||||||
|
extern DECLSPEC void SDLCALL SDL_RenderWindowToLogical(SDL_Renderer * renderer,
|
||||||
|
int windowX, int windowY,
|
||||||
|
float *logicalX, float *logicalY);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get real coordinates of point in window when given logical coordinates of point in renderer.
|
||||||
|
* Logical coordinates will differ from real coordinates when render is scaled and logical renderer size set
|
||||||
|
*
|
||||||
|
* \param renderer the renderer from which the window coordinates should be calculated
|
||||||
|
* \param logicalX the logical x coordinate
|
||||||
|
* \param logicalY the logical y coordinate
|
||||||
|
* \param windowX the pointer filled with the real X coordinate in the window
|
||||||
|
* \param windowY the pointer filled with the real Y coordinate in the window
|
||||||
|
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.18.
|
||||||
|
*
|
||||||
|
* \sa SDL_RenderGetScale
|
||||||
|
* \sa SDL_RenderSetScale
|
||||||
|
* \sa SDL_RenderGetLogicalSize
|
||||||
|
* \sa SDL_RenderSetLogicalSize
|
||||||
|
*/
|
||||||
|
extern DECLSPEC void SDLCALL SDL_RenderLogicalToWindow(SDL_Renderer * renderer,
|
||||||
|
float logicalX, float logicalY,
|
||||||
|
int *windowX, int *windowY);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the color used for drawing operations (Rect, Line and Clear).
|
* Set the color used for drawing operations (Rect, Line and Clear).
|
||||||
*
|
*
|
||||||
@@ -905,6 +1040,8 @@ extern DECLSPEC void SDLCALL SDL_RenderGetScale(SDL_Renderer * renderer,
|
|||||||
* \returns 0 on success or a negative error code on failure; call
|
* \returns 0 on success or a negative error code on failure; call
|
||||||
* SDL_GetError() for more information.
|
* SDL_GetError() for more information.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_GetRenderDrawColor
|
* \sa SDL_GetRenderDrawColor
|
||||||
* \sa SDL_RenderClear
|
* \sa SDL_RenderClear
|
||||||
* \sa SDL_RenderDrawLine
|
* \sa SDL_RenderDrawLine
|
||||||
@@ -935,6 +1072,8 @@ extern DECLSPEC int SDLCALL SDL_SetRenderDrawColor(SDL_Renderer * renderer,
|
|||||||
* \returns 0 on success or a negative error code on failure; call
|
* \returns 0 on success or a negative error code on failure; call
|
||||||
* SDL_GetError() for more information.
|
* SDL_GetError() for more information.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_SetRenderDrawColor
|
* \sa SDL_SetRenderDrawColor
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC int SDLCALL SDL_GetRenderDrawColor(SDL_Renderer * renderer,
|
extern DECLSPEC int SDLCALL SDL_GetRenderDrawColor(SDL_Renderer * renderer,
|
||||||
@@ -951,6 +1090,8 @@ extern DECLSPEC int SDLCALL SDL_GetRenderDrawColor(SDL_Renderer * renderer,
|
|||||||
* \returns 0 on success or a negative error code on failure; call
|
* \returns 0 on success or a negative error code on failure; call
|
||||||
* SDL_GetError() for more information.
|
* SDL_GetError() for more information.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_GetRenderDrawBlendMode
|
* \sa SDL_GetRenderDrawBlendMode
|
||||||
* \sa SDL_RenderDrawLine
|
* \sa SDL_RenderDrawLine
|
||||||
* \sa SDL_RenderDrawLines
|
* \sa SDL_RenderDrawLines
|
||||||
@@ -972,6 +1113,8 @@ extern DECLSPEC int SDLCALL SDL_SetRenderDrawBlendMode(SDL_Renderer * renderer,
|
|||||||
* \returns 0 on success or a negative error code on failure; call
|
* \returns 0 on success or a negative error code on failure; call
|
||||||
* SDL_GetError() for more information.
|
* SDL_GetError() for more information.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_SetRenderDrawBlendMode
|
* \sa SDL_SetRenderDrawBlendMode
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC int SDLCALL SDL_GetRenderDrawBlendMode(SDL_Renderer * renderer,
|
extern DECLSPEC int SDLCALL SDL_GetRenderDrawBlendMode(SDL_Renderer * renderer,
|
||||||
@@ -1005,6 +1148,8 @@ extern DECLSPEC int SDLCALL SDL_RenderClear(SDL_Renderer * renderer);
|
|||||||
* \returns 0 on success or a negative error code on failure; call
|
* \returns 0 on success or a negative error code on failure; call
|
||||||
* SDL_GetError() for more information.
|
* SDL_GetError() for more information.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_RenderDrawLine
|
* \sa SDL_RenderDrawLine
|
||||||
* \sa SDL_RenderDrawLines
|
* \sa SDL_RenderDrawLines
|
||||||
* \sa SDL_RenderDrawPoints
|
* \sa SDL_RenderDrawPoints
|
||||||
@@ -1029,6 +1174,8 @@ extern DECLSPEC int SDLCALL SDL_RenderDrawPoint(SDL_Renderer * renderer,
|
|||||||
* \returns 0 on success or a negative error code on failure; call
|
* \returns 0 on success or a negative error code on failure; call
|
||||||
* SDL_GetError() for more information.
|
* SDL_GetError() for more information.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_RenderDrawLine
|
* \sa SDL_RenderDrawLine
|
||||||
* \sa SDL_RenderDrawLines
|
* \sa SDL_RenderDrawLines
|
||||||
* \sa SDL_RenderDrawPoint
|
* \sa SDL_RenderDrawPoint
|
||||||
@@ -1110,6 +1257,8 @@ extern DECLSPEC int SDLCALL SDL_RenderDrawLines(SDL_Renderer * renderer,
|
|||||||
* \returns 0 on success or a negative error code on failure; call
|
* \returns 0 on success or a negative error code on failure; call
|
||||||
* SDL_GetError() for more information.
|
* SDL_GetError() for more information.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_RenderDrawLine
|
* \sa SDL_RenderDrawLine
|
||||||
* \sa SDL_RenderDrawLines
|
* \sa SDL_RenderDrawLines
|
||||||
* \sa SDL_RenderDrawPoint
|
* \sa SDL_RenderDrawPoint
|
||||||
@@ -1134,6 +1283,8 @@ extern DECLSPEC int SDLCALL SDL_RenderDrawRect(SDL_Renderer * renderer,
|
|||||||
* \returns 0 on success or a negative error code on failure; call
|
* \returns 0 on success or a negative error code on failure; call
|
||||||
* SDL_GetError() for more information.
|
* SDL_GetError() for more information.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_RenderDrawLine
|
* \sa SDL_RenderDrawLine
|
||||||
* \sa SDL_RenderDrawLines
|
* \sa SDL_RenderDrawLines
|
||||||
* \sa SDL_RenderDrawPoint
|
* \sa SDL_RenderDrawPoint
|
||||||
@@ -1162,6 +1313,8 @@ extern DECLSPEC int SDLCALL SDL_RenderDrawRects(SDL_Renderer * renderer,
|
|||||||
* \returns 0 on success or a negative error code on failure; call
|
* \returns 0 on success or a negative error code on failure; call
|
||||||
* SDL_GetError() for more information.
|
* SDL_GetError() for more information.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_RenderDrawLine
|
* \sa SDL_RenderDrawLine
|
||||||
* \sa SDL_RenderDrawLines
|
* \sa SDL_RenderDrawLines
|
||||||
* \sa SDL_RenderDrawPoint
|
* \sa SDL_RenderDrawPoint
|
||||||
@@ -1187,6 +1340,8 @@ extern DECLSPEC int SDLCALL SDL_RenderFillRect(SDL_Renderer * renderer,
|
|||||||
* \returns 0 on success or a negative error code on failure; call
|
* \returns 0 on success or a negative error code on failure; call
|
||||||
* SDL_GetError() for more information.
|
* SDL_GetError() for more information.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_RenderDrawLine
|
* \sa SDL_RenderDrawLine
|
||||||
* \sa SDL_RenderDrawLines
|
* \sa SDL_RenderDrawLines
|
||||||
* \sa SDL_RenderDrawPoint
|
* \sa SDL_RenderDrawPoint
|
||||||
@@ -1221,6 +1376,8 @@ extern DECLSPEC int SDLCALL SDL_RenderFillRects(SDL_Renderer * renderer,
|
|||||||
* \returns 0 on success or a negative error code on failure; call
|
* \returns 0 on success or a negative error code on failure; call
|
||||||
* SDL_GetError() for more information.
|
* SDL_GetError() for more information.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_RenderCopyEx
|
* \sa SDL_RenderCopyEx
|
||||||
* \sa SDL_SetTextureAlphaMod
|
* \sa SDL_SetTextureAlphaMod
|
||||||
* \sa SDL_SetTextureBlendMode
|
* \sa SDL_SetTextureBlendMode
|
||||||
@@ -1263,6 +1420,8 @@ extern DECLSPEC int SDLCALL SDL_RenderCopy(SDL_Renderer * renderer,
|
|||||||
* \returns 0 on success or a negative error code on failure; call
|
* \returns 0 on success or a negative error code on failure; call
|
||||||
* SDL_GetError() for more information.
|
* SDL_GetError() for more information.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_RenderCopy
|
* \sa SDL_RenderCopy
|
||||||
* \sa SDL_SetTextureAlphaMod
|
* \sa SDL_SetTextureAlphaMod
|
||||||
* \sa SDL_SetTextureBlendMode
|
* \sa SDL_SetTextureBlendMode
|
||||||
@@ -1284,6 +1443,8 @@ extern DECLSPEC int SDLCALL SDL_RenderCopyEx(SDL_Renderer * renderer,
|
|||||||
* \param x The x coordinate of the point.
|
* \param x The x coordinate of the point.
|
||||||
* \param y The y coordinate of the point.
|
* \param y The y coordinate of the point.
|
||||||
* \return 0 on success, or -1 on error
|
* \return 0 on success, or -1 on error
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.10.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC int SDLCALL SDL_RenderDrawPointF(SDL_Renderer * renderer,
|
extern DECLSPEC int SDLCALL SDL_RenderDrawPointF(SDL_Renderer * renderer,
|
||||||
float x, float y);
|
float x, float y);
|
||||||
@@ -1295,6 +1456,8 @@ extern DECLSPEC int SDLCALL SDL_RenderDrawPointF(SDL_Renderer * renderer,
|
|||||||
* \param points The points to draw
|
* \param points The points to draw
|
||||||
* \param count The number of points to draw
|
* \param count The number of points to draw
|
||||||
* \return 0 on success, or -1 on error
|
* \return 0 on success, or -1 on error
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.10.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC int SDLCALL SDL_RenderDrawPointsF(SDL_Renderer * renderer,
|
extern DECLSPEC int SDLCALL SDL_RenderDrawPointsF(SDL_Renderer * renderer,
|
||||||
const SDL_FPoint * points,
|
const SDL_FPoint * points,
|
||||||
@@ -1309,6 +1472,8 @@ extern DECLSPEC int SDLCALL SDL_RenderDrawPointsF(SDL_Renderer * renderer,
|
|||||||
* \param x2 The x coordinate of the end point.
|
* \param x2 The x coordinate of the end point.
|
||||||
* \param y2 The y coordinate of the end point.
|
* \param y2 The y coordinate of the end point.
|
||||||
* \return 0 on success, or -1 on error
|
* \return 0 on success, or -1 on error
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.10.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC int SDLCALL SDL_RenderDrawLineF(SDL_Renderer * renderer,
|
extern DECLSPEC int SDLCALL SDL_RenderDrawLineF(SDL_Renderer * renderer,
|
||||||
float x1, float y1, float x2, float y2);
|
float x1, float y1, float x2, float y2);
|
||||||
@@ -1321,6 +1486,8 @@ extern DECLSPEC int SDLCALL SDL_RenderDrawLineF(SDL_Renderer * renderer,
|
|||||||
* \param points The points along the lines
|
* \param points The points along the lines
|
||||||
* \param count The number of points, drawing count-1 lines
|
* \param count The number of points, drawing count-1 lines
|
||||||
* \return 0 on success, or -1 on error
|
* \return 0 on success, or -1 on error
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.10.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC int SDLCALL SDL_RenderDrawLinesF(SDL_Renderer * renderer,
|
extern DECLSPEC int SDLCALL SDL_RenderDrawLinesF(SDL_Renderer * renderer,
|
||||||
const SDL_FPoint * points,
|
const SDL_FPoint * points,
|
||||||
@@ -1333,6 +1500,8 @@ extern DECLSPEC int SDLCALL SDL_RenderDrawLinesF(SDL_Renderer * renderer,
|
|||||||
* \param rect A pointer to the destination rectangle, or NULL to outline the
|
* \param rect A pointer to the destination rectangle, or NULL to outline the
|
||||||
* entire rendering target.
|
* entire rendering target.
|
||||||
* \return 0 on success, or -1 on error
|
* \return 0 on success, or -1 on error
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.10.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC int SDLCALL SDL_RenderDrawRectF(SDL_Renderer * renderer,
|
extern DECLSPEC int SDLCALL SDL_RenderDrawRectF(SDL_Renderer * renderer,
|
||||||
const SDL_FRect * rect);
|
const SDL_FRect * rect);
|
||||||
@@ -1345,6 +1514,8 @@ extern DECLSPEC int SDLCALL SDL_RenderDrawRectF(SDL_Renderer * renderer,
|
|||||||
* \param rects A pointer to an array of destination rectangles.
|
* \param rects A pointer to an array of destination rectangles.
|
||||||
* \param count The number of rectangles.
|
* \param count The number of rectangles.
|
||||||
* \return 0 on success, or -1 on error
|
* \return 0 on success, or -1 on error
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.10.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC int SDLCALL SDL_RenderDrawRectsF(SDL_Renderer * renderer,
|
extern DECLSPEC int SDLCALL SDL_RenderDrawRectsF(SDL_Renderer * renderer,
|
||||||
const SDL_FRect * rects,
|
const SDL_FRect * rects,
|
||||||
@@ -1358,6 +1529,8 @@ extern DECLSPEC int SDLCALL SDL_RenderDrawRectsF(SDL_Renderer * renderer,
|
|||||||
* \param rect A pointer to the destination rectangle, or NULL for the entire
|
* \param rect A pointer to the destination rectangle, or NULL for the entire
|
||||||
* rendering target.
|
* rendering target.
|
||||||
* \return 0 on success, or -1 on error
|
* \return 0 on success, or -1 on error
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.10.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC int SDLCALL SDL_RenderFillRectF(SDL_Renderer * renderer,
|
extern DECLSPEC int SDLCALL SDL_RenderFillRectF(SDL_Renderer * renderer,
|
||||||
const SDL_FRect * rect);
|
const SDL_FRect * rect);
|
||||||
@@ -1370,6 +1543,8 @@ extern DECLSPEC int SDLCALL SDL_RenderFillRectF(SDL_Renderer * renderer,
|
|||||||
* \param rects A pointer to an array of destination rectangles.
|
* \param rects A pointer to an array of destination rectangles.
|
||||||
* \param count The number of rectangles.
|
* \param count The number of rectangles.
|
||||||
* \return 0 on success, or -1 on error
|
* \return 0 on success, or -1 on error
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.10.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC int SDLCALL SDL_RenderFillRectsF(SDL_Renderer * renderer,
|
extern DECLSPEC int SDLCALL SDL_RenderFillRectsF(SDL_Renderer * renderer,
|
||||||
const SDL_FRect * rects,
|
const SDL_FRect * rects,
|
||||||
@@ -1386,6 +1561,8 @@ extern DECLSPEC int SDLCALL SDL_RenderFillRectsF(SDL_Renderer * renderer,
|
|||||||
* \param dstrect A pointer to the destination rectangle, or NULL for the
|
* \param dstrect A pointer to the destination rectangle, or NULL for the
|
||||||
* entire rendering target.
|
* entire rendering target.
|
||||||
* \return 0 on success, or -1 on error
|
* \return 0 on success, or -1 on error
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.10.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC int SDLCALL SDL_RenderCopyF(SDL_Renderer * renderer,
|
extern DECLSPEC int SDLCALL SDL_RenderCopyF(SDL_Renderer * renderer,
|
||||||
SDL_Texture * texture,
|
SDL_Texture * texture,
|
||||||
@@ -1410,6 +1587,8 @@ extern DECLSPEC int SDLCALL SDL_RenderCopyF(SDL_Renderer * renderer,
|
|||||||
* \param flip An SDL_RendererFlip value stating which flipping actions should
|
* \param flip An SDL_RendererFlip value stating which flipping actions should
|
||||||
* be performed on the texture
|
* be performed on the texture
|
||||||
* \return 0 on success, or -1 on error
|
* \return 0 on success, or -1 on error
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.10.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC int SDLCALL SDL_RenderCopyExF(SDL_Renderer * renderer,
|
extern DECLSPEC int SDLCALL SDL_RenderCopyExF(SDL_Renderer * renderer,
|
||||||
SDL_Texture * texture,
|
SDL_Texture * texture,
|
||||||
@@ -1419,6 +1598,62 @@ extern DECLSPEC int SDLCALL SDL_RenderCopyExF(SDL_Renderer * renderer,
|
|||||||
const SDL_FPoint *center,
|
const SDL_FPoint *center,
|
||||||
const SDL_RendererFlip flip);
|
const SDL_RendererFlip flip);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Render a list of triangles, optionally using a texture and indices into the
|
||||||
|
* vertex array Color and alpha modulation is done per vertex
|
||||||
|
* (SDL_SetTextureColorMod and SDL_SetTextureAlphaMod are ignored).
|
||||||
|
*
|
||||||
|
* \param texture (optional) The SDL texture to use.
|
||||||
|
* \param vertices Vertices.
|
||||||
|
* \param num_vertices Number of vertices.
|
||||||
|
* \param indices (optional) An array of integer indices into the 'vertices'
|
||||||
|
* array, if NULL all vertices will be rendered in sequential
|
||||||
|
* order.
|
||||||
|
* \param num_indices Number of indices.
|
||||||
|
* \return 0 on success, or -1 if the operation is not supported
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.18.
|
||||||
|
*
|
||||||
|
* \sa SDL_RenderGeometryRaw
|
||||||
|
* \sa SDL_Vertex
|
||||||
|
*/
|
||||||
|
extern DECLSPEC int SDLCALL SDL_RenderGeometry(SDL_Renderer *renderer,
|
||||||
|
SDL_Texture *texture,
|
||||||
|
const SDL_Vertex *vertices, int num_vertices,
|
||||||
|
const int *indices, int num_indices);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Render a list of triangles, optionally using a texture and indices into the
|
||||||
|
* vertex arrays Color and alpha modulation is done per vertex
|
||||||
|
* (SDL_SetTextureColorMod and SDL_SetTextureAlphaMod are ignored).
|
||||||
|
*
|
||||||
|
* \param texture (optional) The SDL texture to use.
|
||||||
|
* \param xy Vertex positions
|
||||||
|
* \param xy_stride Byte size to move from one element to the next element
|
||||||
|
* \param color Vertex colors (as SDL_Color)
|
||||||
|
* \param color_stride Byte size to move from one element to the next element
|
||||||
|
* \param uv Vertex normalized texture coordinates
|
||||||
|
* \param uv_stride Byte size to move from one element to the next element
|
||||||
|
* \param num_vertices Number of vertices.
|
||||||
|
* \param indices (optional) An array of indices into the 'vertices' arrays,
|
||||||
|
* if NULL all vertices will be rendered in sequential order.
|
||||||
|
* \param num_indices Number of indices.
|
||||||
|
* \param size_indices Index size: 1 (byte), 2 (short), 4 (int)
|
||||||
|
* \return 0 on success, or -1 if the operation is not supported
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.18.
|
||||||
|
*
|
||||||
|
* \sa SDL_RenderGeometry
|
||||||
|
* \sa SDL_Vertex
|
||||||
|
*/
|
||||||
|
extern DECLSPEC int SDLCALL SDL_RenderGeometryRaw(SDL_Renderer *renderer,
|
||||||
|
SDL_Texture *texture,
|
||||||
|
const float *xy, int xy_stride,
|
||||||
|
const SDL_Color *color, int color_stride,
|
||||||
|
const float *uv, int uv_stride,
|
||||||
|
int num_vertices,
|
||||||
|
const void *indices, int num_indices, int size_indices);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read pixels from the current rendering target to an array of pixels.
|
* Read pixels from the current rendering target to an array of pixels.
|
||||||
*
|
*
|
||||||
@@ -1441,6 +1676,8 @@ extern DECLSPEC int SDLCALL SDL_RenderCopyExF(SDL_Renderer * renderer,
|
|||||||
* \param pitch the pitch of the `pixels` parameter
|
* \param pitch the pitch of the `pixels` parameter
|
||||||
* \returns 0 on success or a negative error code on failure; call
|
* \returns 0 on success or a negative error code on failure; call
|
||||||
* SDL_GetError() for more information.
|
* SDL_GetError() for more information.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC int SDLCALL SDL_RenderReadPixels(SDL_Renderer * renderer,
|
extern DECLSPEC int SDLCALL SDL_RenderReadPixels(SDL_Renderer * renderer,
|
||||||
const SDL_Rect * rect,
|
const SDL_Rect * rect,
|
||||||
@@ -1468,6 +1705,8 @@ extern DECLSPEC int SDLCALL SDL_RenderReadPixels(SDL_Renderer * renderer,
|
|||||||
*
|
*
|
||||||
* \param renderer the rendering context
|
* \param renderer the rendering context
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_RenderClear
|
* \sa SDL_RenderClear
|
||||||
* \sa SDL_RenderDrawLine
|
* \sa SDL_RenderDrawLine
|
||||||
* \sa SDL_RenderDrawLines
|
* \sa SDL_RenderDrawLines
|
||||||
@@ -1490,6 +1729,8 @@ extern DECLSPEC void SDLCALL SDL_RenderPresent(SDL_Renderer * renderer);
|
|||||||
*
|
*
|
||||||
* \param texture the texture to destroy
|
* \param texture the texture to destroy
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_CreateTexture
|
* \sa SDL_CreateTexture
|
||||||
* \sa SDL_CreateTextureFromSurface
|
* \sa SDL_CreateTextureFromSurface
|
||||||
*/
|
*/
|
||||||
@@ -1500,6 +1741,8 @@ extern DECLSPEC void SDLCALL SDL_DestroyTexture(SDL_Texture * texture);
|
|||||||
*
|
*
|
||||||
* \param renderer the rendering context
|
* \param renderer the rendering context
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_CreateRenderer
|
* \sa SDL_CreateRenderer
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC void SDLCALL SDL_DestroyRenderer(SDL_Renderer * renderer);
|
extern DECLSPEC void SDLCALL SDL_DestroyRenderer(SDL_Renderer * renderer);
|
||||||
@@ -1581,6 +1824,8 @@ extern DECLSPEC int SDLCALL SDL_GL_BindTexture(SDL_Texture *texture, float *texw
|
|||||||
* \param texture the texture to unbind from the current OpenGL/ES/ES2 context
|
* \param texture the texture to unbind from the current OpenGL/ES/ES2 context
|
||||||
* \returns 0 on success, or -1 if the operation is not supported
|
* \returns 0 on success, or -1 if the operation is not supported
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_GL_BindTexture
|
* \sa SDL_GL_BindTexture
|
||||||
* \sa SDL_GL_MakeCurrent
|
* \sa SDL_GL_MakeCurrent
|
||||||
*/
|
*/
|
||||||
@@ -1596,6 +1841,8 @@ extern DECLSPEC int SDLCALL SDL_GL_UnbindTexture(SDL_Texture *texture);
|
|||||||
* \returns a `CAMetalLayer *` on success, or NULL if the renderer isn't a
|
* \returns a `CAMetalLayer *` on success, or NULL if the renderer isn't a
|
||||||
* Metal renderer
|
* Metal renderer
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.8.
|
||||||
|
*
|
||||||
* \sa SDL_RenderGetMetalCommandEncoder
|
* \sa SDL_RenderGetMetalCommandEncoder
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC void *SDLCALL SDL_RenderGetMetalLayer(SDL_Renderer * renderer);
|
extern DECLSPEC void *SDLCALL SDL_RenderGetMetalLayer(SDL_Renderer * renderer);
|
||||||
@@ -1606,14 +1853,32 @@ extern DECLSPEC void *SDLCALL SDL_RenderGetMetalLayer(SDL_Renderer * renderer);
|
|||||||
* This function returns `void *`, so SDL doesn't have to include Metal's
|
* This function returns `void *`, so SDL doesn't have to include Metal's
|
||||||
* headers, but it can be safely cast to an `id<MTLRenderCommandEncoder>`.
|
* headers, but it can be safely cast to an `id<MTLRenderCommandEncoder>`.
|
||||||
*
|
*
|
||||||
|
* Note that as of SDL 2.0.18, this will return NULL if Metal refuses to give
|
||||||
|
* SDL a drawable to render to, which might happen if the window is
|
||||||
|
* hidden/minimized/offscreen. This doesn't apply to command encoders for
|
||||||
|
* render targets, just the window's backbacker. Check your return values!
|
||||||
|
*
|
||||||
* \param renderer The renderer to query
|
* \param renderer The renderer to query
|
||||||
* \returns an `id<MTLRenderCommandEncoder>` on success, or NULL if the
|
* \returns an `id<MTLRenderCommandEncoder>` on success, or NULL if the
|
||||||
* renderer isn't a Metal renderer.
|
* renderer isn't a Metal renderer or there was an error.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.8.
|
||||||
*
|
*
|
||||||
* \sa SDL_RenderGetMetalLayer
|
* \sa SDL_RenderGetMetalLayer
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC void *SDLCALL SDL_RenderGetMetalCommandEncoder(SDL_Renderer * renderer);
|
extern DECLSPEC void *SDLCALL SDL_RenderGetMetalCommandEncoder(SDL_Renderer * renderer);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Toggle VSync of the given renderer.
|
||||||
|
*
|
||||||
|
* \param renderer The renderer to toggle
|
||||||
|
* \param vsync 1 for on, 0 for off. All other values are reserved
|
||||||
|
* \returns a 0 int on success, or non-zero on failure
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.18.
|
||||||
|
*/
|
||||||
|
extern DECLSPEC int SDLCALL SDL_RenderSetVSync(SDL_Renderer* renderer, int vsync);
|
||||||
|
|
||||||
/* Ends C function definitions when using C++ */
|
/* Ends C function definitions when using C++ */
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -1,2 +1,2 @@
|
|||||||
#define SDL_REVISION "https://github.com/libsdl-org/SDL.git@25f9ed87ff6947d9576fc9d79dee0784e638ac58"
|
#define SDL_REVISION "https://github.com/libsdl-org/SDL.git@b424665e0899769b200231ba943353a5fee1b6b6"
|
||||||
#define SDL_REVISION_NUMBER 0
|
#define SDL_REVISION_NUMBER 0
|
||||||
|
|||||||
+450
-7
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
Simple DirectMedia Layer
|
Simple DirectMedia Layer
|
||||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
||||||
|
|
||||||
This software is provided 'as-is', without any express or implied
|
This software is provided 'as-is', without any express or implied
|
||||||
warranty. In no event will the authors be held liable for any damages
|
warranty. In no event will the authors be held liable for any damages
|
||||||
@@ -156,25 +156,228 @@ typedef struct SDL_RWops
|
|||||||
*/
|
*/
|
||||||
/* @{ */
|
/* @{ */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Use this function to create a new SDL_RWops structure for reading from
|
||||||
|
* and/or writing to a named file.
|
||||||
|
*
|
||||||
|
* The `mode` string is treated roughly the same as in a call to the C
|
||||||
|
* library's fopen(), even if SDL doesn't happen to use fopen() behind the
|
||||||
|
* scenes.
|
||||||
|
*
|
||||||
|
* Available `mode` strings:
|
||||||
|
*
|
||||||
|
* - "r": Open a file for reading. The file must exist.
|
||||||
|
* - "w": Create an empty file for writing. If a file with the same name
|
||||||
|
* already exists its content is erased and the file is treated as a new
|
||||||
|
* empty file.
|
||||||
|
* - "a": Append to a file. Writing operations append data at the end of the
|
||||||
|
* file. The file is created if it does not exist.
|
||||||
|
* - "r+": Open a file for update both reading and writing. The file must
|
||||||
|
* exist.
|
||||||
|
* - "w+": Create an empty file for both reading and writing. If a file with
|
||||||
|
* the same name already exists its content is erased and the file is
|
||||||
|
* treated as a new empty file.
|
||||||
|
* - "a+": Open a file for reading and appending. All writing operations are
|
||||||
|
* performed at the end of the file, protecting the previous content to be
|
||||||
|
* overwritten. You can reposition (fseek, rewind) the internal pointer to
|
||||||
|
* anywhere in the file for reading, but writing operations will move it
|
||||||
|
* back to the end of file. The file is created if it does not exist.
|
||||||
|
*
|
||||||
|
* **NOTE**: In order to open a file as a binary file, a "b" character has to
|
||||||
|
* be included in the `mode` string. This additional "b" character can either
|
||||||
|
* be appended at the end of the string (thus making the following compound
|
||||||
|
* modes: "rb", "wb", "ab", "r+b", "w+b", "a+b") or be inserted between the
|
||||||
|
* letter and the "+" sign for the mixed modes ("rb+", "wb+", "ab+").
|
||||||
|
* Additional characters may follow the sequence, although they should have no
|
||||||
|
* effect. For example, "t" is sometimes appended to make explicit the file is
|
||||||
|
* a text file.
|
||||||
|
*
|
||||||
|
* This function supports Unicode filenames, but they must be encoded in UTF-8
|
||||||
|
* format, regardless of the underlying operating system.
|
||||||
|
*
|
||||||
|
* As a fallback, SDL_RWFromFile() will transparently open a matching filename
|
||||||
|
* in an Android app's `assets`.
|
||||||
|
*
|
||||||
|
* Closing the SDL_RWops will close the file handle SDL is holding internally.
|
||||||
|
*
|
||||||
|
* \param file a UTF-8 string representing the filename to open
|
||||||
|
* \param mode an ASCII string representing the mode to be used for opening
|
||||||
|
* the file.
|
||||||
|
* \returns a pointer to the SDL_RWops structure that is created, or NULL on
|
||||||
|
* failure; call SDL_GetError() for more information.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
|
* \sa SDL_RWclose
|
||||||
|
* \sa SDL_RWFromConstMem
|
||||||
|
* \sa SDL_RWFromFP
|
||||||
|
* \sa SDL_RWFromMem
|
||||||
|
* \sa SDL_RWread
|
||||||
|
* \sa SDL_RWseek
|
||||||
|
* \sa SDL_RWtell
|
||||||
|
* \sa SDL_RWwrite
|
||||||
|
*/
|
||||||
extern DECLSPEC SDL_RWops *SDLCALL SDL_RWFromFile(const char *file,
|
extern DECLSPEC SDL_RWops *SDLCALL SDL_RWFromFile(const char *file,
|
||||||
const char *mode);
|
const char *mode);
|
||||||
|
|
||||||
#ifdef HAVE_STDIO_H
|
#ifdef HAVE_STDIO_H
|
||||||
extern DECLSPEC SDL_RWops *SDLCALL SDL_RWFromFP(FILE * fp,
|
|
||||||
SDL_bool autoclose);
|
extern DECLSPEC SDL_RWops *SDLCALL SDL_RWFromFP(FILE * fp, SDL_bool autoclose);
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Use this function to create an SDL_RWops structure from a standard I/O file
|
||||||
|
* pointer (stdio.h's `FILE*`).
|
||||||
|
*
|
||||||
|
* This function is not available on Windows, since files opened in an
|
||||||
|
* application on that platform cannot be used by a dynamically linked
|
||||||
|
* library.
|
||||||
|
*
|
||||||
|
* On some platforms, the first parameter is a `void*`, on others, it's a
|
||||||
|
* `FILE*`, depending on what system headers are available to SDL. It is
|
||||||
|
* always intended to be the `FILE*` type from the C runtime's stdio.h.
|
||||||
|
*
|
||||||
|
* \param fp the `FILE*` that feeds the SDL_RWops stream
|
||||||
|
* \param autoclose SDL_TRUE to close the `FILE*` when closing the SDL_RWops,
|
||||||
|
* SDL_FALSE to leave the `FILE*` open when the RWops is
|
||||||
|
* closed
|
||||||
|
* \returns a pointer to the SDL_RWops structure that is created, or NULL on
|
||||||
|
* failure; call SDL_GetError() for more information.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
|
* \sa SDL_RWclose
|
||||||
|
* \sa SDL_RWFromConstMem
|
||||||
|
* \sa SDL_RWFromFile
|
||||||
|
* \sa SDL_RWFromMem
|
||||||
|
* \sa SDL_RWread
|
||||||
|
* \sa SDL_RWseek
|
||||||
|
* \sa SDL_RWtell
|
||||||
|
* \sa SDL_RWwrite
|
||||||
|
*/
|
||||||
extern DECLSPEC SDL_RWops *SDLCALL SDL_RWFromFP(void * fp,
|
extern DECLSPEC SDL_RWops *SDLCALL SDL_RWFromFP(void * fp,
|
||||||
SDL_bool autoclose);
|
SDL_bool autoclose);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Use this function to prepare a read-write memory buffer for use with
|
||||||
|
* SDL_RWops.
|
||||||
|
*
|
||||||
|
* This function sets up an SDL_RWops struct based on a memory area of a
|
||||||
|
* certain size, for both read and write access.
|
||||||
|
*
|
||||||
|
* This memory buffer is not copied by the RWops; the pointer you provide must
|
||||||
|
* remain valid until you close the stream. Closing the stream will not free
|
||||||
|
* the original buffer.
|
||||||
|
*
|
||||||
|
* If you need to make sure the RWops never writes to the memory buffer, you
|
||||||
|
* should use SDL_RWFromConstMem() with a read-only buffer of memory instead.
|
||||||
|
*
|
||||||
|
* \param mem a pointer to a buffer to feed an SDL_RWops stream
|
||||||
|
* \param size the buffer size, in bytes
|
||||||
|
* \returns a pointer to a new SDL_RWops structure, or NULL if it fails; call
|
||||||
|
* SDL_GetError() for more information.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
|
* \sa SDL_RWclose
|
||||||
|
* \sa SDL_RWFromConstMem
|
||||||
|
* \sa SDL_RWFromFile
|
||||||
|
* \sa SDL_RWFromFP
|
||||||
|
* \sa SDL_RWFromMem
|
||||||
|
* \sa SDL_RWread
|
||||||
|
* \sa SDL_RWseek
|
||||||
|
* \sa SDL_RWtell
|
||||||
|
* \sa SDL_RWwrite
|
||||||
|
*/
|
||||||
extern DECLSPEC SDL_RWops *SDLCALL SDL_RWFromMem(void *mem, int size);
|
extern DECLSPEC SDL_RWops *SDLCALL SDL_RWFromMem(void *mem, int size);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Use this function to prepare a read-only memory buffer for use with RWops.
|
||||||
|
*
|
||||||
|
* This function sets up an SDL_RWops struct based on a memory area of a
|
||||||
|
* certain size. It assumes the memory area is not writable.
|
||||||
|
*
|
||||||
|
* Attempting to write to this RWops stream will report an error without
|
||||||
|
* writing to the memory buffer.
|
||||||
|
*
|
||||||
|
* This memory buffer is not copied by the RWops; the pointer you provide must
|
||||||
|
* remain valid until you close the stream. Closing the stream will not free
|
||||||
|
* the original buffer.
|
||||||
|
*
|
||||||
|
* If you need to write to a memory buffer, you should use SDL_RWFromMem()
|
||||||
|
* with a writable buffer of memory instead.
|
||||||
|
*
|
||||||
|
* \param mem a pointer to a read-only buffer to feed an SDL_RWops stream
|
||||||
|
* \param size the buffer size, in bytes
|
||||||
|
* \returns a pointer to a new SDL_RWops structure, or NULL if it fails; call
|
||||||
|
* SDL_GetError() for more information.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
|
* \sa SDL_RWclose
|
||||||
|
* \sa SDL_RWFromConstMem
|
||||||
|
* \sa SDL_RWFromFile
|
||||||
|
* \sa SDL_RWFromFP
|
||||||
|
* \sa SDL_RWFromMem
|
||||||
|
* \sa SDL_RWread
|
||||||
|
* \sa SDL_RWseek
|
||||||
|
* \sa SDL_RWtell
|
||||||
|
*/
|
||||||
extern DECLSPEC SDL_RWops *SDLCALL SDL_RWFromConstMem(const void *mem,
|
extern DECLSPEC SDL_RWops *SDLCALL SDL_RWFromConstMem(const void *mem,
|
||||||
int size);
|
int size);
|
||||||
|
|
||||||
/* @} *//* RWFrom functions */
|
/* @} *//* RWFrom functions */
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Use this function to allocate an empty, unpopulated SDL_RWops structure.
|
||||||
|
*
|
||||||
|
* Applications do not need to use this function unless they are providing
|
||||||
|
* their own SDL_RWops implementation. If you just need a SDL_RWops to
|
||||||
|
* read/write a common data source, you should use the built-in
|
||||||
|
* implementations in SDL, like SDL_RWFromFile() or SDL_RWFromMem(), etc.
|
||||||
|
*
|
||||||
|
* You must free the returned pointer with SDL_FreeRW(). Depending on your
|
||||||
|
* operating system and compiler, there may be a difference between the
|
||||||
|
* malloc() and free() your program uses and the versions SDL calls
|
||||||
|
* internally. Trying to mix the two can cause crashing such as segmentation
|
||||||
|
* faults. Since all SDL_RWops must free themselves when their **close**
|
||||||
|
* method is called, all SDL_RWops must be allocated through this function, so
|
||||||
|
* they can all be freed correctly with SDL_FreeRW().
|
||||||
|
*
|
||||||
|
* \returns a pointer to the allocated memory on success, or NULL on failure;
|
||||||
|
* call SDL_GetError() for more information.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
|
* \sa SDL_FreeRW
|
||||||
|
*/
|
||||||
extern DECLSPEC SDL_RWops *SDLCALL SDL_AllocRW(void);
|
extern DECLSPEC SDL_RWops *SDLCALL SDL_AllocRW(void);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Use this function to free an SDL_RWops structure allocated by
|
||||||
|
* SDL_AllocRW().
|
||||||
|
*
|
||||||
|
* Applications do not need to use this function unless they are providing
|
||||||
|
* their own SDL_RWops implementation. If you just need a SDL_RWops to
|
||||||
|
* read/write a common data source, you should use the built-in
|
||||||
|
* implementations in SDL, like SDL_RWFromFile() or SDL_RWFromMem(), etc, and
|
||||||
|
* call the **close** method on those SDL_RWops pointers when you are done
|
||||||
|
* with them.
|
||||||
|
*
|
||||||
|
* Only use SDL_FreeRW() on pointers returned by SDL_AllocRW(). The pointer is
|
||||||
|
* invalid as soon as this function returns. Any extra memory allocated during
|
||||||
|
* creation of the SDL_RWops is not freed by SDL_FreeRW(); the programmer must
|
||||||
|
* be responsible for managing that memory in their **close** method.
|
||||||
|
*
|
||||||
|
* \param area the SDL_RWops structure to be freed
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
|
* \sa SDL_AllocRW
|
||||||
|
*/
|
||||||
extern DECLSPEC void SDLCALL SDL_FreeRW(SDL_RWops * area);
|
extern DECLSPEC void SDLCALL SDL_FreeRW(SDL_RWops * area);
|
||||||
|
|
||||||
#define RW_SEEK_SET 0 /**< Seek from the beginning of data */
|
#define RW_SEEK_SET 0 /**< Seek from the beginning of data */
|
||||||
@@ -182,14 +385,16 @@ extern DECLSPEC void SDLCALL SDL_FreeRW(SDL_RWops * area);
|
|||||||
#define RW_SEEK_END 2 /**< Seek relative to the end of data */
|
#define RW_SEEK_END 2 /**< Seek relative to the end of data */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Use this macro to get the size of the data stream in an SDL_RWops.
|
* Use this function to get the size of the data stream in an SDL_RWops.
|
||||||
|
*
|
||||||
|
* Prior to SDL 2.0.10, this function was a macro.
|
||||||
*
|
*
|
||||||
* \param context the SDL_RWops to get the size of the data stream from
|
* \param context the SDL_RWops to get the size of the data stream from
|
||||||
* \returns the size of the data stream in the SDL_RWops on success, -1 if
|
* \returns the size of the data stream in the SDL_RWops on success, -1 if
|
||||||
* unknown or a negative error code on failure; call SDL_GetError()
|
* unknown or a negative error code on failure; call SDL_GetError()
|
||||||
* for more information.
|
* for more information.
|
||||||
*
|
*
|
||||||
* \since This function is available since SDL 2.0.0.
|
* \since This function is available since SDL 2.0.10.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC Sint64 SDLCALL SDL_RWsize(SDL_RWops *context);
|
extern DECLSPEC Sint64 SDLCALL SDL_RWsize(SDL_RWops *context);
|
||||||
|
|
||||||
@@ -209,12 +414,16 @@ extern DECLSPEC Sint64 SDLCALL SDL_RWsize(SDL_RWops *context);
|
|||||||
* SDL_RWseek() is actually a wrapper function that calls the SDL_RWops's
|
* SDL_RWseek() is actually a wrapper function that calls the SDL_RWops's
|
||||||
* `seek` method appropriately, to simplify application development.
|
* `seek` method appropriately, to simplify application development.
|
||||||
*
|
*
|
||||||
|
* Prior to SDL 2.0.10, this function was a macro.
|
||||||
|
*
|
||||||
* \param context a pointer to an SDL_RWops structure
|
* \param context a pointer to an SDL_RWops structure
|
||||||
* \param offset an offset in bytes, relative to **whence** location; can be
|
* \param offset an offset in bytes, relative to **whence** location; can be
|
||||||
* negative
|
* negative
|
||||||
* \param whence any of `RW_SEEK_SET`, `RW_SEEK_CUR`, `RW_SEEK_END`
|
* \param whence any of `RW_SEEK_SET`, `RW_SEEK_CUR`, `RW_SEEK_END`
|
||||||
* \returns the final offset in the data stream after the seek or -1 on error.
|
* \returns the final offset in the data stream after the seek or -1 on error.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.10.
|
||||||
|
*
|
||||||
* \sa SDL_RWclose
|
* \sa SDL_RWclose
|
||||||
* \sa SDL_RWFromConstMem
|
* \sa SDL_RWFromConstMem
|
||||||
* \sa SDL_RWFromFile
|
* \sa SDL_RWFromFile
|
||||||
@@ -234,11 +443,15 @@ extern DECLSPEC Sint64 SDLCALL SDL_RWseek(SDL_RWops *context,
|
|||||||
* method, with an offset of 0 bytes from `RW_SEEK_CUR`, to simplify
|
* method, with an offset of 0 bytes from `RW_SEEK_CUR`, to simplify
|
||||||
* application development.
|
* application development.
|
||||||
*
|
*
|
||||||
|
* Prior to SDL 2.0.10, this function was a macro.
|
||||||
|
*
|
||||||
* \param context a SDL_RWops data stream object from which to get the current
|
* \param context a SDL_RWops data stream object from which to get the current
|
||||||
* offset
|
* offset
|
||||||
* \returns the current offset in the stream, or -1 if the information can not
|
* \returns the current offset in the stream, or -1 if the information can not
|
||||||
* be determined.
|
* be determined.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.10.
|
||||||
|
*
|
||||||
* \sa SDL_RWclose
|
* \sa SDL_RWclose
|
||||||
* \sa SDL_RWFromConstMem
|
* \sa SDL_RWFromConstMem
|
||||||
* \sa SDL_RWFromFile
|
* \sa SDL_RWFromFile
|
||||||
@@ -261,6 +474,8 @@ extern DECLSPEC Sint64 SDLCALL SDL_RWtell(SDL_RWops *context);
|
|||||||
* SDL_RWread() is actually a function wrapper that calls the SDL_RWops's
|
* SDL_RWread() is actually a function wrapper that calls the SDL_RWops's
|
||||||
* `read` method appropriately, to simplify application development.
|
* `read` method appropriately, to simplify application development.
|
||||||
*
|
*
|
||||||
|
* Prior to SDL 2.0.10, this function was a macro.
|
||||||
|
*
|
||||||
* \param context a pointer to an SDL_RWops structure
|
* \param context a pointer to an SDL_RWops structure
|
||||||
* \param ptr a pointer to a buffer to read data into
|
* \param ptr a pointer to a buffer to read data into
|
||||||
* \param size the size of each object to read, in bytes
|
* \param size the size of each object to read, in bytes
|
||||||
@@ -268,6 +483,8 @@ extern DECLSPEC Sint64 SDLCALL SDL_RWtell(SDL_RWops *context);
|
|||||||
* \returns the number of objects read, or 0 at error or end of file; call
|
* \returns the number of objects read, or 0 at error or end of file; call
|
||||||
* SDL_GetError() for more information.
|
* SDL_GetError() for more information.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.10.
|
||||||
|
*
|
||||||
* \sa SDL_RWclose
|
* \sa SDL_RWclose
|
||||||
* \sa SDL_RWFromConstMem
|
* \sa SDL_RWFromConstMem
|
||||||
* \sa SDL_RWFromFile
|
* \sa SDL_RWFromFile
|
||||||
@@ -291,6 +508,8 @@ extern DECLSPEC size_t SDLCALL SDL_RWread(SDL_RWops *context,
|
|||||||
* SDL_RWwrite is actually a function wrapper that calls the SDL_RWops's
|
* SDL_RWwrite is actually a function wrapper that calls the SDL_RWops's
|
||||||
* `write` method appropriately, to simplify application development.
|
* `write` method appropriately, to simplify application development.
|
||||||
*
|
*
|
||||||
|
* Prior to SDL 2.0.10, this function was a macro.
|
||||||
|
*
|
||||||
* \param context a pointer to an SDL_RWops structure
|
* \param context a pointer to an SDL_RWops structure
|
||||||
* \param ptr a pointer to a buffer containing data to write
|
* \param ptr a pointer to a buffer containing data to write
|
||||||
* \param size the size of an object to write, in bytes
|
* \param size the size of an object to write, in bytes
|
||||||
@@ -298,6 +517,8 @@ extern DECLSPEC size_t SDLCALL SDL_RWread(SDL_RWops *context,
|
|||||||
* \returns the number of objects written, which will be less than **num** on
|
* \returns the number of objects written, which will be less than **num** on
|
||||||
* error; call SDL_GetError() for more information.
|
* error; call SDL_GetError() for more information.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.10.
|
||||||
|
*
|
||||||
* \sa SDL_RWclose
|
* \sa SDL_RWclose
|
||||||
* \sa SDL_RWFromConstMem
|
* \sa SDL_RWFromConstMem
|
||||||
* \sa SDL_RWFromFile
|
* \sa SDL_RWFromFile
|
||||||
@@ -321,13 +542,14 @@ extern DECLSPEC size_t SDLCALL SDL_RWwrite(SDL_RWops *context,
|
|||||||
* Note that if this fails to flush the stream to disk, this function reports
|
* Note that if this fails to flush the stream to disk, this function reports
|
||||||
* an error, but the SDL_RWops is still invalid once this function returns.
|
* an error, but the SDL_RWops is still invalid once this function returns.
|
||||||
*
|
*
|
||||||
* SDL_RWclose() is actually a macro that calls the SDL_RWops's `close` method
|
* Prior to SDL 2.0.10, this function was a macro.
|
||||||
* appropriately, to simplify application development.
|
|
||||||
*
|
*
|
||||||
* \param context SDL_RWops structure to close
|
* \param context SDL_RWops structure to close
|
||||||
* \returns 0 on success or a negative error code on failure; call
|
* \returns 0 on success or a negative error code on failure; call
|
||||||
* SDL_GetError() for more information.
|
* SDL_GetError() for more information.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.10.
|
||||||
|
*
|
||||||
* \sa SDL_RWFromConstMem
|
* \sa SDL_RWFromConstMem
|
||||||
* \sa SDL_RWFromFile
|
* \sa SDL_RWFromFile
|
||||||
* \sa SDL_RWFromFP
|
* \sa SDL_RWFromFP
|
||||||
@@ -351,6 +573,8 @@ extern DECLSPEC int SDLCALL SDL_RWclose(SDL_RWops *context);
|
|||||||
* \param datasize if not NULL, will store the number of bytes read
|
* \param datasize if not NULL, will store the number of bytes read
|
||||||
* \param freesrc if non-zero, calls SDL_RWclose() on `src` before returning
|
* \param freesrc if non-zero, calls SDL_RWclose() on `src` before returning
|
||||||
* \returns the data, or NULL if there was an error.
|
* \returns the data, or NULL if there was an error.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.6.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC void *SDLCALL SDL_LoadFile_RW(SDL_RWops *src,
|
extern DECLSPEC void *SDLCALL SDL_LoadFile_RW(SDL_RWops *src,
|
||||||
size_t *datasize,
|
size_t *datasize,
|
||||||
@@ -365,9 +589,14 @@ extern DECLSPEC void *SDLCALL SDL_LoadFile_RW(SDL_RWops *src,
|
|||||||
*
|
*
|
||||||
* The data should be freed with SDL_free().
|
* The data should be freed with SDL_free().
|
||||||
*
|
*
|
||||||
|
* Prior to SDL 2.0.10, this function was a macro wrapping around
|
||||||
|
* SDL_LoadFile_RW.
|
||||||
|
*
|
||||||
* \param file the path to read all available data from
|
* \param file the path to read all available data from
|
||||||
* \param datasize if not NULL, will store the number of bytes read
|
* \param datasize if not NULL, will store the number of bytes read
|
||||||
* \returns the data, or NULL if there was an error.
|
* \returns the data, or NULL if there was an error.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.10.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC void *SDLCALL SDL_LoadFile(const char *file, size_t *datasize);
|
extern DECLSPEC void *SDLCALL SDL_LoadFile(const char *file, size_t *datasize);
|
||||||
|
|
||||||
@@ -377,12 +606,114 @@ extern DECLSPEC void *SDLCALL SDL_LoadFile(const char *file, size_t *datasize);
|
|||||||
* Read an item of the specified endianness and return in native format.
|
* Read an item of the specified endianness and return in native format.
|
||||||
*/
|
*/
|
||||||
/* @{ */
|
/* @{ */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Use this function to read a byte from an SDL_RWops.
|
||||||
|
*
|
||||||
|
* \param src the SDL_RWops to read from
|
||||||
|
* \returns the read byte on success or 0 on failure; call SDL_GetError() for
|
||||||
|
* more information.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
|
* \sa SDL_WriteU8
|
||||||
|
*/
|
||||||
extern DECLSPEC Uint8 SDLCALL SDL_ReadU8(SDL_RWops * src);
|
extern DECLSPEC Uint8 SDLCALL SDL_ReadU8(SDL_RWops * src);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Use this function to read 16 bits of little-endian data from an SDL_RWops
|
||||||
|
* and return in native format.
|
||||||
|
*
|
||||||
|
* SDL byteswaps the data only if necessary, so the data returned will be in
|
||||||
|
* the native byte order.
|
||||||
|
*
|
||||||
|
* \param src the stream from which to read data
|
||||||
|
* \returns 16 bits of data in the native byte order of the platform.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
|
* \sa SDL_ReadBE16
|
||||||
|
*/
|
||||||
extern DECLSPEC Uint16 SDLCALL SDL_ReadLE16(SDL_RWops * src);
|
extern DECLSPEC Uint16 SDLCALL SDL_ReadLE16(SDL_RWops * src);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Use this function to read 16 bits of big-endian data from an SDL_RWops and
|
||||||
|
* return in native format.
|
||||||
|
*
|
||||||
|
* SDL byteswaps the data only if necessary, so the data returned will be in
|
||||||
|
* the native byte order.
|
||||||
|
*
|
||||||
|
* \param src the stream from which to read data
|
||||||
|
* \returns 16 bits of data in the native byte order of the platform.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
|
* \sa SDL_ReadLE16
|
||||||
|
*/
|
||||||
extern DECLSPEC Uint16 SDLCALL SDL_ReadBE16(SDL_RWops * src);
|
extern DECLSPEC Uint16 SDLCALL SDL_ReadBE16(SDL_RWops * src);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Use this function to read 32 bits of little-endian data from an SDL_RWops
|
||||||
|
* and return in native format.
|
||||||
|
*
|
||||||
|
* SDL byteswaps the data only if necessary, so the data returned will be in
|
||||||
|
* the native byte order.
|
||||||
|
*
|
||||||
|
* \param src the stream from which to read data
|
||||||
|
* \returns 32 bits of data in the native byte order of the platform.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
|
* \sa SDL_ReadBE32
|
||||||
|
*/
|
||||||
extern DECLSPEC Uint32 SDLCALL SDL_ReadLE32(SDL_RWops * src);
|
extern DECLSPEC Uint32 SDLCALL SDL_ReadLE32(SDL_RWops * src);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Use this function to read 32 bits of big-endian data from an SDL_RWops and
|
||||||
|
* return in native format.
|
||||||
|
*
|
||||||
|
* SDL byteswaps the data only if necessary, so the data returned will be in
|
||||||
|
* the native byte order.
|
||||||
|
*
|
||||||
|
* \param src the stream from which to read data
|
||||||
|
* \returns 32 bits of data in the native byte order of the platform.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
|
* \sa SDL_ReadLE32
|
||||||
|
*/
|
||||||
extern DECLSPEC Uint32 SDLCALL SDL_ReadBE32(SDL_RWops * src);
|
extern DECLSPEC Uint32 SDLCALL SDL_ReadBE32(SDL_RWops * src);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Use this function to read 64 bits of little-endian data from an SDL_RWops
|
||||||
|
* and return in native format.
|
||||||
|
*
|
||||||
|
* SDL byteswaps the data only if necessary, so the data returned will be in
|
||||||
|
* the native byte order.
|
||||||
|
*
|
||||||
|
* \param src the stream from which to read data
|
||||||
|
* \returns 64 bits of data in the native byte order of the platform.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
|
* \sa SDL_ReadBE64
|
||||||
|
*/
|
||||||
extern DECLSPEC Uint64 SDLCALL SDL_ReadLE64(SDL_RWops * src);
|
extern DECLSPEC Uint64 SDLCALL SDL_ReadLE64(SDL_RWops * src);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Use this function to read 64 bits of big-endian data from an SDL_RWops and
|
||||||
|
* return in native format.
|
||||||
|
*
|
||||||
|
* SDL byteswaps the data only if necessary, so the data returned will be in
|
||||||
|
* the native byte order.
|
||||||
|
*
|
||||||
|
* \param src the stream from which to read data
|
||||||
|
* \returns 64 bits of data in the native byte order of the platform.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
|
* \sa SDL_ReadLE64
|
||||||
|
*/
|
||||||
extern DECLSPEC Uint64 SDLCALL SDL_ReadBE64(SDL_RWops * src);
|
extern DECLSPEC Uint64 SDLCALL SDL_ReadBE64(SDL_RWops * src);
|
||||||
/* @} *//* Read endian functions */
|
/* @} *//* Read endian functions */
|
||||||
|
|
||||||
@@ -392,12 +723,124 @@ extern DECLSPEC Uint64 SDLCALL SDL_ReadBE64(SDL_RWops * src);
|
|||||||
* Write an item of native format to the specified endianness.
|
* Write an item of native format to the specified endianness.
|
||||||
*/
|
*/
|
||||||
/* @{ */
|
/* @{ */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Use this function to write a byte to an SDL_RWops.
|
||||||
|
*
|
||||||
|
* \param dst the SDL_RWops to write to
|
||||||
|
* \param value the byte value to write
|
||||||
|
* \returns 1 on success or 0 on failure; call SDL_GetError() for more
|
||||||
|
* information.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
|
* \sa SDL_ReadU8
|
||||||
|
*/
|
||||||
extern DECLSPEC size_t SDLCALL SDL_WriteU8(SDL_RWops * dst, Uint8 value);
|
extern DECLSPEC size_t SDLCALL SDL_WriteU8(SDL_RWops * dst, Uint8 value);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Use this function to write 16 bits in native format to a SDL_RWops as
|
||||||
|
* little-endian data.
|
||||||
|
*
|
||||||
|
* SDL byteswaps the data only if necessary, so the application always
|
||||||
|
* specifies native format, and the data written will be in little-endian
|
||||||
|
* format.
|
||||||
|
*
|
||||||
|
* \param dst the stream to which data will be written
|
||||||
|
* \param value the data to be written, in native format
|
||||||
|
* \returns 1 on successful write, 0 on error.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
|
* \sa SDL_WriteBE16
|
||||||
|
*/
|
||||||
extern DECLSPEC size_t SDLCALL SDL_WriteLE16(SDL_RWops * dst, Uint16 value);
|
extern DECLSPEC size_t SDLCALL SDL_WriteLE16(SDL_RWops * dst, Uint16 value);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Use this function to write 16 bits in native format to a SDL_RWops as
|
||||||
|
* big-endian data.
|
||||||
|
*
|
||||||
|
* SDL byteswaps the data only if necessary, so the application always
|
||||||
|
* specifies native format, and the data written will be in big-endian format.
|
||||||
|
*
|
||||||
|
* \param dst the stream to which data will be written
|
||||||
|
* \param value the data to be written, in native format
|
||||||
|
* \returns 1 on successful write, 0 on error.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
|
* \sa SDL_WriteLE16
|
||||||
|
*/
|
||||||
extern DECLSPEC size_t SDLCALL SDL_WriteBE16(SDL_RWops * dst, Uint16 value);
|
extern DECLSPEC size_t SDLCALL SDL_WriteBE16(SDL_RWops * dst, Uint16 value);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Use this function to write 32 bits in native format to a SDL_RWops as
|
||||||
|
* little-endian data.
|
||||||
|
*
|
||||||
|
* SDL byteswaps the data only if necessary, so the application always
|
||||||
|
* specifies native format, and the data written will be in little-endian
|
||||||
|
* format.
|
||||||
|
*
|
||||||
|
* \param dst the stream to which data will be written
|
||||||
|
* \param value the data to be written, in native format
|
||||||
|
* \returns 1 on successful write, 0 on error.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
|
* \sa SDL_WriteBE32
|
||||||
|
*/
|
||||||
extern DECLSPEC size_t SDLCALL SDL_WriteLE32(SDL_RWops * dst, Uint32 value);
|
extern DECLSPEC size_t SDLCALL SDL_WriteLE32(SDL_RWops * dst, Uint32 value);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Use this function to write 32 bits in native format to a SDL_RWops as
|
||||||
|
* big-endian data.
|
||||||
|
*
|
||||||
|
* SDL byteswaps the data only if necessary, so the application always
|
||||||
|
* specifies native format, and the data written will be in big-endian format.
|
||||||
|
*
|
||||||
|
* \param dst the stream to which data will be written
|
||||||
|
* \param value the data to be written, in native format
|
||||||
|
* \returns 1 on successful write, 0 on error.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
|
* \sa SDL_WriteLE32
|
||||||
|
*/
|
||||||
extern DECLSPEC size_t SDLCALL SDL_WriteBE32(SDL_RWops * dst, Uint32 value);
|
extern DECLSPEC size_t SDLCALL SDL_WriteBE32(SDL_RWops * dst, Uint32 value);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Use this function to write 64 bits in native format to a SDL_RWops as
|
||||||
|
* little-endian data.
|
||||||
|
*
|
||||||
|
* SDL byteswaps the data only if necessary, so the application always
|
||||||
|
* specifies native format, and the data written will be in little-endian
|
||||||
|
* format.
|
||||||
|
*
|
||||||
|
* \param dst the stream to which data will be written
|
||||||
|
* \param value the data to be written, in native format
|
||||||
|
* \returns 1 on successful write, 0 on error.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
|
* \sa SDL_WriteBE64
|
||||||
|
*/
|
||||||
extern DECLSPEC size_t SDLCALL SDL_WriteLE64(SDL_RWops * dst, Uint64 value);
|
extern DECLSPEC size_t SDLCALL SDL_WriteLE64(SDL_RWops * dst, Uint64 value);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Use this function to write 64 bits in native format to a SDL_RWops as
|
||||||
|
* big-endian data.
|
||||||
|
*
|
||||||
|
* SDL byteswaps the data only if necessary, so the application always
|
||||||
|
* specifies native format, and the data written will be in big-endian format.
|
||||||
|
*
|
||||||
|
* \param dst the stream to which data will be written
|
||||||
|
* \param value the data to be written, in native format
|
||||||
|
* \returns 1 on successful write, 0 on error.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
|
* \sa SDL_WriteLE64
|
||||||
|
*/
|
||||||
extern DECLSPEC size_t SDLCALL SDL_WriteBE64(SDL_RWops * dst, Uint64 value);
|
extern DECLSPEC size_t SDLCALL SDL_WriteBE64(SDL_RWops * dst, Uint64 value);
|
||||||
/* @} *//* Write endian functions */
|
/* @} *//* Write endian functions */
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
Simple DirectMedia Layer
|
Simple DirectMedia Layer
|
||||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
||||||
|
|
||||||
This software is provided 'as-is', without any express or implied
|
This software is provided 'as-is', without any express or implied
|
||||||
warranty. In no event will the authors be held liable for any damages
|
warranty. In no event will the authors be held liable for any damages
|
||||||
|
|||||||
+31
-1
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
Simple DirectMedia Layer
|
Simple DirectMedia Layer
|
||||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
||||||
|
|
||||||
This software is provided 'as-is', without any express or implied
|
This software is provided 'as-is', without any express or implied
|
||||||
warranty. In no event will the authors be held liable for any damages
|
warranty. In no event will the authors be held liable for any damages
|
||||||
@@ -133,6 +133,8 @@ typedef enum
|
|||||||
* In particular, you are guaranteed that the sensor list won't change, so the
|
* In particular, you are guaranteed that the sensor list won't change, so the
|
||||||
* API functions that take a sensor index will be valid, and sensor events
|
* API functions that take a sensor index will be valid, and sensor events
|
||||||
* will not be delivered.
|
* will not be delivered.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.14.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC void SDLCALL SDL_LockSensors(void);
|
extern DECLSPEC void SDLCALL SDL_LockSensors(void);
|
||||||
extern DECLSPEC void SDLCALL SDL_UnlockSensors(void);
|
extern DECLSPEC void SDLCALL SDL_UnlockSensors(void);
|
||||||
@@ -141,6 +143,8 @@ extern DECLSPEC void SDLCALL SDL_UnlockSensors(void);
|
|||||||
* Count the number of sensors attached to the system right now.
|
* Count the number of sensors attached to the system right now.
|
||||||
*
|
*
|
||||||
* \returns the number of sensors detected.
|
* \returns the number of sensors detected.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.9.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC int SDLCALL SDL_NumSensors(void);
|
extern DECLSPEC int SDLCALL SDL_NumSensors(void);
|
||||||
|
|
||||||
@@ -149,6 +153,8 @@ extern DECLSPEC int SDLCALL SDL_NumSensors(void);
|
|||||||
*
|
*
|
||||||
* \param device_index The sensor to obtain name from
|
* \param device_index The sensor to obtain name from
|
||||||
* \returns the sensor name, or NULL if `device_index` is out of range.
|
* \returns the sensor name, or NULL if `device_index` is out of range.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.9.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC const char *SDLCALL SDL_SensorGetDeviceName(int device_index);
|
extern DECLSPEC const char *SDLCALL SDL_SensorGetDeviceName(int device_index);
|
||||||
|
|
||||||
@@ -158,6 +164,8 @@ extern DECLSPEC const char *SDLCALL SDL_SensorGetDeviceName(int device_index);
|
|||||||
* \param device_index The sensor to get the type from
|
* \param device_index The sensor to get the type from
|
||||||
* \returns the SDL_SensorType, or `SDL_SENSOR_INVALID` if `device_index` is
|
* \returns the SDL_SensorType, or `SDL_SENSOR_INVALID` if `device_index` is
|
||||||
* out of range.
|
* out of range.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.9.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC SDL_SensorType SDLCALL SDL_SensorGetDeviceType(int device_index);
|
extern DECLSPEC SDL_SensorType SDLCALL SDL_SensorGetDeviceType(int device_index);
|
||||||
|
|
||||||
@@ -167,6 +175,8 @@ extern DECLSPEC SDL_SensorType SDLCALL SDL_SensorGetDeviceType(int device_index)
|
|||||||
* \param device_index The sensor to check
|
* \param device_index The sensor to check
|
||||||
* \returns the sensor platform dependent type, or -1 if `device_index` is out
|
* \returns the sensor platform dependent type, or -1 if `device_index` is out
|
||||||
* of range.
|
* of range.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.9.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC int SDLCALL SDL_SensorGetDeviceNonPortableType(int device_index);
|
extern DECLSPEC int SDLCALL SDL_SensorGetDeviceNonPortableType(int device_index);
|
||||||
|
|
||||||
@@ -175,6 +185,8 @@ extern DECLSPEC int SDLCALL SDL_SensorGetDeviceNonPortableType(int device_index)
|
|||||||
*
|
*
|
||||||
* \param device_index The sensor to get instance id from
|
* \param device_index The sensor to get instance id from
|
||||||
* \returns the sensor instance ID, or -1 if `device_index` is out of range.
|
* \returns the sensor instance ID, or -1 if `device_index` is out of range.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.9.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC SDL_SensorID SDLCALL SDL_SensorGetDeviceInstanceID(int device_index);
|
extern DECLSPEC SDL_SensorID SDLCALL SDL_SensorGetDeviceInstanceID(int device_index);
|
||||||
|
|
||||||
@@ -183,6 +195,8 @@ extern DECLSPEC SDL_SensorID SDLCALL SDL_SensorGetDeviceInstanceID(int device_in
|
|||||||
*
|
*
|
||||||
* \param device_index The sensor to open
|
* \param device_index The sensor to open
|
||||||
* \returns an SDL_Sensor sensor object, or NULL if an error occurred.
|
* \returns an SDL_Sensor sensor object, or NULL if an error occurred.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.9.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC SDL_Sensor *SDLCALL SDL_SensorOpen(int device_index);
|
extern DECLSPEC SDL_Sensor *SDLCALL SDL_SensorOpen(int device_index);
|
||||||
|
|
||||||
@@ -191,6 +205,8 @@ extern DECLSPEC SDL_Sensor *SDLCALL SDL_SensorOpen(int device_index);
|
|||||||
*
|
*
|
||||||
* \param instance_id The sensor from instance id
|
* \param instance_id The sensor from instance id
|
||||||
* \returns an SDL_Sensor object.
|
* \returns an SDL_Sensor object.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.9.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC SDL_Sensor *SDLCALL SDL_SensorFromInstanceID(SDL_SensorID instance_id);
|
extern DECLSPEC SDL_Sensor *SDLCALL SDL_SensorFromInstanceID(SDL_SensorID instance_id);
|
||||||
|
|
||||||
@@ -199,6 +215,8 @@ extern DECLSPEC SDL_Sensor *SDLCALL SDL_SensorFromInstanceID(SDL_SensorID instan
|
|||||||
*
|
*
|
||||||
* \param sensor The SDL_Sensor object
|
* \param sensor The SDL_Sensor object
|
||||||
* \returns the sensor name, or NULL if `sensor` is NULL.
|
* \returns the sensor name, or NULL if `sensor` is NULL.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.9.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC const char *SDLCALL SDL_SensorGetName(SDL_Sensor *sensor);
|
extern DECLSPEC const char *SDLCALL SDL_SensorGetName(SDL_Sensor *sensor);
|
||||||
|
|
||||||
@@ -208,6 +226,8 @@ extern DECLSPEC const char *SDLCALL SDL_SensorGetName(SDL_Sensor *sensor);
|
|||||||
* \param sensor The SDL_Sensor object to inspect
|
* \param sensor The SDL_Sensor object to inspect
|
||||||
* \returns the SDL_SensorType type, or `SDL_SENSOR_INVALID` if `sensor` is
|
* \returns the SDL_SensorType type, or `SDL_SENSOR_INVALID` if `sensor` is
|
||||||
* NULL.
|
* NULL.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.9.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC SDL_SensorType SDLCALL SDL_SensorGetType(SDL_Sensor *sensor);
|
extern DECLSPEC SDL_SensorType SDLCALL SDL_SensorGetType(SDL_Sensor *sensor);
|
||||||
|
|
||||||
@@ -216,6 +236,8 @@ extern DECLSPEC SDL_SensorType SDLCALL SDL_SensorGetType(SDL_Sensor *sensor);
|
|||||||
*
|
*
|
||||||
* \param sensor The SDL_Sensor object to inspect
|
* \param sensor The SDL_Sensor object to inspect
|
||||||
* \returns the sensor platform dependent type, or -1 if `sensor` is NULL.
|
* \returns the sensor platform dependent type, or -1 if `sensor` is NULL.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.9.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC int SDLCALL SDL_SensorGetNonPortableType(SDL_Sensor *sensor);
|
extern DECLSPEC int SDLCALL SDL_SensorGetNonPortableType(SDL_Sensor *sensor);
|
||||||
|
|
||||||
@@ -224,6 +246,8 @@ extern DECLSPEC int SDLCALL SDL_SensorGetNonPortableType(SDL_Sensor *sensor);
|
|||||||
*
|
*
|
||||||
* \param sensor The SDL_Sensor object to inspect
|
* \param sensor The SDL_Sensor object to inspect
|
||||||
* \returns the sensor instance ID, or -1 if `sensor` is NULL.
|
* \returns the sensor instance ID, or -1 if `sensor` is NULL.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.9.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC SDL_SensorID SDLCALL SDL_SensorGetInstanceID(SDL_Sensor *sensor);
|
extern DECLSPEC SDL_SensorID SDLCALL SDL_SensorGetInstanceID(SDL_Sensor *sensor);
|
||||||
|
|
||||||
@@ -236,6 +260,8 @@ extern DECLSPEC SDL_SensorID SDLCALL SDL_SensorGetInstanceID(SDL_Sensor *sensor)
|
|||||||
* \param data A pointer filled with the current sensor state
|
* \param data A pointer filled with the current sensor state
|
||||||
* \param num_values The number of values to write to data
|
* \param num_values The number of values to write to data
|
||||||
* \returns 0 or -1 if an error occurred.
|
* \returns 0 or -1 if an error occurred.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.9.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC int SDLCALL SDL_SensorGetData(SDL_Sensor * sensor, float *data, int num_values);
|
extern DECLSPEC int SDLCALL SDL_SensorGetData(SDL_Sensor * sensor, float *data, int num_values);
|
||||||
|
|
||||||
@@ -243,6 +269,8 @@ extern DECLSPEC int SDLCALL SDL_SensorGetData(SDL_Sensor * sensor, float *data,
|
|||||||
* Close a sensor previously opened with SDL_SensorOpen().
|
* Close a sensor previously opened with SDL_SensorOpen().
|
||||||
*
|
*
|
||||||
* \param sensor The SDL_Sensor object to close
|
* \param sensor The SDL_Sensor object to close
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.9.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC void SDLCALL SDL_SensorClose(SDL_Sensor * sensor);
|
extern DECLSPEC void SDLCALL SDL_SensorClose(SDL_Sensor * sensor);
|
||||||
|
|
||||||
@@ -254,6 +282,8 @@ extern DECLSPEC void SDLCALL SDL_SensorClose(SDL_Sensor * sensor);
|
|||||||
*
|
*
|
||||||
* This needs to be called from the thread that initialized the sensor
|
* This needs to be called from the thread that initialized the sensor
|
||||||
* subsystem.
|
* subsystem.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.9.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC void SDLCALL SDL_SensorUpdate(void);
|
extern DECLSPEC void SDLCALL SDL_SensorUpdate(void);
|
||||||
|
|
||||||
|
|||||||
+9
-1
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
Simple DirectMedia Layer
|
Simple DirectMedia Layer
|
||||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
||||||
|
|
||||||
This software is provided 'as-is', without any express or implied
|
This software is provided 'as-is', without any express or implied
|
||||||
warranty. In no event will the authors be held liable for any damages
|
warranty. In no event will the authors be held liable for any damages
|
||||||
@@ -62,6 +62,8 @@ extern "C" {
|
|||||||
* and ::SDL_WINDOW_FULLSCREEN is always unset.
|
* and ::SDL_WINDOW_FULLSCREEN is always unset.
|
||||||
* \return the window created, or NULL if window creation failed.
|
* \return the window created, or NULL if window creation failed.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_DestroyWindow
|
* \sa SDL_DestroyWindow
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC SDL_Window * SDLCALL SDL_CreateShapedWindow(const char *title,unsigned int x,unsigned int y,unsigned int w,unsigned int h,Uint32 flags);
|
extern DECLSPEC SDL_Window * SDLCALL SDL_CreateShapedWindow(const char *title,unsigned int x,unsigned int y,unsigned int w,unsigned int h,Uint32 flags);
|
||||||
@@ -73,6 +75,8 @@ extern DECLSPEC SDL_Window * SDLCALL SDL_CreateShapedWindow(const char *title,un
|
|||||||
* \return SDL_TRUE if the window is a window that can be shaped, SDL_FALSE if
|
* \return SDL_TRUE if the window is a window that can be shaped, SDL_FALSE if
|
||||||
* the window is unshaped or NULL.
|
* the window is unshaped or NULL.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_CreateShapedWindow
|
* \sa SDL_CreateShapedWindow
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC SDL_bool SDLCALL SDL_IsShapedWindow(const SDL_Window *window);
|
extern DECLSPEC SDL_bool SDLCALL SDL_IsShapedWindow(const SDL_Window *window);
|
||||||
@@ -116,6 +120,8 @@ typedef struct SDL_WindowShapeMode {
|
|||||||
* argument, or SDL_NONSHAPEABLE_WINDOW if the SDL_Window given does
|
* argument, or SDL_NONSHAPEABLE_WINDOW if the SDL_Window given does
|
||||||
* not reference a valid shaped window.
|
* not reference a valid shaped window.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_WindowShapeMode
|
* \sa SDL_WindowShapeMode
|
||||||
* \sa SDL_GetShapedWindowMode
|
* \sa SDL_GetShapedWindowMode
|
||||||
*/
|
*/
|
||||||
@@ -133,6 +139,8 @@ extern DECLSPEC int SDLCALL SDL_SetWindowShape(SDL_Window *window,SDL_Surface *s
|
|||||||
* window, or SDL_WINDOW_LACKS_SHAPE if the SDL_Window given is a
|
* window, or SDL_WINDOW_LACKS_SHAPE if the SDL_Window given is a
|
||||||
* shapeable window currently lacking a shape.
|
* shapeable window currently lacking a shape.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_WindowShapeMode
|
* \sa SDL_WindowShapeMode
|
||||||
* \sa SDL_SetWindowShape
|
* \sa SDL_SetWindowShape
|
||||||
*/
|
*/
|
||||||
|
|||||||
+46
-21
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
Simple DirectMedia Layer
|
Simple DirectMedia Layer
|
||||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
||||||
|
|
||||||
This software is provided 'as-is', without any express or implied
|
This software is provided 'as-is', without any express or implied
|
||||||
warranty. In no event will the authors be held liable for any damages
|
warranty. In no event will the authors be held liable for any damages
|
||||||
@@ -115,6 +115,17 @@ char *alloca();
|
|||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if the compiler supports a given builtin.
|
||||||
|
* Supported by virtually all clang versions and recent gcc. Use this
|
||||||
|
* instead of checking the clang version if possible.
|
||||||
|
*/
|
||||||
|
#ifdef __has_builtin
|
||||||
|
#define _SDL_HAS_BUILTIN(x) __has_builtin(x)
|
||||||
|
#else
|
||||||
|
#define _SDL_HAS_BUILTIN(x) 0
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The number of elements in an array.
|
* The number of elements in an array.
|
||||||
*/
|
*/
|
||||||
@@ -404,6 +415,8 @@ typedef void (SDLCALL *SDL_free_func)(void *mem);
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the current set of SDL memory functions
|
* Get the current set of SDL memory functions
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.7.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC void SDLCALL SDL_GetMemoryFunctions(SDL_malloc_func *malloc_func,
|
extern DECLSPEC void SDLCALL SDL_GetMemoryFunctions(SDL_malloc_func *malloc_func,
|
||||||
SDL_calloc_func *calloc_func,
|
SDL_calloc_func *calloc_func,
|
||||||
@@ -412,6 +425,8 @@ extern DECLSPEC void SDLCALL SDL_GetMemoryFunctions(SDL_malloc_func *malloc_func
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Replace SDL's memory allocation functions with a custom set
|
* Replace SDL's memory allocation functions with a custom set
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.7.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC int SDLCALL SDL_SetMemoryFunctions(SDL_malloc_func malloc_func,
|
extern DECLSPEC int SDLCALL SDL_SetMemoryFunctions(SDL_malloc_func malloc_func,
|
||||||
SDL_calloc_func calloc_func,
|
SDL_calloc_func calloc_func,
|
||||||
@@ -420,6 +435,8 @@ extern DECLSPEC int SDLCALL SDL_SetMemoryFunctions(SDL_malloc_func malloc_func,
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the number of outstanding (unfreed) allocations
|
* Get the number of outstanding (unfreed) allocations
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.7.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC int SDLCALL SDL_GetNumAllocations(void);
|
extern DECLSPEC int SDLCALL SDL_GetNumAllocations(void);
|
||||||
|
|
||||||
@@ -430,10 +447,10 @@ extern DECLSPEC void SDLCALL SDL_qsort(void *base, size_t nmemb, size_t size, in
|
|||||||
|
|
||||||
extern DECLSPEC int SDLCALL SDL_abs(int x);
|
extern DECLSPEC int SDLCALL SDL_abs(int x);
|
||||||
|
|
||||||
/* !!! FIXME: these have side effects. You probably shouldn't use them. */
|
/* NOTE: these double-evaluate their arguments, so you should never have side effects in the parameters */
|
||||||
/* !!! FIXME: Maybe we do forceinline functions of SDL_mini, SDL_minf, etc? */
|
|
||||||
#define SDL_min(x, y) (((x) < (y)) ? (x) : (y))
|
#define SDL_min(x, y) (((x) < (y)) ? (x) : (y))
|
||||||
#define SDL_max(x, y) (((x) > (y)) ? (x) : (y))
|
#define SDL_max(x, y) (((x) > (y)) ? (x) : (y))
|
||||||
|
#define SDL_clamp(x, a, b) (((x) < (a)) ? (a) : (((x) > (b)) ? (b) : (x)))
|
||||||
|
|
||||||
extern DECLSPEC int SDLCALL SDL_isalpha(int x);
|
extern DECLSPEC int SDLCALL SDL_isalpha(int x);
|
||||||
extern DECLSPEC int SDLCALL SDL_isalnum(int x);
|
extern DECLSPEC int SDLCALL SDL_isalnum(int x);
|
||||||
@@ -479,25 +496,13 @@ SDL_FORCE_INLINE void SDL_memset4(void *dst, Uint32 val, size_t dwords)
|
|||||||
if (dwords == 0) {
|
if (dwords == 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* !!! FIXME: there are better ways to do this, but this is just to clean this up for now. */
|
|
||||||
#ifdef __clang__
|
|
||||||
#pragma clang diagnostic push
|
|
||||||
#pragma clang diagnostic ignored "-Wimplicit-fallthrough"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
switch (dwords % 4) {
|
switch (dwords % 4) {
|
||||||
case 0: do { *_p++ = _val; /* fallthrough */
|
case 0: do { *_p++ = _val; SDL_FALLTHROUGH;
|
||||||
case 3: *_p++ = _val; /* fallthrough */
|
case 3: *_p++ = _val; SDL_FALLTHROUGH;
|
||||||
case 2: *_p++ = _val; /* fallthrough */
|
case 2: *_p++ = _val; SDL_FALLTHROUGH;
|
||||||
case 1: *_p++ = _val; /* fallthrough */
|
case 1: *_p++ = _val;
|
||||||
} while ( --_n );
|
} while ( --_n );
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __clang__
|
|
||||||
#pragma clang diagnostic pop
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -555,6 +560,8 @@ extern DECLSPEC int SDLCALL SDL_sscanf(const char *text, SDL_SCANF_FORMAT_STRING
|
|||||||
extern DECLSPEC int SDLCALL SDL_vsscanf(const char *text, const char *fmt, va_list ap);
|
extern DECLSPEC int SDLCALL SDL_vsscanf(const char *text, const char *fmt, va_list ap);
|
||||||
extern DECLSPEC int SDLCALL SDL_snprintf(SDL_OUT_Z_CAP(maxlen) char *text, size_t maxlen, SDL_PRINTF_FORMAT_STRING const char *fmt, ... ) SDL_PRINTF_VARARG_FUNC(3);
|
extern DECLSPEC int SDLCALL SDL_snprintf(SDL_OUT_Z_CAP(maxlen) char *text, size_t maxlen, SDL_PRINTF_FORMAT_STRING const char *fmt, ... ) SDL_PRINTF_VARARG_FUNC(3);
|
||||||
extern DECLSPEC int SDLCALL SDL_vsnprintf(SDL_OUT_Z_CAP(maxlen) char *text, size_t maxlen, const char *fmt, va_list ap);
|
extern DECLSPEC int SDLCALL SDL_vsnprintf(SDL_OUT_Z_CAP(maxlen) char *text, size_t maxlen, const char *fmt, va_list ap);
|
||||||
|
extern DECLSPEC int SDLCALL SDL_asprintf(char **strp, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(2);
|
||||||
|
extern DECLSPEC int SDLCALL SDL_vasprintf(char **strp, const char *fmt, va_list ap);
|
||||||
|
|
||||||
#ifndef HAVE_M_PI
|
#ifndef HAVE_M_PI
|
||||||
#ifndef M_PI
|
#ifndef M_PI
|
||||||
@@ -562,14 +569,28 @@ extern DECLSPEC int SDLCALL SDL_vsnprintf(SDL_OUT_Z_CAP(maxlen) char *text, size
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Use this function to compute arc cosine of `x`.
|
||||||
|
*
|
||||||
|
* The definition of `y = acos(x)` is `x = cos(y)`.
|
||||||
|
*
|
||||||
|
* Domain: `-1 <= x <= 1`
|
||||||
|
*
|
||||||
|
* Range: `0 <= y <= Pi`
|
||||||
|
*
|
||||||
|
* \param x floating point value, in radians.
|
||||||
|
* \returns arc cosine of `x`.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.2.
|
||||||
|
*/
|
||||||
extern DECLSPEC double SDLCALL SDL_acos(double x);
|
extern DECLSPEC double SDLCALL SDL_acos(double x);
|
||||||
extern DECLSPEC float SDLCALL SDL_acosf(float x);
|
extern DECLSPEC float SDLCALL SDL_acosf(float x);
|
||||||
extern DECLSPEC double SDLCALL SDL_asin(double x);
|
extern DECLSPEC double SDLCALL SDL_asin(double x);
|
||||||
extern DECLSPEC float SDLCALL SDL_asinf(float x);
|
extern DECLSPEC float SDLCALL SDL_asinf(float x);
|
||||||
extern DECLSPEC double SDLCALL SDL_atan(double x);
|
extern DECLSPEC double SDLCALL SDL_atan(double x);
|
||||||
extern DECLSPEC float SDLCALL SDL_atanf(float x);
|
extern DECLSPEC float SDLCALL SDL_atanf(float x);
|
||||||
extern DECLSPEC double SDLCALL SDL_atan2(double x, double y);
|
extern DECLSPEC double SDLCALL SDL_atan2(double y, double x);
|
||||||
extern DECLSPEC float SDLCALL SDL_atan2f(float x, float y);
|
extern DECLSPEC float SDLCALL SDL_atan2f(float y, float x);
|
||||||
extern DECLSPEC double SDLCALL SDL_ceil(double x);
|
extern DECLSPEC double SDLCALL SDL_ceil(double x);
|
||||||
extern DECLSPEC float SDLCALL SDL_ceilf(float x);
|
extern DECLSPEC float SDLCALL SDL_ceilf(float x);
|
||||||
extern DECLSPEC double SDLCALL SDL_copysign(double x, double y);
|
extern DECLSPEC double SDLCALL SDL_copysign(double x, double y);
|
||||||
@@ -619,9 +640,12 @@ extern DECLSPEC int SDLCALL SDL_iconv_close(SDL_iconv_t cd);
|
|||||||
extern DECLSPEC size_t SDLCALL SDL_iconv(SDL_iconv_t cd, const char **inbuf,
|
extern DECLSPEC size_t SDLCALL SDL_iconv(SDL_iconv_t cd, const char **inbuf,
|
||||||
size_t * inbytesleft, char **outbuf,
|
size_t * inbytesleft, char **outbuf,
|
||||||
size_t * outbytesleft);
|
size_t * outbytesleft);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function converts a string between encodings in one pass, returning a
|
* This function converts a string between encodings in one pass, returning a
|
||||||
* string that must be freed with SDL_free() or NULL on error.
|
* string that must be freed with SDL_free() or NULL on error.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC char *SDLCALL SDL_iconv_string(const char *tocode,
|
extern DECLSPEC char *SDLCALL SDL_iconv_string(const char *tocode,
|
||||||
const char *fromcode,
|
const char *fromcode,
|
||||||
@@ -630,6 +654,7 @@ extern DECLSPEC char *SDLCALL SDL_iconv_string(const char *tocode,
|
|||||||
#define SDL_iconv_utf8_locale(S) SDL_iconv_string("", "UTF-8", S, SDL_strlen(S)+1)
|
#define SDL_iconv_utf8_locale(S) SDL_iconv_string("", "UTF-8", S, SDL_strlen(S)+1)
|
||||||
#define SDL_iconv_utf8_ucs2(S) (Uint16 *)SDL_iconv_string("UCS-2-INTERNAL", "UTF-8", S, SDL_strlen(S)+1)
|
#define SDL_iconv_utf8_ucs2(S) (Uint16 *)SDL_iconv_string("UCS-2-INTERNAL", "UTF-8", S, SDL_strlen(S)+1)
|
||||||
#define SDL_iconv_utf8_ucs4(S) (Uint32 *)SDL_iconv_string("UCS-4-INTERNAL", "UTF-8", S, SDL_strlen(S)+1)
|
#define SDL_iconv_utf8_ucs4(S) (Uint32 *)SDL_iconv_string("UCS-4-INTERNAL", "UTF-8", S, SDL_strlen(S)+1)
|
||||||
|
#define SDL_iconv_wchar_utf8(S) SDL_iconv_string("UTF-8", "WCHAR_T", (char *)S, (SDL_wcslen(S)+1)*sizeof(wchar_t))
|
||||||
|
|
||||||
/* force builds using Clang's static analysis tools to use literal C runtime
|
/* force builds using Clang's static analysis tools to use literal C runtime
|
||||||
here, since there are possibly tests that are ineffective otherwise. */
|
here, since there are possibly tests that are ineffective otherwise. */
|
||||||
|
|||||||
+115
-7
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
Simple DirectMedia Layer
|
Simple DirectMedia Layer
|
||||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
||||||
|
|
||||||
This software is provided 'as-is', without any express or implied
|
This software is provided 'as-is', without any express or implied
|
||||||
warranty. In no event will the authors be held liable for any damages
|
warranty. In no event will the authors be held liable for any damages
|
||||||
@@ -149,6 +149,8 @@ typedef enum
|
|||||||
* \returns the new SDL_Surface structure that is created or NULL if it fails;
|
* \returns the new SDL_Surface structure that is created or NULL if it fails;
|
||||||
* call SDL_GetError() for more information.
|
* call SDL_GetError() for more information.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_CreateRGBSurfaceFrom
|
* \sa SDL_CreateRGBSurfaceFrom
|
||||||
* \sa SDL_CreateRGBSurfaceWithFormat
|
* \sa SDL_CreateRGBSurfaceWithFormat
|
||||||
* \sa SDL_FreeSurface
|
* \sa SDL_FreeSurface
|
||||||
@@ -159,6 +161,7 @@ extern DECLSPEC SDL_Surface *SDLCALL SDL_CreateRGBSurface
|
|||||||
|
|
||||||
|
|
||||||
/* !!! FIXME for 2.1: why does this ask for depth? Format provides that. */
|
/* !!! FIXME for 2.1: why does this ask for depth? Format provides that. */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Allocate a new RGB surface with a specific pixel format.
|
* Allocate a new RGB surface with a specific pixel format.
|
||||||
*
|
*
|
||||||
@@ -174,6 +177,8 @@ extern DECLSPEC SDL_Surface *SDLCALL SDL_CreateRGBSurface
|
|||||||
* \returns the new SDL_Surface structure that is created or NULL if it fails;
|
* \returns the new SDL_Surface structure that is created or NULL if it fails;
|
||||||
* call SDL_GetError() for more information.
|
* call SDL_GetError() for more information.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.5.
|
||||||
|
*
|
||||||
* \sa SDL_CreateRGBSurface
|
* \sa SDL_CreateRGBSurface
|
||||||
* \sa SDL_CreateRGBSurfaceFrom
|
* \sa SDL_CreateRGBSurfaceFrom
|
||||||
* \sa SDL_FreeSurface
|
* \sa SDL_FreeSurface
|
||||||
@@ -203,6 +208,8 @@ extern DECLSPEC SDL_Surface *SDLCALL SDL_CreateRGBSurfaceWithFormat
|
|||||||
* \returns the new SDL_Surface structure that is created or NULL if it fails;
|
* \returns the new SDL_Surface structure that is created or NULL if it fails;
|
||||||
* call SDL_GetError() for more information.
|
* call SDL_GetError() for more information.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_CreateRGBSurface
|
* \sa SDL_CreateRGBSurface
|
||||||
* \sa SDL_CreateRGBSurfaceWithFormat
|
* \sa SDL_CreateRGBSurfaceWithFormat
|
||||||
* \sa SDL_FreeSurface
|
* \sa SDL_FreeSurface
|
||||||
@@ -218,6 +225,7 @@ extern DECLSPEC SDL_Surface *SDLCALL SDL_CreateRGBSurfaceFrom(void *pixels,
|
|||||||
Uint32 Amask);
|
Uint32 Amask);
|
||||||
|
|
||||||
/* !!! FIXME for 2.1: why does this ask for depth? Format provides that. */
|
/* !!! FIXME for 2.1: why does this ask for depth? Format provides that. */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Allocate a new RGB surface with with a specific pixel format and existing
|
* Allocate a new RGB surface with with a specific pixel format and existing
|
||||||
* pixel data.
|
* pixel data.
|
||||||
@@ -238,6 +246,8 @@ extern DECLSPEC SDL_Surface *SDLCALL SDL_CreateRGBSurfaceFrom(void *pixels,
|
|||||||
* \returns the new SDL_Surface structure that is created or NULL if it fails;
|
* \returns the new SDL_Surface structure that is created or NULL if it fails;
|
||||||
* call SDL_GetError() for more information.
|
* call SDL_GetError() for more information.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.5.
|
||||||
|
*
|
||||||
* \sa SDL_CreateRGBSurfaceFrom
|
* \sa SDL_CreateRGBSurfaceFrom
|
||||||
* \sa SDL_CreateRGBSurfaceWithFormat
|
* \sa SDL_CreateRGBSurfaceWithFormat
|
||||||
* \sa SDL_FreeSurface
|
* \sa SDL_FreeSurface
|
||||||
@@ -252,6 +262,8 @@ extern DECLSPEC SDL_Surface *SDLCALL SDL_CreateRGBSurfaceWithFormatFrom
|
|||||||
*
|
*
|
||||||
* \param surface the SDL_Surface to free.
|
* \param surface the SDL_Surface to free.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_CreateRGBSurface
|
* \sa SDL_CreateRGBSurface
|
||||||
* \sa SDL_CreateRGBSurfaceFrom
|
* \sa SDL_CreateRGBSurfaceFrom
|
||||||
* \sa SDL_LoadBMP
|
* \sa SDL_LoadBMP
|
||||||
@@ -268,6 +280,8 @@ extern DECLSPEC void SDLCALL SDL_FreeSurface(SDL_Surface * surface);
|
|||||||
* \param palette the SDL_Palette structure to use
|
* \param palette the SDL_Palette structure to use
|
||||||
* \returns 0 on success or a negative error code on failure; call
|
* \returns 0 on success or a negative error code on failure; call
|
||||||
* SDL_GetError() for more information.
|
* SDL_GetError() for more information.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC int SDLCALL SDL_SetSurfacePalette(SDL_Surface * surface,
|
extern DECLSPEC int SDLCALL SDL_SetSurfacePalette(SDL_Surface * surface,
|
||||||
SDL_Palette * palette);
|
SDL_Palette * palette);
|
||||||
@@ -288,6 +302,8 @@ extern DECLSPEC int SDLCALL SDL_SetSurfacePalette(SDL_Surface * surface,
|
|||||||
* \returns 0 on success or a negative error code on failure; call
|
* \returns 0 on success or a negative error code on failure; call
|
||||||
* SDL_GetError() for more information.
|
* SDL_GetError() for more information.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_MUSTLOCK
|
* \sa SDL_MUSTLOCK
|
||||||
* \sa SDL_UnlockSurface
|
* \sa SDL_UnlockSurface
|
||||||
*/
|
*/
|
||||||
@@ -298,6 +314,8 @@ extern DECLSPEC int SDLCALL SDL_LockSurface(SDL_Surface * surface);
|
|||||||
*
|
*
|
||||||
* \param surface the SDL_Surface structure to be unlocked
|
* \param surface the SDL_Surface structure to be unlocked
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_LockSurface
|
* \sa SDL_LockSurface
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC void SDLCALL SDL_UnlockSurface(SDL_Surface * surface);
|
extern DECLSPEC void SDLCALL SDL_UnlockSurface(SDL_Surface * surface);
|
||||||
@@ -305,14 +323,22 @@ extern DECLSPEC void SDLCALL SDL_UnlockSurface(SDL_Surface * surface);
|
|||||||
/**
|
/**
|
||||||
* Load a BMP image from a seekable SDL data stream.
|
* Load a BMP image from a seekable SDL data stream.
|
||||||
*
|
*
|
||||||
* The new surface should be freed with SDL_FreeSurface().
|
* The new surface should be freed with SDL_FreeSurface(). Not doing so will
|
||||||
|
* result in a memory leak.
|
||||||
|
*
|
||||||
|
* src is an open SDL_RWops buffer, typically loaded with SDL_RWFromFile.
|
||||||
|
* Alternitavely, you might also use the macro SDL_LoadBMP to load a bitmap
|
||||||
|
* from a file, convert it to an SDL_Surface and then close the file.
|
||||||
*
|
*
|
||||||
* \param src the data stream for the surface
|
* \param src the data stream for the surface
|
||||||
* \param freesrc non-zero to close the stream after being read
|
* \param freesrc non-zero to close the stream after being read
|
||||||
* \returns a pointer to a new SDL_Surface structure or NULL if there was an
|
* \returns a pointer to a new SDL_Surface structure or NULL if there was an
|
||||||
* error; call SDL_GetError() for more information.
|
* error; call SDL_GetError() for more information.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_FreeSurface
|
* \sa SDL_FreeSurface
|
||||||
|
* \sa SDL_RWFromFile
|
||||||
* \sa SDL_LoadBMP
|
* \sa SDL_LoadBMP
|
||||||
* \sa SDL_SaveBMP_RW
|
* \sa SDL_SaveBMP_RW
|
||||||
*/
|
*/
|
||||||
@@ -341,6 +367,8 @@ extern DECLSPEC SDL_Surface *SDLCALL SDL_LoadBMP_RW(SDL_RWops * src,
|
|||||||
* \returns 0 on success or a negative error code on failure; call
|
* \returns 0 on success or a negative error code on failure; call
|
||||||
* SDL_GetError() for more information.
|
* SDL_GetError() for more information.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_LoadBMP_RW
|
* \sa SDL_LoadBMP_RW
|
||||||
* \sa SDL_SaveBMP
|
* \sa SDL_SaveBMP
|
||||||
*/
|
*/
|
||||||
@@ -366,6 +394,8 @@ extern DECLSPEC int SDLCALL SDL_SaveBMP_RW
|
|||||||
* \returns 0 on success or a negative error code on failure; call
|
* \returns 0 on success or a negative error code on failure; call
|
||||||
* SDL_GetError() for more information.
|
* SDL_GetError() for more information.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_BlitSurface
|
* \sa SDL_BlitSurface
|
||||||
* \sa SDL_LockSurface
|
* \sa SDL_LockSurface
|
||||||
* \sa SDL_UnlockSurface
|
* \sa SDL_UnlockSurface
|
||||||
@@ -381,6 +411,8 @@ extern DECLSPEC int SDLCALL SDL_SetSurfaceRLE(SDL_Surface * surface,
|
|||||||
* \param surface the SDL_Surface structure to query
|
* \param surface the SDL_Surface structure to query
|
||||||
* \returns SDL_TRUE if the surface is RLE enabled, SDL_FALSE otherwise.
|
* \returns SDL_TRUE if the surface is RLE enabled, SDL_FALSE otherwise.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.14.
|
||||||
|
*
|
||||||
* \sa SDL_SetSurfaceRLE
|
* \sa SDL_SetSurfaceRLE
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC SDL_bool SDLCALL SDL_HasSurfaceRLE(SDL_Surface * surface);
|
extern DECLSPEC SDL_bool SDLCALL SDL_HasSurfaceRLE(SDL_Surface * surface);
|
||||||
@@ -404,6 +436,8 @@ extern DECLSPEC SDL_bool SDLCALL SDL_HasSurfaceRLE(SDL_Surface * surface);
|
|||||||
* \returns 0 on success or a negative error code on failure; call
|
* \returns 0 on success or a negative error code on failure; call
|
||||||
* SDL_GetError() for more information.
|
* SDL_GetError() for more information.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_BlitSurface
|
* \sa SDL_BlitSurface
|
||||||
* \sa SDL_GetColorKey
|
* \sa SDL_GetColorKey
|
||||||
*/
|
*/
|
||||||
@@ -418,6 +452,8 @@ extern DECLSPEC int SDLCALL SDL_SetColorKey(SDL_Surface * surface,
|
|||||||
* \param surface the SDL_Surface structure to query
|
* \param surface the SDL_Surface structure to query
|
||||||
* \return SDL_TRUE if the surface has a color key, SDL_FALSE otherwise.
|
* \return SDL_TRUE if the surface has a color key, SDL_FALSE otherwise.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.9.
|
||||||
|
*
|
||||||
* \sa SDL_SetColorKey
|
* \sa SDL_SetColorKey
|
||||||
* \sa SDL_GetColorKey
|
* \sa SDL_GetColorKey
|
||||||
*/
|
*/
|
||||||
@@ -436,6 +472,8 @@ extern DECLSPEC SDL_bool SDLCALL SDL_HasColorKey(SDL_Surface * surface);
|
|||||||
* \returns 0 on success or a negative error code on failure; call
|
* \returns 0 on success or a negative error code on failure; call
|
||||||
* SDL_GetError() for more information.
|
* SDL_GetError() for more information.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_BlitSurface
|
* \sa SDL_BlitSurface
|
||||||
* \sa SDL_SetColorKey
|
* \sa SDL_SetColorKey
|
||||||
*/
|
*/
|
||||||
@@ -458,6 +496,8 @@ extern DECLSPEC int SDLCALL SDL_GetColorKey(SDL_Surface * surface,
|
|||||||
* \returns 0 on success or a negative error code on failure; call
|
* \returns 0 on success or a negative error code on failure; call
|
||||||
* SDL_GetError() for more information.
|
* SDL_GetError() for more information.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_GetSurfaceColorMod
|
* \sa SDL_GetSurfaceColorMod
|
||||||
* \sa SDL_SetSurfaceAlphaMod
|
* \sa SDL_SetSurfaceAlphaMod
|
||||||
*/
|
*/
|
||||||
@@ -475,6 +515,8 @@ extern DECLSPEC int SDLCALL SDL_SetSurfaceColorMod(SDL_Surface * surface,
|
|||||||
* \returns 0 on success or a negative error code on failure; call
|
* \returns 0 on success or a negative error code on failure; call
|
||||||
* SDL_GetError() for more information.
|
* SDL_GetError() for more information.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_GetSurfaceAlphaMod
|
* \sa SDL_GetSurfaceAlphaMod
|
||||||
* \sa SDL_SetSurfaceColorMod
|
* \sa SDL_SetSurfaceColorMod
|
||||||
*/
|
*/
|
||||||
@@ -495,6 +537,8 @@ extern DECLSPEC int SDLCALL SDL_GetSurfaceColorMod(SDL_Surface * surface,
|
|||||||
* \returns 0 on success or a negative error code on failure; call
|
* \returns 0 on success or a negative error code on failure; call
|
||||||
* SDL_GetError() for more information.
|
* SDL_GetError() for more information.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_GetSurfaceAlphaMod
|
* \sa SDL_GetSurfaceAlphaMod
|
||||||
* \sa SDL_SetSurfaceColorMod
|
* \sa SDL_SetSurfaceColorMod
|
||||||
*/
|
*/
|
||||||
@@ -509,6 +553,8 @@ extern DECLSPEC int SDLCALL SDL_SetSurfaceAlphaMod(SDL_Surface * surface,
|
|||||||
* \returns 0 on success or a negative error code on failure; call
|
* \returns 0 on success or a negative error code on failure; call
|
||||||
* SDL_GetError() for more information.
|
* SDL_GetError() for more information.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_GetSurfaceColorMod
|
* \sa SDL_GetSurfaceColorMod
|
||||||
* \sa SDL_SetSurfaceAlphaMod
|
* \sa SDL_SetSurfaceAlphaMod
|
||||||
*/
|
*/
|
||||||
@@ -527,6 +573,8 @@ extern DECLSPEC int SDLCALL SDL_GetSurfaceAlphaMod(SDL_Surface * surface,
|
|||||||
* \returns 0 on success or a negative error code on failure; call
|
* \returns 0 on success or a negative error code on failure; call
|
||||||
* SDL_GetError() for more information.
|
* SDL_GetError() for more information.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_GetSurfaceBlendMode
|
* \sa SDL_GetSurfaceBlendMode
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC int SDLCALL SDL_SetSurfaceBlendMode(SDL_Surface * surface,
|
extern DECLSPEC int SDLCALL SDL_SetSurfaceBlendMode(SDL_Surface * surface,
|
||||||
@@ -540,6 +588,8 @@ extern DECLSPEC int SDLCALL SDL_SetSurfaceBlendMode(SDL_Surface * surface,
|
|||||||
* \returns 0 on success or a negative error code on failure; call
|
* \returns 0 on success or a negative error code on failure; call
|
||||||
* SDL_GetError() for more information.
|
* SDL_GetError() for more information.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_SetSurfaceBlendMode
|
* \sa SDL_SetSurfaceBlendMode
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC int SDLCALL SDL_GetSurfaceBlendMode(SDL_Surface * surface,
|
extern DECLSPEC int SDLCALL SDL_GetSurfaceBlendMode(SDL_Surface * surface,
|
||||||
@@ -560,6 +610,8 @@ extern DECLSPEC int SDLCALL SDL_GetSurfaceBlendMode(SDL_Surface * surface,
|
|||||||
* \returns SDL_TRUE if the rectangle intersects the surface, otherwise
|
* \returns SDL_TRUE if the rectangle intersects the surface, otherwise
|
||||||
* SDL_FALSE and blits will be completely clipped.
|
* SDL_FALSE and blits will be completely clipped.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_BlitSurface
|
* \sa SDL_BlitSurface
|
||||||
* \sa SDL_GetClipRect
|
* \sa SDL_GetClipRect
|
||||||
*/
|
*/
|
||||||
@@ -577,6 +629,8 @@ extern DECLSPEC SDL_bool SDLCALL SDL_SetClipRect(SDL_Surface * surface,
|
|||||||
* \param rect an SDL_Rect structure filled in with the clipping rectangle for
|
* \param rect an SDL_Rect structure filled in with the clipping rectangle for
|
||||||
* the surface
|
* the surface
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_BlitSurface
|
* \sa SDL_BlitSurface
|
||||||
* \sa SDL_SetClipRect
|
* \sa SDL_SetClipRect
|
||||||
*/
|
*/
|
||||||
@@ -610,6 +664,8 @@ extern DECLSPEC SDL_Surface *SDLCALL SDL_DuplicateSurface(SDL_Surface * surface)
|
|||||||
* \returns the new SDL_Surface structure that is created or NULL if it fails;
|
* \returns the new SDL_Surface structure that is created or NULL if it fails;
|
||||||
* call SDL_GetError() for more information.
|
* call SDL_GetError() for more information.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_AllocFormat
|
* \sa SDL_AllocFormat
|
||||||
* \sa SDL_ConvertSurfaceFormat
|
* \sa SDL_ConvertSurfaceFormat
|
||||||
* \sa SDL_CreateRGBSurface
|
* \sa SDL_CreateRGBSurface
|
||||||
@@ -633,8 +689,10 @@ extern DECLSPEC SDL_Surface *SDLCALL SDL_ConvertSurface
|
|||||||
* \returns the new SDL_Surface structure that is created or NULL if it fails;
|
* \returns the new SDL_Surface structure that is created or NULL if it fails;
|
||||||
* call SDL_GetError() for more information.
|
* call SDL_GetError() for more information.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_AllocFormat
|
* \sa SDL_AllocFormat
|
||||||
* \sa SDL_ConvertSurfaceFormat
|
* \sa SDL_ConvertSurface
|
||||||
* \sa SDL_CreateRGBSurface
|
* \sa SDL_CreateRGBSurface
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC SDL_Surface *SDLCALL SDL_ConvertSurfaceFormat
|
extern DECLSPEC SDL_Surface *SDLCALL SDL_ConvertSurfaceFormat
|
||||||
@@ -647,12 +705,14 @@ extern DECLSPEC SDL_Surface *SDLCALL SDL_ConvertSurfaceFormat
|
|||||||
* \param height the height of the block to copy, in pixels
|
* \param height the height of the block to copy, in pixels
|
||||||
* \param src_format an SDL_PixelFormatEnum value of the `src` pixels format
|
* \param src_format an SDL_PixelFormatEnum value of the `src` pixels format
|
||||||
* \param src a pointer to the source pixels
|
* \param src a pointer to the source pixels
|
||||||
* \param src_pitch the pitch of the block to copy, in bytes
|
* \param src_pitch the pitch of the source pixels, in bytes
|
||||||
* \param dst_format an SDL_PixelFormatEnum value of the `dst` pixels format
|
* \param dst_format an SDL_PixelFormatEnum value of the `dst` pixels format
|
||||||
* \param dst a pointer to be filled in with new pixel data
|
* \param dst a pointer to be filled in with new pixel data
|
||||||
* \param dst_pitch the pitch of the destination pixels, in bytes
|
* \param dst_pitch the pitch of the destination pixels, in bytes
|
||||||
* \returns 0 on success or a negative error code on failure; call
|
* \returns 0 on success or a negative error code on failure; call
|
||||||
* SDL_GetError() for more information.
|
* SDL_GetError() for more information.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC int SDLCALL SDL_ConvertPixels(int width, int height,
|
extern DECLSPEC int SDLCALL SDL_ConvertPixels(int width, int height,
|
||||||
Uint32 src_format,
|
Uint32 src_format,
|
||||||
@@ -660,6 +720,32 @@ extern DECLSPEC int SDLCALL SDL_ConvertPixels(int width, int height,
|
|||||||
Uint32 dst_format,
|
Uint32 dst_format,
|
||||||
void * dst, int dst_pitch);
|
void * dst, int dst_pitch);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Premultiply the alpha on a block of pixels.
|
||||||
|
*
|
||||||
|
* This is safe to use with src == dst, but not for other overlapping areas.
|
||||||
|
*
|
||||||
|
* This function is currently only implemented for SDL_PIXELFORMAT_ARGB8888.
|
||||||
|
*
|
||||||
|
* \param width the width of the block to convert, in pixels
|
||||||
|
* \param height the height of the block to convert, in pixels
|
||||||
|
* \param src_format an SDL_PixelFormatEnum value of the `src` pixels format
|
||||||
|
* \param src a pointer to the source pixels
|
||||||
|
* \param src_pitch the pitch of the source pixels, in bytes
|
||||||
|
* \param dst_format an SDL_PixelFormatEnum value of the `dst` pixels format
|
||||||
|
* \param dst a pointer to be filled in with premultiplied pixel data
|
||||||
|
* \param dst_pitch the pitch of the destination pixels, in bytes
|
||||||
|
* \returns 0 on success or a negative error code on failure; call
|
||||||
|
* SDL_GetError() for more information.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.18.
|
||||||
|
*/
|
||||||
|
extern DECLSPEC int SDLCALL SDL_PremultiplyAlpha(int width, int height,
|
||||||
|
Uint32 src_format,
|
||||||
|
const void * src, int src_pitch,
|
||||||
|
Uint32 dst_format,
|
||||||
|
void * dst, int dst_pitch);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Perform a fast fill of a rectangle with a specific color.
|
* Perform a fast fill of a rectangle with a specific color.
|
||||||
*
|
*
|
||||||
@@ -679,6 +765,8 @@ extern DECLSPEC int SDLCALL SDL_ConvertPixels(int width, int height,
|
|||||||
* \returns 0 on success or a negative error code on failure; call
|
* \returns 0 on success or a negative error code on failure; call
|
||||||
* SDL_GetError() for more information.
|
* SDL_GetError() for more information.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_FillRects
|
* \sa SDL_FillRects
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC int SDLCALL SDL_FillRect
|
extern DECLSPEC int SDLCALL SDL_FillRect
|
||||||
@@ -703,6 +791,8 @@ extern DECLSPEC int SDLCALL SDL_FillRect
|
|||||||
* \returns 0 on success or a negative error code on failure; call
|
* \returns 0 on success or a negative error code on failure; call
|
||||||
* SDL_GetError() for more information.
|
* SDL_GetError() for more information.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_FillRect
|
* \sa SDL_FillRect
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC int SDLCALL SDL_FillRects
|
extern DECLSPEC int SDLCALL SDL_FillRects
|
||||||
@@ -774,6 +864,8 @@ extern DECLSPEC int SDLCALL SDL_FillRects
|
|||||||
* SDL_UpperBlit() has been replaced by SDL_BlitSurface(), which is merely a
|
* SDL_UpperBlit() has been replaced by SDL_BlitSurface(), which is merely a
|
||||||
* macro for this function with a less confusing name.
|
* macro for this function with a less confusing name.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_BlitSurface
|
* \sa SDL_BlitSurface
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC int SDLCALL SDL_UpperBlit
|
extern DECLSPEC int SDLCALL SDL_UpperBlit
|
||||||
@@ -798,6 +890,8 @@ extern DECLSPEC int SDLCALL SDL_UpperBlit
|
|||||||
* \returns 0 on success or a negative error code on failure; call
|
* \returns 0 on success or a negative error code on failure; call
|
||||||
* SDL_GetError() for more information.
|
* SDL_GetError() for more information.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_BlitSurface
|
* \sa SDL_BlitSurface
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC int SDLCALL SDL_LowerBlit
|
extern DECLSPEC int SDLCALL SDL_LowerBlit
|
||||||
@@ -805,11 +899,13 @@ extern DECLSPEC int SDLCALL SDL_LowerBlit
|
|||||||
SDL_Surface * dst, SDL_Rect * dstrect);
|
SDL_Surface * dst, SDL_Rect * dstrect);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Perform a fast, low quality, stretch blit between two surfaces of the
|
* Perform a fast, low quality, stretch blit between two surfaces of the same
|
||||||
* same format.
|
* format.
|
||||||
*
|
*
|
||||||
* Please use SDL_BlitScaled() instead.
|
* Please use SDL_BlitScaled() instead.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC int SDLCALL SDL_SoftStretch(SDL_Surface * src,
|
extern DECLSPEC int SDLCALL SDL_SoftStretch(SDL_Surface * src,
|
||||||
const SDL_Rect * srcrect,
|
const SDL_Rect * srcrect,
|
||||||
@@ -818,6 +914,8 @@ extern DECLSPEC int SDLCALL SDL_SoftStretch(SDL_Surface * src,
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Perform bilinear scaling between two surfaces of the same format, 32BPP.
|
* Perform bilinear scaling between two surfaces of the same format, 32BPP.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.16.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC int SDLCALL SDL_SoftStretchLinear(SDL_Surface * src,
|
extern DECLSPEC int SDLCALL SDL_SoftStretchLinear(SDL_Surface * src,
|
||||||
const SDL_Rect * srcrect,
|
const SDL_Rect * srcrect,
|
||||||
@@ -833,6 +931,8 @@ extern DECLSPEC int SDLCALL SDL_SoftStretchLinear(SDL_Surface * src,
|
|||||||
* SDL_UpperBlitScaled() has been replaced by SDL_BlitScaled(), which is
|
* SDL_UpperBlitScaled() has been replaced by SDL_BlitScaled(), which is
|
||||||
* merely a macro for this function with a less confusing name.
|
* merely a macro for this function with a less confusing name.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_BlitScaled
|
* \sa SDL_BlitScaled
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC int SDLCALL SDL_UpperBlitScaled
|
extern DECLSPEC int SDLCALL SDL_UpperBlitScaled
|
||||||
@@ -854,6 +954,8 @@ extern DECLSPEC int SDLCALL SDL_UpperBlitScaled
|
|||||||
* \returns 0 on success or a negative error code on failure; call
|
* \returns 0 on success or a negative error code on failure; call
|
||||||
* SDL_GetError() for more information.
|
* SDL_GetError() for more information.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_BlitScaled
|
* \sa SDL_BlitScaled
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC int SDLCALL SDL_LowerBlitScaled
|
extern DECLSPEC int SDLCALL SDL_LowerBlitScaled
|
||||||
@@ -862,17 +964,23 @@ extern DECLSPEC int SDLCALL SDL_LowerBlitScaled
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the YUV conversion mode
|
* Set the YUV conversion mode
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.8.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC void SDLCALL SDL_SetYUVConversionMode(SDL_YUV_CONVERSION_MODE mode);
|
extern DECLSPEC void SDLCALL SDL_SetYUVConversionMode(SDL_YUV_CONVERSION_MODE mode);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the YUV conversion mode
|
* Get the YUV conversion mode
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.8.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC SDL_YUV_CONVERSION_MODE SDLCALL SDL_GetYUVConversionMode(void);
|
extern DECLSPEC SDL_YUV_CONVERSION_MODE SDLCALL SDL_GetYUVConversionMode(void);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the YUV conversion mode, returning the correct mode for the resolution
|
* Get the YUV conversion mode, returning the correct mode for the resolution
|
||||||
* when the current conversion mode is SDL_YUV_CONVERSION_AUTOMATIC
|
* when the current conversion mode is SDL_YUV_CONVERSION_AUTOMATIC
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.8.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC SDL_YUV_CONVERSION_MODE SDLCALL SDL_GetYUVConversionModeForResolution(int width, int height);
|
extern DECLSPEC SDL_YUV_CONVERSION_MODE SDLCALL SDL_GetYUVConversionModeForResolution(int width, int height);
|
||||||
|
|
||||||
|
|||||||
+89
-1
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
Simple DirectMedia Layer
|
Simple DirectMedia Layer
|
||||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
||||||
|
|
||||||
This software is provided 'as-is', without any express or implied
|
This software is provided 'as-is', without any express or implied
|
||||||
warranty. In no event will the authors be held liable for any damages
|
warranty. In no event will the authors be held liable for any damages
|
||||||
@@ -50,6 +50,8 @@ typedef void (SDLCALL * SDL_WindowsMessageHook)(void *userdata, void *hWnd, unsi
|
|||||||
*
|
*
|
||||||
* \param callback The SDL_WindowsMessageHook function to call.
|
* \param callback The SDL_WindowsMessageHook function to call.
|
||||||
* \param userdata a pointer to pass to every iteration of `callback`
|
* \param userdata a pointer to pass to every iteration of `callback`
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.4.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC void SDLCALL SDL_SetWindowsMessageHook(SDL_WindowsMessageHook callback, void *userdata);
|
extern DECLSPEC void SDLCALL SDL_SetWindowsMessageHook(SDL_WindowsMessageHook callback, void *userdata);
|
||||||
|
|
||||||
@@ -95,6 +97,8 @@ typedef struct ID3D11Device ID3D11Device;
|
|||||||
* \param renderer the renderer from which to get the associated D3D11 device
|
* \param renderer the renderer from which to get the associated D3D11 device
|
||||||
* \returns the D3D11 device associated with given renderer or NULL if it is
|
* \returns the D3D11 device associated with given renderer or NULL if it is
|
||||||
* not a D3D11 renderer; call SDL_GetError() for more information.
|
* not a D3D11 renderer; call SDL_GetError() for more information.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.16.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC ID3D11Device* SDLCALL SDL_RenderGetD3D11Device(SDL_Renderer * renderer);
|
extern DECLSPEC ID3D11Device* SDLCALL SDL_RenderGetD3D11Device(SDL_Renderer * renderer);
|
||||||
|
|
||||||
@@ -132,18 +136,83 @@ extern DECLSPEC SDL_bool SDLCALL SDL_DXGIGetOutputInfo( int displayIndex, int *a
|
|||||||
* \param threadID the Unix thread ID to change priority of.
|
* \param threadID the Unix thread ID to change priority of.
|
||||||
* \param priority The new, Unix-specific, priority value.
|
* \param priority The new, Unix-specific, priority value.
|
||||||
* \returns 0 on success, or -1 on error.
|
* \returns 0 on success, or -1 on error.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.9.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC int SDLCALL SDL_LinuxSetThreadPriority(Sint64 threadID, int priority);
|
extern DECLSPEC int SDLCALL SDL_LinuxSetThreadPriority(Sint64 threadID, int priority);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the priority (not nice level) and scheduling policy for a thread.
|
||||||
|
*
|
||||||
|
* This uses setpriority() if possible, and RealtimeKit if available.
|
||||||
|
*
|
||||||
|
* \param threadID The Unix thread ID to change priority of.
|
||||||
|
* \param sdlPriority The new SDL_ThreadPriority value.
|
||||||
|
* \param schedPolicy The new scheduling policy (SCHED_FIFO, SCHED_RR,
|
||||||
|
* SCHED_OTHER, etc...)
|
||||||
|
* \returns 0 on success, or -1 on error.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.18.
|
||||||
|
*/
|
||||||
|
extern DECLSPEC int SDLCALL SDL_LinuxSetThreadPriorityAndPolicy(Sint64 threadID, int sdlPriority, int schedPolicy);
|
||||||
|
|
||||||
#endif /* __LINUX__ */
|
#endif /* __LINUX__ */
|
||||||
|
|
||||||
/* Platform specific functions for iOS */
|
/* Platform specific functions for iOS */
|
||||||
#ifdef __IPHONEOS__
|
#ifdef __IPHONEOS__
|
||||||
|
|
||||||
#define SDL_iOSSetAnimationCallback(window, interval, callback, callbackParam) SDL_iPhoneSetAnimationCallback(window, interval, callback, callbackParam)
|
#define SDL_iOSSetAnimationCallback(window, interval, callback, callbackParam) SDL_iPhoneSetAnimationCallback(window, interval, callback, callbackParam)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Use this function to set the animation callback on Apple iOS.
|
||||||
|
*
|
||||||
|
* The function prototype for `callback` is:
|
||||||
|
*
|
||||||
|
* ```c
|
||||||
|
* void callback(void* callbackParam);
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* Where its parameter, `callbackParam`, is what was passed as `callbackParam`
|
||||||
|
* to SDL_iPhoneSetAnimationCallback().
|
||||||
|
*
|
||||||
|
* This function is only available on Apple iOS.
|
||||||
|
*
|
||||||
|
* For more information see:
|
||||||
|
* [README-ios.md](https://hg.libsdl.org/SDL/file/default/docs/README-ios.md)
|
||||||
|
*
|
||||||
|
* This functions is also accessible using the macro
|
||||||
|
* SDL_iOSSetAnimationCallback() since SDL 2.0.4.
|
||||||
|
*
|
||||||
|
* \param window the window for which the animation callback should be set
|
||||||
|
* \param interval the number of frames after which **callback** will be
|
||||||
|
* called
|
||||||
|
* \param callback the function to call for every frame.
|
||||||
|
* \param callbackParam a pointer that is passed to `callback`.
|
||||||
|
* \returns 0 on success or a negative error code on failure; call
|
||||||
|
* SDL_GetError() for more information.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
|
* \sa SDL_iPhoneSetEventPump
|
||||||
|
*/
|
||||||
extern DECLSPEC int SDLCALL SDL_iPhoneSetAnimationCallback(SDL_Window * window, int interval, void (*callback)(void*), void *callbackParam);
|
extern DECLSPEC int SDLCALL SDL_iPhoneSetAnimationCallback(SDL_Window * window, int interval, void (*callback)(void*), void *callbackParam);
|
||||||
|
|
||||||
#define SDL_iOSSetEventPump(enabled) SDL_iPhoneSetEventPump(enabled)
|
#define SDL_iOSSetEventPump(enabled) SDL_iPhoneSetEventPump(enabled)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Use this function to enable or disable the SDL event pump on Apple iOS.
|
||||||
|
*
|
||||||
|
* This function is only available on Apple iOS.
|
||||||
|
*
|
||||||
|
* This functions is also accessible using the macro SDL_iOSSetEventPump()
|
||||||
|
* since SDL 2.0.4.
|
||||||
|
*
|
||||||
|
* \param enabled SDL_TRUE to enable the event pump, SDL_FALSE to disable it
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
|
* \sa SDL_iPhoneSetAnimationCallback
|
||||||
|
*/
|
||||||
extern DECLSPEC void SDLCALL SDL_iPhoneSetEventPump(SDL_bool enabled);
|
extern DECLSPEC void SDLCALL SDL_iPhoneSetEventPump(SDL_bool enabled);
|
||||||
|
|
||||||
#endif /* __IPHONEOS__ */
|
#endif /* __IPHONEOS__ */
|
||||||
@@ -196,6 +265,7 @@ extern DECLSPEC void * SDLCALL SDL_AndroidGetActivity(void);
|
|||||||
/**
|
/**
|
||||||
* Query Android API level of the current device.
|
* Query Android API level of the current device.
|
||||||
*
|
*
|
||||||
|
* - API level 31: Android 12
|
||||||
* - API level 30: Android 11
|
* - API level 30: Android 11
|
||||||
* - API level 29: Android 10
|
* - API level 29: Android 10
|
||||||
* - API level 28: Android 9
|
* - API level 28: Android 9
|
||||||
@@ -219,6 +289,8 @@ extern DECLSPEC void * SDLCALL SDL_AndroidGetActivity(void);
|
|||||||
* - API level 10: Android 2.3.3
|
* - API level 10: Android 2.3.3
|
||||||
*
|
*
|
||||||
* \returns the Android API level.
|
* \returns the Android API level.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.12.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC int SDLCALL SDL_GetAndroidSDKVersion(void);
|
extern DECLSPEC int SDLCALL SDL_GetAndroidSDKVersion(void);
|
||||||
|
|
||||||
@@ -226,6 +298,8 @@ extern DECLSPEC int SDLCALL SDL_GetAndroidSDKVersion(void);
|
|||||||
* Query if the application is running on Android TV.
|
* Query if the application is running on Android TV.
|
||||||
*
|
*
|
||||||
* \returns SDL_TRUE if this is Android TV, SDL_FALSE otherwise.
|
* \returns SDL_TRUE if this is Android TV, SDL_FALSE otherwise.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.8.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC SDL_bool SDLCALL SDL_IsAndroidTV(void);
|
extern DECLSPEC SDL_bool SDLCALL SDL_IsAndroidTV(void);
|
||||||
|
|
||||||
@@ -233,6 +307,8 @@ extern DECLSPEC SDL_bool SDLCALL SDL_IsAndroidTV(void);
|
|||||||
* Query if the application is running on a Chromebook.
|
* Query if the application is running on a Chromebook.
|
||||||
*
|
*
|
||||||
* \returns SDL_TRUE if this is a Chromebook, SDL_FALSE otherwise.
|
* \returns SDL_TRUE if this is a Chromebook, SDL_FALSE otherwise.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.9.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC SDL_bool SDLCALL SDL_IsChromebook(void);
|
extern DECLSPEC SDL_bool SDLCALL SDL_IsChromebook(void);
|
||||||
|
|
||||||
@@ -240,11 +316,15 @@ extern DECLSPEC SDL_bool SDLCALL SDL_IsChromebook(void);
|
|||||||
* Query if the application is running on a Samsung DeX docking station.
|
* Query if the application is running on a Samsung DeX docking station.
|
||||||
*
|
*
|
||||||
* \returns SDL_TRUE if this is a DeX docking station, SDL_FALSE otherwise.
|
* \returns SDL_TRUE if this is a DeX docking station, SDL_FALSE otherwise.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.9.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC SDL_bool SDLCALL SDL_IsDeXMode(void);
|
extern DECLSPEC SDL_bool SDLCALL SDL_IsDeXMode(void);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Trigger the Android system back button behavior.
|
* Trigger the Android system back button behavior.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.9.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC void SDLCALL SDL_AndroidBackButton(void);
|
extern DECLSPEC void SDLCALL SDL_AndroidBackButton(void);
|
||||||
|
|
||||||
@@ -315,6 +395,8 @@ extern DECLSPEC const char * SDLCALL SDL_AndroidGetExternalStoragePath(void);
|
|||||||
*
|
*
|
||||||
* \param permission The permission to request.
|
* \param permission The permission to request.
|
||||||
* \returns SDL_TRUE if the permission was granted, SDL_FALSE otherwise.
|
* \returns SDL_TRUE if the permission was granted, SDL_FALSE otherwise.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.14.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC SDL_bool SDLCALL SDL_AndroidRequestPermission(const char *permission);
|
extern DECLSPEC SDL_bool SDLCALL SDL_AndroidRequestPermission(const char *permission);
|
||||||
|
|
||||||
@@ -338,6 +420,8 @@ extern DECLSPEC SDL_bool SDLCALL SDL_AndroidRequestPermission(const char *permis
|
|||||||
* \param xoffset set this parameter only when gravity >=0
|
* \param xoffset set this parameter only when gravity >=0
|
||||||
* \param yoffset set this parameter only when gravity >=0
|
* \param yoffset set this parameter only when gravity >=0
|
||||||
* \returns 0 if success, -1 if any error occurs.
|
* \returns 0 if success, -1 if any error occurs.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.16.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC int SDLCALL SDL_AndroidShowToast(const char* message, int duration, int gravity, int xoffset, int yoffset);
|
extern DECLSPEC int SDLCALL SDL_AndroidShowToast(const char* message, int duration, int gravity, int xoffset, int yoffset);
|
||||||
|
|
||||||
@@ -439,6 +523,8 @@ extern DECLSPEC const char * SDLCALL SDL_WinRTGetFSPathUTF8(SDL_WinRT_Path pathT
|
|||||||
* Detects the device family of WinRT plattform at runtime.
|
* Detects the device family of WinRT plattform at runtime.
|
||||||
*
|
*
|
||||||
* \returns a value from the SDL_WinRT_DeviceFamily enum.
|
* \returns a value from the SDL_WinRT_DeviceFamily enum.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.8.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC SDL_WinRT_DeviceFamily SDLCALL SDL_WinRTGetDeviceFamily();
|
extern DECLSPEC SDL_WinRT_DeviceFamily SDLCALL SDL_WinRTGetDeviceFamily();
|
||||||
|
|
||||||
@@ -450,6 +536,8 @@ extern DECLSPEC SDL_WinRT_DeviceFamily SDLCALL SDL_WinRTGetDeviceFamily();
|
|||||||
* If SDL can't determine this, it will return SDL_FALSE.
|
* If SDL can't determine this, it will return SDL_FALSE.
|
||||||
*
|
*
|
||||||
* \returns SDL_TRUE if the device is a tablet, SDL_FALSE otherwise.
|
* \returns SDL_TRUE if the device is a tablet, SDL_FALSE otherwise.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.9.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC SDL_bool SDLCALL SDL_IsTablet(void);
|
extern DECLSPEC SDL_bool SDLCALL SDL_IsTablet(void);
|
||||||
|
|
||||||
|
|||||||
+8
-2
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
Simple DirectMedia Layer
|
Simple DirectMedia Layer
|
||||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
||||||
|
|
||||||
This software is provided 'as-is', without any express or implied
|
This software is provided 'as-is', without any express or implied
|
||||||
warranty. In no event will the authors be held liable for any damages
|
warranty. In no event will the authors be held liable for any damages
|
||||||
@@ -98,6 +98,10 @@ typedef struct _UIViewController UIViewController;
|
|||||||
typedef Uint32 GLuint;
|
typedef Uint32 GLuint;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(SDL_VIDEO_VULKAN) || defined(SDL_VIDEO_METAL)
|
||||||
|
#define SDL_METALVIEW_TAG 255
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(SDL_VIDEO_DRIVER_ANDROID)
|
#if defined(SDL_VIDEO_DRIVER_ANDROID)
|
||||||
typedef struct ANativeWindow ANativeWindow;
|
typedef struct ANativeWindow ANativeWindow;
|
||||||
typedef void *EGLSurface;
|
typedef void *EGLSurface;
|
||||||
@@ -143,7 +147,8 @@ typedef enum
|
|||||||
SDL_SYSWM_VIVANTE,
|
SDL_SYSWM_VIVANTE,
|
||||||
SDL_SYSWM_OS2,
|
SDL_SYSWM_OS2,
|
||||||
SDL_SYSWM_HAIKU,
|
SDL_SYSWM_HAIKU,
|
||||||
SDL_SYSWM_KMSDRM
|
SDL_SYSWM_KMSDRM,
|
||||||
|
SDL_SYSWM_RISCOS
|
||||||
} SDL_SYSWM_TYPE;
|
} SDL_SYSWM_TYPE;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -292,6 +297,7 @@ struct SDL_SysWMinfo
|
|||||||
void *shell_surface; /**< DEPRECATED Wayland shell_surface (window manager handle) */
|
void *shell_surface; /**< DEPRECATED Wayland shell_surface (window manager handle) */
|
||||||
struct wl_egl_window *egl_window; /**< Wayland EGL window (native window) */
|
struct wl_egl_window *egl_window; /**< Wayland EGL window (native window) */
|
||||||
struct xdg_surface *xdg_surface; /**< Wayland xdg surface (window manager handle) */
|
struct xdg_surface *xdg_surface; /**< Wayland xdg surface (window manager handle) */
|
||||||
|
struct xdg_toplevel *xdg_toplevel; /**< Wayland xdg toplevel role */
|
||||||
} wl;
|
} wl;
|
||||||
#endif
|
#endif
|
||||||
#if defined(SDL_VIDEO_DRIVER_MIR) /* no longer available, left for API/ABI compatibility. Remove in 2.1! */
|
#if defined(SDL_VIDEO_DRIVER_MIR) /* no longer available, left for API/ABI compatibility. Remove in 2.1! */
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
Simple DirectMedia Layer
|
Simple DirectMedia Layer
|
||||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
||||||
|
|
||||||
This software is provided 'as-is', without any express or implied
|
This software is provided 'as-is', without any express or implied
|
||||||
warranty. In no event will the authors be held liable for any damages
|
warranty. In no event will the authors be held liable for any damages
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
Simple DirectMedia Layer
|
Simple DirectMedia Layer
|
||||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
||||||
|
|
||||||
This software is provided 'as-is', without any express or implied
|
This software is provided 'as-is', without any express or implied
|
||||||
warranty. In no event will the authors be held liable for any damages
|
warranty. In no event will the authors be held liable for any damages
|
||||||
|
|||||||
+7
-2
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
Simple DirectMedia Layer
|
Simple DirectMedia Layer
|
||||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
||||||
|
|
||||||
This software is provided 'as-is', without any express or implied
|
This software is provided 'as-is', without any express or implied
|
||||||
warranty. In no event will the authors be held liable for any damages
|
warranty. In no event will the authors be held liable for any damages
|
||||||
@@ -114,6 +114,10 @@ typedef struct
|
|||||||
int gl_minor_version;
|
int gl_minor_version;
|
||||||
int gl_debug;
|
int gl_debug;
|
||||||
int gl_profile_mask;
|
int gl_profile_mask;
|
||||||
|
|
||||||
|
/* Additional fields added in 2.0.18 */
|
||||||
|
SDL_Rect confine;
|
||||||
|
|
||||||
} SDLTest_CommonState;
|
} SDLTest_CommonState;
|
||||||
|
|
||||||
#include "begin_code.h"
|
#include "begin_code.h"
|
||||||
@@ -215,9 +219,10 @@ void SDLTest_CommonQuit(SDLTest_CommonState * state);
|
|||||||
*
|
*
|
||||||
* \param renderer The renderer to draw to.
|
* \param renderer The renderer to draw to.
|
||||||
* \param window The window whose information should be displayed.
|
* \param window The window whose information should be displayed.
|
||||||
|
* \param usedHeight Returns the height used, so the caller can draw more below.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void SDLTest_CommonDrawWindowInfo(SDL_Renderer * renderer, SDL_Window * window);
|
void SDLTest_CommonDrawWindowInfo(SDL_Renderer * renderer, SDL_Window * window, int * usedHeight);
|
||||||
|
|
||||||
/* Ends C function definitions when using C++ */
|
/* Ends C function definitions when using C++ */
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
Simple DirectMedia Layer
|
Simple DirectMedia Layer
|
||||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
||||||
|
|
||||||
This software is provided 'as-is', without any express or implied
|
This software is provided 'as-is', without any express or implied
|
||||||
warranty. In no event will the authors be held liable for any damages
|
warranty. In no event will the authors be held liable for any damages
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
Simple DirectMedia Layer
|
Simple DirectMedia Layer
|
||||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
||||||
|
|
||||||
This software is provided 'as-is', without any express or implied
|
This software is provided 'as-is', without any express or implied
|
||||||
warranty. In no event will the authors be held liable for any damages
|
warranty. In no event will the authors be held liable for any damages
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
Simple DirectMedia Layer
|
Simple DirectMedia Layer
|
||||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
||||||
|
|
||||||
This software is provided 'as-is', without any express or implied
|
This software is provided 'as-is', without any express or implied
|
||||||
warranty. In no event will the authors be held liable for any damages
|
warranty. In no event will the authors be held liable for any damages
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
Simple DirectMedia Layer
|
Simple DirectMedia Layer
|
||||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
||||||
|
|
||||||
This software is provided 'as-is', without any express or implied
|
This software is provided 'as-is', without any express or implied
|
||||||
warranty. In no event will the authors be held liable for any damages
|
warranty. In no event will the authors be held liable for any damages
|
||||||
|
|||||||
+4
-4
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
Simple DirectMedia Layer
|
Simple DirectMedia Layer
|
||||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
||||||
|
|
||||||
This software is provided 'as-is', without any express or implied
|
This software is provided 'as-is', without any express or implied
|
||||||
warranty. In no event will the authors be held liable for any damages
|
warranty. In no event will the authors be held liable for any damages
|
||||||
@@ -76,9 +76,9 @@ typedef struct SDLTest_TestCaseReference {
|
|||||||
/* !< Func2Stress */
|
/* !< Func2Stress */
|
||||||
SDLTest_TestCaseFp testCase;
|
SDLTest_TestCaseFp testCase;
|
||||||
/* !< Short name (or function name) "Func2Stress" */
|
/* !< Short name (or function name) "Func2Stress" */
|
||||||
char *name;
|
const char *name;
|
||||||
/* !< Long name or full description "This test pushes func2() to the limit." */
|
/* !< Long name or full description "This test pushes func2() to the limit." */
|
||||||
char *description;
|
const char *description;
|
||||||
/* !< Set to TEST_ENABLED or TEST_DISABLED (test won't be run) */
|
/* !< Set to TEST_ENABLED or TEST_DISABLED (test won't be run) */
|
||||||
int enabled;
|
int enabled;
|
||||||
} SDLTest_TestCaseReference;
|
} SDLTest_TestCaseReference;
|
||||||
@@ -88,7 +88,7 @@ typedef struct SDLTest_TestCaseReference {
|
|||||||
*/
|
*/
|
||||||
typedef struct SDLTest_TestSuiteReference {
|
typedef struct SDLTest_TestSuiteReference {
|
||||||
/* !< "PlatformSuite" */
|
/* !< "PlatformSuite" */
|
||||||
char *name;
|
const char *name;
|
||||||
/* !< The function that is run before each test. NULL skips. */
|
/* !< The function that is run before each test. NULL skips. */
|
||||||
SDLTest_TestCaseSetUpFp testSetUp;
|
SDLTest_TestCaseSetUpFp testSetUp;
|
||||||
/* !< The test cases that are run as part of the suite. Last item should be NULL. */
|
/* !< The test cases that are run as part of the suite. Last item should be NULL. */
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
Simple DirectMedia Layer
|
Simple DirectMedia Layer
|
||||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
||||||
|
|
||||||
This software is provided 'as-is', without any express or implied
|
This software is provided 'as-is', without any express or implied
|
||||||
warranty. In no event will the authors be held liable for any damages
|
warranty. In no event will the authors be held liable for any damages
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
Simple DirectMedia Layer
|
Simple DirectMedia Layer
|
||||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
||||||
|
|
||||||
This software is provided 'as-is', without any express or implied
|
This software is provided 'as-is', without any express or implied
|
||||||
warranty. In no event will the authors be held liable for any damages
|
warranty. In no event will the authors be held liable for any damages
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
Simple DirectMedia Layer
|
Simple DirectMedia Layer
|
||||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
||||||
|
|
||||||
This software is provided 'as-is', without any express or implied
|
This software is provided 'as-is', without any express or implied
|
||||||
warranty. In no event will the authors be held liable for any damages
|
warranty. In no event will the authors be held liable for any damages
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
Simple DirectMedia Layer
|
Simple DirectMedia Layer
|
||||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
||||||
|
|
||||||
This software is provided 'as-is', without any express or implied
|
This software is provided 'as-is', without any express or implied
|
||||||
warranty. In no event will the authors be held liable for any damages
|
warranty. In no event will the authors be held liable for any damages
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
Simple DirectMedia Layer
|
Simple DirectMedia Layer
|
||||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
||||||
|
|
||||||
This software is provided 'as-is', without any express or implied
|
This software is provided 'as-is', without any express or implied
|
||||||
warranty. In no event will the authors be held liable for any damages
|
warranty. In no event will the authors be held liable for any damages
|
||||||
|
|||||||
+17
-7
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
Simple DirectMedia Layer
|
Simple DirectMedia Layer
|
||||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
||||||
|
|
||||||
This software is provided 'as-is', without any express or implied
|
This software is provided 'as-is', without any express or implied
|
||||||
warranty. In no event will the authors be held liable for any damages
|
warranty. In no event will the authors be held liable for any damages
|
||||||
@@ -123,9 +123,6 @@ typedef void (__cdecl * pfnSDL_CurrentEndThread) (unsigned code);
|
|||||||
#define SDL_endthread _endthreadex
|
#define SDL_endthread _endthreadex
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a thread.
|
|
||||||
*/
|
|
||||||
extern DECLSPEC SDL_Thread *SDLCALL
|
extern DECLSPEC SDL_Thread *SDLCALL
|
||||||
SDL_CreateThread(SDL_ThreadFunction fn, const char *name, void *data,
|
SDL_CreateThread(SDL_ThreadFunction fn, const char *name, void *data,
|
||||||
pfnSDL_CurrentBeginThread pfnBeginThread,
|
pfnSDL_CurrentBeginThread pfnBeginThread,
|
||||||
@@ -138,9 +135,6 @@ SDL_CreateThreadWithStackSize(int (SDLCALL * fn) (void *),
|
|||||||
pfnSDL_CurrentEndThread pfnEndThread);
|
pfnSDL_CurrentEndThread pfnEndThread);
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a thread.
|
|
||||||
*/
|
|
||||||
#if defined(SDL_CreateThread) && SDL_DYNAMIC_API
|
#if defined(SDL_CreateThread) && SDL_DYNAMIC_API
|
||||||
#undef SDL_CreateThread
|
#undef SDL_CreateThread
|
||||||
#define SDL_CreateThread(fn, name, data) SDL_CreateThread_REAL(fn, name, data, (pfnSDL_CurrentBeginThread)SDL_beginthread, (pfnSDL_CurrentEndThread)SDL_endthread)
|
#define SDL_CreateThread(fn, name, data) SDL_CreateThread_REAL(fn, name, data, (pfnSDL_CurrentBeginThread)SDL_beginthread, (pfnSDL_CurrentEndThread)SDL_endthread)
|
||||||
@@ -205,6 +199,8 @@ SDL_CreateThreadWithStackSize(SDL_ThreadFunction fn, const char *name, const siz
|
|||||||
* new thread could not be created; call SDL_GetError() for more
|
* new thread could not be created; call SDL_GetError() for more
|
||||||
* information.
|
* information.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_CreateThreadWithStackSize
|
* \sa SDL_CreateThreadWithStackSize
|
||||||
* \sa SDL_WaitThread
|
* \sa SDL_WaitThread
|
||||||
*/
|
*/
|
||||||
@@ -250,6 +246,8 @@ SDL_CreateThread(SDL_ThreadFunction fn, const char *name, void *data);
|
|||||||
* new thread could not be created; call SDL_GetError() for more
|
* new thread could not be created; call SDL_GetError() for more
|
||||||
* information.
|
* information.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.9.
|
||||||
|
*
|
||||||
* \sa SDL_WaitThread
|
* \sa SDL_WaitThread
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC SDL_Thread *SDLCALL
|
extern DECLSPEC SDL_Thread *SDLCALL
|
||||||
@@ -267,6 +265,8 @@ SDL_CreateThreadWithStackSize(SDL_ThreadFunction fn, const char *name, const siz
|
|||||||
* \returns a pointer to a UTF-8 string that names the specified thread, or
|
* \returns a pointer to a UTF-8 string that names the specified thread, or
|
||||||
* NULL if it doesn't have a name.
|
* NULL if it doesn't have a name.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_CreateThread
|
* \sa SDL_CreateThread
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC const char *SDLCALL SDL_GetThreadName(SDL_Thread *thread);
|
extern DECLSPEC const char *SDLCALL SDL_GetThreadName(SDL_Thread *thread);
|
||||||
@@ -283,6 +283,8 @@ extern DECLSPEC const char *SDLCALL SDL_GetThreadName(SDL_Thread *thread);
|
|||||||
*
|
*
|
||||||
* \returns the ID of the current thread.
|
* \returns the ID of the current thread.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_GetThreadID
|
* \sa SDL_GetThreadID
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC SDL_threadID SDLCALL SDL_ThreadID(void);
|
extern DECLSPEC SDL_threadID SDLCALL SDL_ThreadID(void);
|
||||||
@@ -298,6 +300,8 @@ extern DECLSPEC SDL_threadID SDLCALL SDL_ThreadID(void);
|
|||||||
* \returns the ID of the specified thread, or the ID of the current thread if
|
* \returns the ID of the specified thread, or the ID of the current thread if
|
||||||
* `thread` is NULL.
|
* `thread` is NULL.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_ThreadID
|
* \sa SDL_ThreadID
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC SDL_threadID SDLCALL SDL_GetThreadID(SDL_Thread * thread);
|
extern DECLSPEC SDL_threadID SDLCALL SDL_GetThreadID(SDL_Thread * thread);
|
||||||
@@ -312,6 +316,8 @@ extern DECLSPEC SDL_threadID SDLCALL SDL_GetThreadID(SDL_Thread * thread);
|
|||||||
* \param priority the SDL_ThreadPriority to set
|
* \param priority the SDL_ThreadPriority to set
|
||||||
* \returns 0 on success or a negative error code on failure; call
|
* \returns 0 on success or a negative error code on failure; call
|
||||||
* SDL_GetError() for more information.
|
* SDL_GetError() for more information.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC int SDLCALL SDL_SetThreadPriority(SDL_ThreadPriority priority);
|
extern DECLSPEC int SDLCALL SDL_SetThreadPriority(SDL_ThreadPriority priority);
|
||||||
|
|
||||||
@@ -343,6 +349,8 @@ extern DECLSPEC int SDLCALL SDL_SetThreadPriority(SDL_ThreadPriority priority);
|
|||||||
* from the thread function by its 'return', or NULL to not
|
* from the thread function by its 'return', or NULL to not
|
||||||
* receive such value back.
|
* receive such value back.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_CreateThread
|
* \sa SDL_CreateThread
|
||||||
* \sa SDL_DetachThread
|
* \sa SDL_DetachThread
|
||||||
*/
|
*/
|
||||||
@@ -440,6 +448,8 @@ extern DECLSPEC int SDLCALL SDL_TLSSet(SDL_TLSID id, const void *value, void (SD
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Cleanup all TLS data for this thread.
|
* Cleanup all TLS data for this thread.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.16.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC void SDLCALL SDL_TLSCleanup(void);
|
extern DECLSPEC void SDLCALL SDL_TLSCleanup(void);
|
||||||
|
|
||||||
|
|||||||
+54
-4
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
Simple DirectMedia Layer
|
Simple DirectMedia Layer
|
||||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
||||||
|
|
||||||
This software is provided 'as-is', without any express or implied
|
This software is provided 'as-is', without any express or implied
|
||||||
warranty. In no event will the authors be held liable for any damages
|
warranty. In no event will the authors be held liable for any damages
|
||||||
@@ -42,24 +42,66 @@ extern "C" {
|
|||||||
*
|
*
|
||||||
* This value wraps if the program runs for more than ~49 days.
|
* This value wraps if the program runs for more than ~49 days.
|
||||||
*
|
*
|
||||||
|
* This function is not recommended as of SDL 2.0.18; use SDL_GetTicks64()
|
||||||
|
* instead, where the value doesn't wrap every ~49 days. There are places in
|
||||||
|
* SDL where we provide a 32-bit timestamp that can not change without
|
||||||
|
* breaking binary compatibility, though, so this function isn't officially
|
||||||
|
* deprecated.
|
||||||
|
*
|
||||||
* \returns an unsigned 32-bit value representing the number of milliseconds
|
* \returns an unsigned 32-bit value representing the number of milliseconds
|
||||||
* since the SDL library initialized.
|
* since the SDL library initialized.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_TICKS_PASSED
|
* \sa SDL_TICKS_PASSED
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC Uint32 SDLCALL SDL_GetTicks(void);
|
extern DECLSPEC Uint32 SDLCALL SDL_GetTicks(void);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Compare SDL ticks values, and return true if `A` has passed `B`.
|
* Get the number of milliseconds since SDL library initialization.
|
||||||
|
*
|
||||||
|
* Note that you should not use the SDL_TICKS_PASSED macro with values
|
||||||
|
* returned by this function, as that macro does clever math to compensate for
|
||||||
|
* the 32-bit overflow every ~49 days that SDL_GetTicks() suffers from. 64-bit
|
||||||
|
* values from this function can be safely compared directly.
|
||||||
*
|
*
|
||||||
* For example, if you want to wait 100 ms, you could do this:
|
* For example, if you want to wait 100 ms, you could do this:
|
||||||
*
|
*
|
||||||
* ```c++
|
* ```c
|
||||||
* Uint32 timeout = SDL_GetTicks() + 100;
|
* const Uint64 timeout = SDL_GetTicks64() + 100;
|
||||||
|
* while (SDL_GetTicks64() < timeout) {
|
||||||
|
* // ... do work until timeout has elapsed
|
||||||
|
* }
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* \returns an unsigned 64-bit value representing the number of milliseconds
|
||||||
|
* since the SDL library initialized.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.18.
|
||||||
|
*/
|
||||||
|
extern DECLSPEC Uint64 SDLCALL SDL_GetTicks64(void);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Compare 32-bit SDL ticks values, and return true if `A` has passed `B`.
|
||||||
|
*
|
||||||
|
* This should be used with results from SDL_GetTicks(), as this macro
|
||||||
|
* attempts to deal with the 32-bit counter wrapping back to zero every ~49
|
||||||
|
* days, but should _not_ be used with SDL_GetTicks64(), which does not have
|
||||||
|
* that problem.
|
||||||
|
*
|
||||||
|
* For example, with SDL_GetTicks(), if you want to wait 100 ms, you could
|
||||||
|
* do this:
|
||||||
|
*
|
||||||
|
* ```c
|
||||||
|
* const Uint32 timeout = SDL_GetTicks() + 100;
|
||||||
* while (!SDL_TICKS_PASSED(SDL_GetTicks(), timeout)) {
|
* while (!SDL_TICKS_PASSED(SDL_GetTicks(), timeout)) {
|
||||||
* // ... do work until timeout has elapsed
|
* // ... do work until timeout has elapsed
|
||||||
* }
|
* }
|
||||||
* ```
|
* ```
|
||||||
|
*
|
||||||
|
* Note that this does not handle tick differences greater
|
||||||
|
* than 2^31 so take care when using the above kind of code
|
||||||
|
* with large timeout delays (tens of days).
|
||||||
*/
|
*/
|
||||||
#define SDL_TICKS_PASSED(A, B) ((Sint32)((B) - (A)) <= 0)
|
#define SDL_TICKS_PASSED(A, B) ((Sint32)((B) - (A)) <= 0)
|
||||||
|
|
||||||
@@ -74,6 +116,8 @@ extern DECLSPEC Uint32 SDLCALL SDL_GetTicks(void);
|
|||||||
*
|
*
|
||||||
* \returns the current counter value.
|
* \returns the current counter value.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_GetPerformanceFrequency
|
* \sa SDL_GetPerformanceFrequency
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC Uint64 SDLCALL SDL_GetPerformanceCounter(void);
|
extern DECLSPEC Uint64 SDLCALL SDL_GetPerformanceCounter(void);
|
||||||
@@ -97,6 +141,8 @@ extern DECLSPEC Uint64 SDLCALL SDL_GetPerformanceFrequency(void);
|
|||||||
* scheduling.
|
* scheduling.
|
||||||
*
|
*
|
||||||
* \param ms the number of milliseconds to delay
|
* \param ms the number of milliseconds to delay
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC void SDLCALL SDL_Delay(Uint32 ms);
|
extern DECLSPEC void SDLCALL SDL_Delay(Uint32 ms);
|
||||||
|
|
||||||
@@ -143,6 +189,8 @@ typedef int SDL_TimerID;
|
|||||||
* \returns a timer ID or 0 if an error occurs; call SDL_GetError() for more
|
* \returns a timer ID or 0 if an error occurs; call SDL_GetError() for more
|
||||||
* information.
|
* information.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_RemoveTimer
|
* \sa SDL_RemoveTimer
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC SDL_TimerID SDLCALL SDL_AddTimer(Uint32 interval,
|
extern DECLSPEC SDL_TimerID SDLCALL SDL_AddTimer(Uint32 interval,
|
||||||
@@ -156,6 +204,8 @@ extern DECLSPEC SDL_TimerID SDLCALL SDL_AddTimer(Uint32 interval,
|
|||||||
* \returns SDL_TRUE if the timer is removed or SDL_FALSE if the timer wasn't
|
* \returns SDL_TRUE if the timer is removed or SDL_FALSE if the timer wasn't
|
||||||
* found.
|
* found.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_AddTimer
|
* \sa SDL_AddTimer
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC SDL_bool SDLCALL SDL_RemoveTimer(SDL_TimerID id);
|
extern DECLSPEC SDL_bool SDLCALL SDL_RemoveTimer(SDL_TimerID id);
|
||||||
|
|||||||
+5
-1
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
Simple DirectMedia Layer
|
Simple DirectMedia Layer
|
||||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
||||||
|
|
||||||
This software is provided 'as-is', without any express or implied
|
This software is provided 'as-is', without any express or implied
|
||||||
warranty. In no event will the authors be held liable for any damages
|
warranty. In no event will the authors be held liable for any damages
|
||||||
@@ -97,6 +97,8 @@ extern DECLSPEC SDL_TouchID SDLCALL SDL_GetTouchDevice(int index);
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the type of the given touch device.
|
* Get the type of the given touch device.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.10.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC SDL_TouchDeviceType SDLCALL SDL_GetTouchDeviceType(SDL_TouchID touchID);
|
extern DECLSPEC SDL_TouchDeviceType SDLCALL SDL_GetTouchDeviceType(SDL_TouchID touchID);
|
||||||
|
|
||||||
@@ -123,6 +125,8 @@ extern DECLSPEC int SDLCALL SDL_GetNumTouchFingers(SDL_TouchID touchID);
|
|||||||
* \returns a pointer to the SDL_Finger object or NULL if no object at the
|
* \returns a pointer to the SDL_Finger object or NULL if no object at the
|
||||||
* given ID and index could be found.
|
* given ID and index could be found.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_RecordGesture
|
* \sa SDL_RecordGesture
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC SDL_Finger * SDLCALL SDL_GetTouchFinger(SDL_TouchID touchID, int index);
|
extern DECLSPEC SDL_Finger * SDLCALL SDL_GetTouchFinger(SDL_TouchID touchID, int index);
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
Simple DirectMedia Layer
|
Simple DirectMedia Layer
|
||||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
||||||
|
|
||||||
This software is provided 'as-is', without any express or implied
|
This software is provided 'as-is', without any express or implied
|
||||||
warranty. In no event will the authors be held liable for any damages
|
warranty. In no event will the authors be held liable for any damages
|
||||||
|
|||||||
+22
-6
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
Simple DirectMedia Layer
|
Simple DirectMedia Layer
|
||||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
||||||
|
|
||||||
This software is provided 'as-is', without any express or implied
|
This software is provided 'as-is', without any express or implied
|
||||||
warranty. In no event will the authors be held liable for any damages
|
warranty. In no event will the authors be held liable for any damages
|
||||||
@@ -59,7 +59,7 @@ typedef struct SDL_version
|
|||||||
*/
|
*/
|
||||||
#define SDL_MAJOR_VERSION 2
|
#define SDL_MAJOR_VERSION 2
|
||||||
#define SDL_MINOR_VERSION 0
|
#define SDL_MINOR_VERSION 0
|
||||||
#define SDL_PATCHLEVEL 16
|
#define SDL_PATCHLEVEL 20
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Macro to determine SDL version program was compiled against.
|
* Macro to determine SDL version program was compiled against.
|
||||||
@@ -118,6 +118,8 @@ typedef struct SDL_version
|
|||||||
*
|
*
|
||||||
* \param ver the SDL_version structure that contains the version information
|
* \param ver the SDL_version structure that contains the version information
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_GetRevision
|
* \sa SDL_GetRevision
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC void SDLCALL SDL_GetVersion(SDL_version * ver);
|
extern DECLSPEC void SDLCALL SDL_GetVersion(SDL_version * ver);
|
||||||
@@ -145,6 +147,8 @@ extern DECLSPEC void SDLCALL SDL_GetVersion(SDL_version * ver);
|
|||||||
* \returns an arbitrary string, uniquely identifying the exact revision of
|
* \returns an arbitrary string, uniquely identifying the exact revision of
|
||||||
* the SDL library in use.
|
* the SDL library in use.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_GetVersion
|
* \sa SDL_GetVersion
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC const char *SDLCALL SDL_GetRevision(void);
|
extern DECLSPEC const char *SDLCALL SDL_GetRevision(void);
|
||||||
@@ -153,10 +157,22 @@ extern DECLSPEC const char *SDLCALL SDL_GetRevision(void);
|
|||||||
* Obsolete function, do not use.
|
* Obsolete function, do not use.
|
||||||
*
|
*
|
||||||
* When SDL was hosted in a Mercurial repository, and was built carefully,
|
* When SDL was hosted in a Mercurial repository, and was built carefully,
|
||||||
* this would return the revision number that the build was created from.
|
* this would return the revision number that the build was created from. This
|
||||||
* This number was not reliable for several reasons, but more importantly,
|
* number was not reliable for several reasons, but more importantly, SDL is
|
||||||
* SDL is now hosted in a git repository, which does not offer numbers at
|
* now hosted in a git repository, which does not offer numbers at all, only
|
||||||
* all, only hashes. This function only ever returns zero now. Don't use it.
|
* hashes. This function only ever returns zero now. Don't use it.
|
||||||
|
*
|
||||||
|
* Before SDL 2.0.16, this might have returned an unreliable, but non-zero
|
||||||
|
* number.
|
||||||
|
*
|
||||||
|
* \deprecated Use SDL_GetRevision() instead; if SDL was carefully built, it
|
||||||
|
* will return a git hash.
|
||||||
|
*
|
||||||
|
* \returns zero, always, in modern SDL releases.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
|
* \sa SDL_GetRevision
|
||||||
*/
|
*/
|
||||||
extern SDL_DEPRECATED DECLSPEC int SDLCALL SDL_GetRevisionNumber(void);
|
extern SDL_DEPRECATED DECLSPEC int SDLCALL SDL_GetRevisionNumber(void);
|
||||||
|
|
||||||
|
|||||||
+199
-12
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
Simple DirectMedia Layer
|
Simple DirectMedia Layer
|
||||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
||||||
|
|
||||||
This software is provided 'as-is', without any express or implied
|
This software is provided 'as-is', without any express or implied
|
||||||
warranty. In no event will the authors be held liable for any damages
|
warranty. In no event will the authors be held liable for any damages
|
||||||
@@ -174,7 +174,9 @@ typedef enum
|
|||||||
SDL_WINDOWEVENT_FOCUS_LOST, /**< Window has lost keyboard focus */
|
SDL_WINDOWEVENT_FOCUS_LOST, /**< Window has lost keyboard focus */
|
||||||
SDL_WINDOWEVENT_CLOSE, /**< The window manager requests that the window be closed */
|
SDL_WINDOWEVENT_CLOSE, /**< The window manager requests that the window be closed */
|
||||||
SDL_WINDOWEVENT_TAKE_FOCUS, /**< Window is being offered a focus (should SetWindowInputFocus() on itself or a subwindow, or ignore) */
|
SDL_WINDOWEVENT_TAKE_FOCUS, /**< Window is being offered a focus (should SetWindowInputFocus() on itself or a subwindow, or ignore) */
|
||||||
SDL_WINDOWEVENT_HIT_TEST /**< Window had a hit test that wasn't SDL_HITTEST_NORMAL. */
|
SDL_WINDOWEVENT_HIT_TEST, /**< Window had a hit test that wasn't SDL_HITTEST_NORMAL. */
|
||||||
|
SDL_WINDOWEVENT_ICCPROF_CHANGED,/**< The ICC profile of the window's display has changed. */
|
||||||
|
SDL_WINDOWEVENT_DISPLAY_CHANGED /**< Window has been moved to display data1. */
|
||||||
} SDL_WindowEventID;
|
} SDL_WindowEventID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -207,7 +209,7 @@ typedef enum
|
|||||||
{
|
{
|
||||||
SDL_FLASH_CANCEL, /**< Cancel any window flash state */
|
SDL_FLASH_CANCEL, /**< Cancel any window flash state */
|
||||||
SDL_FLASH_BRIEFLY, /**< Flash the window briefly to get attention */
|
SDL_FLASH_BRIEFLY, /**< Flash the window briefly to get attention */
|
||||||
SDL_FLASH_UNTIL_FOCUSED, /**< Flash the window until it gets focus */
|
SDL_FLASH_UNTIL_FOCUSED /**< Flash the window until it gets focus */
|
||||||
} SDL_FlashOperation;
|
} SDL_FlashOperation;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -284,6 +286,8 @@ typedef enum
|
|||||||
* \returns a number >= 1 on success or a negative error code on failure; call
|
* \returns a number >= 1 on success or a negative error code on failure; call
|
||||||
* SDL_GetError() for more information.
|
* SDL_GetError() for more information.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_GetVideoDriver
|
* \sa SDL_GetVideoDriver
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC int SDLCALL SDL_GetNumVideoDrivers(void);
|
extern DECLSPEC int SDLCALL SDL_GetNumVideoDrivers(void);
|
||||||
@@ -297,6 +301,8 @@ extern DECLSPEC int SDLCALL SDL_GetNumVideoDrivers(void);
|
|||||||
* \param index the index of a video driver
|
* \param index the index of a video driver
|
||||||
* \returns the name of the video driver with the given **index**.
|
* \returns the name of the video driver with the given **index**.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_GetNumVideoDrivers
|
* \sa SDL_GetNumVideoDrivers
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC const char *SDLCALL SDL_GetVideoDriver(int index);
|
extern DECLSPEC const char *SDLCALL SDL_GetVideoDriver(int index);
|
||||||
@@ -323,6 +329,8 @@ extern DECLSPEC const char *SDLCALL SDL_GetVideoDriver(int index);
|
|||||||
* \returns 0 on success or a negative error code on failure; call
|
* \returns 0 on success or a negative error code on failure; call
|
||||||
* SDL_GetError() for more information.
|
* SDL_GetError() for more information.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_GetNumVideoDrivers
|
* \sa SDL_GetNumVideoDrivers
|
||||||
* \sa SDL_GetVideoDriver
|
* \sa SDL_GetVideoDriver
|
||||||
* \sa SDL_InitSubSystem
|
* \sa SDL_InitSubSystem
|
||||||
@@ -335,6 +343,8 @@ extern DECLSPEC int SDLCALL SDL_VideoInit(const char *driver_name);
|
|||||||
*
|
*
|
||||||
* This function closes all windows, and restores the original video mode.
|
* This function closes all windows, and restores the original video mode.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_VideoInit
|
* \sa SDL_VideoInit
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC void SDLCALL SDL_VideoQuit(void);
|
extern DECLSPEC void SDLCALL SDL_VideoQuit(void);
|
||||||
@@ -388,6 +398,8 @@ extern DECLSPEC const char * SDLCALL SDL_GetDisplayName(int displayIndex);
|
|||||||
* \returns 0 on success or a negative error code on failure; call
|
* \returns 0 on success or a negative error code on failure; call
|
||||||
* SDL_GetError() for more information.
|
* SDL_GetError() for more information.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_GetNumVideoDisplays
|
* \sa SDL_GetNumVideoDisplays
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC int SDLCALL SDL_GetDisplayBounds(int displayIndex, SDL_Rect * rect);
|
extern DECLSPEC int SDLCALL SDL_GetDisplayBounds(int displayIndex, SDL_Rect * rect);
|
||||||
@@ -456,6 +468,8 @@ extern DECLSPEC int SDLCALL SDL_GetDisplayDPI(int displayIndex, float * ddpi, fl
|
|||||||
* \returns The SDL_DisplayOrientation enum value of the display, or
|
* \returns The SDL_DisplayOrientation enum value of the display, or
|
||||||
* `SDL_ORIENTATION_UNKNOWN` if it isn't available.
|
* `SDL_ORIENTATION_UNKNOWN` if it isn't available.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.9.
|
||||||
|
*
|
||||||
* \sa SDL_GetNumVideoDisplays
|
* \sa SDL_GetNumVideoDisplays
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC SDL_DisplayOrientation SDLCALL SDL_GetDisplayOrientation(int displayIndex);
|
extern DECLSPEC SDL_DisplayOrientation SDLCALL SDL_GetDisplayOrientation(int displayIndex);
|
||||||
@@ -495,6 +509,8 @@ extern DECLSPEC int SDLCALL SDL_GetNumDisplayModes(int displayIndex);
|
|||||||
* \returns 0 on success or a negative error code on failure; call
|
* \returns 0 on success or a negative error code on failure; call
|
||||||
* SDL_GetError() for more information.
|
* SDL_GetError() for more information.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_GetNumDisplayModes
|
* \sa SDL_GetNumDisplayModes
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC int SDLCALL SDL_GetDisplayMode(int displayIndex, int modeIndex,
|
extern DECLSPEC int SDLCALL SDL_GetDisplayMode(int displayIndex, int modeIndex,
|
||||||
@@ -514,6 +530,8 @@ extern DECLSPEC int SDLCALL SDL_GetDisplayMode(int displayIndex, int modeIndex,
|
|||||||
* \returns 0 on success or a negative error code on failure; call
|
* \returns 0 on success or a negative error code on failure; call
|
||||||
* SDL_GetError() for more information.
|
* SDL_GetError() for more information.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_GetCurrentDisplayMode
|
* \sa SDL_GetCurrentDisplayMode
|
||||||
* \sa SDL_GetDisplayMode
|
* \sa SDL_GetDisplayMode
|
||||||
* \sa SDL_SetWindowDisplayMode
|
* \sa SDL_SetWindowDisplayMode
|
||||||
@@ -534,6 +552,8 @@ extern DECLSPEC int SDLCALL SDL_GetDesktopDisplayMode(int displayIndex, SDL_Disp
|
|||||||
* \returns 0 on success or a negative error code on failure; call
|
* \returns 0 on success or a negative error code on failure; call
|
||||||
* SDL_GetError() for more information.
|
* SDL_GetError() for more information.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_GetDesktopDisplayMode
|
* \sa SDL_GetDesktopDisplayMode
|
||||||
* \sa SDL_GetDisplayMode
|
* \sa SDL_GetDisplayMode
|
||||||
* \sa SDL_GetNumVideoDisplays
|
* \sa SDL_GetNumVideoDisplays
|
||||||
@@ -560,6 +580,8 @@ extern DECLSPEC int SDLCALL SDL_GetCurrentDisplayMode(int displayIndex, SDL_Disp
|
|||||||
* \returns the passed in value `closest` or NULL if no matching video mode
|
* \returns the passed in value `closest` or NULL if no matching video mode
|
||||||
* was available; call SDL_GetError() for more information.
|
* was available; call SDL_GetError() for more information.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_GetDisplayMode
|
* \sa SDL_GetDisplayMode
|
||||||
* \sa SDL_GetNumDisplayModes
|
* \sa SDL_GetNumDisplayModes
|
||||||
*/
|
*/
|
||||||
@@ -573,6 +595,8 @@ extern DECLSPEC SDL_DisplayMode * SDLCALL SDL_GetClosestDisplayMode(int displayI
|
|||||||
* success or a negative error code on failure; call SDL_GetError()
|
* success or a negative error code on failure; call SDL_GetError()
|
||||||
* for more information.
|
* for more information.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_GetDisplayBounds
|
* \sa SDL_GetDisplayBounds
|
||||||
* \sa SDL_GetNumVideoDisplays
|
* \sa SDL_GetNumVideoDisplays
|
||||||
*/
|
*/
|
||||||
@@ -592,6 +616,8 @@ extern DECLSPEC int SDLCALL SDL_GetWindowDisplayIndex(SDL_Window * window);
|
|||||||
* \returns 0 on success or a negative error code on failure; call
|
* \returns 0 on success or a negative error code on failure; call
|
||||||
* SDL_GetError() for more information.
|
* SDL_GetError() for more information.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_GetWindowDisplayMode
|
* \sa SDL_GetWindowDisplayMode
|
||||||
* \sa SDL_SetWindowFullscreen
|
* \sa SDL_SetWindowFullscreen
|
||||||
*/
|
*/
|
||||||
@@ -607,12 +633,28 @@ extern DECLSPEC int SDLCALL SDL_SetWindowDisplayMode(SDL_Window * window,
|
|||||||
* \returns 0 on success or a negative error code on failure; call
|
* \returns 0 on success or a negative error code on failure; call
|
||||||
* SDL_GetError() for more information.
|
* SDL_GetError() for more information.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_SetWindowDisplayMode
|
* \sa SDL_SetWindowDisplayMode
|
||||||
* \sa SDL_SetWindowFullscreen
|
* \sa SDL_SetWindowFullscreen
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC int SDLCALL SDL_GetWindowDisplayMode(SDL_Window * window,
|
extern DECLSPEC int SDLCALL SDL_GetWindowDisplayMode(SDL_Window * window,
|
||||||
SDL_DisplayMode * mode);
|
SDL_DisplayMode * mode);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the raw ICC profile data for the screen the window is currently on.
|
||||||
|
*
|
||||||
|
* Data returned should be freed with SDL_free.
|
||||||
|
*
|
||||||
|
* \param window the window to query
|
||||||
|
* \param size the size of the ICC profile
|
||||||
|
* \returns the raw ICC profile data on success or NULL on failure; call
|
||||||
|
* SDL_GetError() for more information.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.18.
|
||||||
|
*/
|
||||||
|
extern DECLSPEC void* SDLCALL SDL_GetWindowICCProfile(SDL_Window * window, size_t* size);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the pixel format associated with the window.
|
* Get the pixel format associated with the window.
|
||||||
*
|
*
|
||||||
@@ -620,6 +662,8 @@ extern DECLSPEC int SDLCALL SDL_GetWindowDisplayMode(SDL_Window * window,
|
|||||||
* \returns the pixel format of the window on success or
|
* \returns the pixel format of the window on success or
|
||||||
* SDL_PIXELFORMAT_UNKNOWN on failure; call SDL_GetError() for more
|
* SDL_PIXELFORMAT_UNKNOWN on failure; call SDL_GetError() for more
|
||||||
* information.
|
* information.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC Uint32 SDLCALL SDL_GetWindowPixelFormat(SDL_Window * window);
|
extern DECLSPEC Uint32 SDLCALL SDL_GetWindowPixelFormat(SDL_Window * window);
|
||||||
|
|
||||||
@@ -707,6 +751,8 @@ extern DECLSPEC SDL_Window * SDLCALL SDL_CreateWindow(const char *title,
|
|||||||
* \returns the window that was created or NULL on failure; call
|
* \returns the window that was created or NULL on failure; call
|
||||||
* SDL_GetError() for more information.
|
* SDL_GetError() for more information.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_CreateWindow
|
* \sa SDL_CreateWindow
|
||||||
* \sa SDL_DestroyWindow
|
* \sa SDL_DestroyWindow
|
||||||
*/
|
*/
|
||||||
@@ -738,6 +784,8 @@ extern DECLSPEC Uint32 SDLCALL SDL_GetWindowID(SDL_Window * window);
|
|||||||
* \returns the window associated with `id` or NULL if it doesn't exist; call
|
* \returns the window associated with `id` or NULL if it doesn't exist; call
|
||||||
* SDL_GetError() for more information.
|
* SDL_GetError() for more information.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_GetWindowID
|
* \sa SDL_GetWindowID
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC SDL_Window * SDLCALL SDL_GetWindowFromID(Uint32 id);
|
extern DECLSPEC SDL_Window * SDLCALL SDL_GetWindowFromID(Uint32 id);
|
||||||
@@ -748,6 +796,8 @@ extern DECLSPEC SDL_Window * SDLCALL SDL_GetWindowFromID(Uint32 id);
|
|||||||
* \param window the window to query
|
* \param window the window to query
|
||||||
* \returns a mask of the SDL_WindowFlags associated with `window`
|
* \returns a mask of the SDL_WindowFlags associated with `window`
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_CreateWindow
|
* \sa SDL_CreateWindow
|
||||||
* \sa SDL_HideWindow
|
* \sa SDL_HideWindow
|
||||||
* \sa SDL_MaximizeWindow
|
* \sa SDL_MaximizeWindow
|
||||||
@@ -766,6 +816,8 @@ extern DECLSPEC Uint32 SDLCALL SDL_GetWindowFlags(SDL_Window * window);
|
|||||||
* \param window the window to change
|
* \param window the window to change
|
||||||
* \param title the desired window title in UTF-8 format
|
* \param title the desired window title in UTF-8 format
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_GetWindowTitle
|
* \sa SDL_GetWindowTitle
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC void SDLCALL SDL_SetWindowTitle(SDL_Window * window,
|
extern DECLSPEC void SDLCALL SDL_SetWindowTitle(SDL_Window * window,
|
||||||
@@ -778,6 +830,8 @@ extern DECLSPEC void SDLCALL SDL_SetWindowTitle(SDL_Window * window,
|
|||||||
* \returns the title of the window in UTF-8 format or "" if there is no
|
* \returns the title of the window in UTF-8 format or "" if there is no
|
||||||
* title.
|
* title.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_SetWindowTitle
|
* \sa SDL_SetWindowTitle
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC const char *SDLCALL SDL_GetWindowTitle(SDL_Window * window);
|
extern DECLSPEC const char *SDLCALL SDL_GetWindowTitle(SDL_Window * window);
|
||||||
@@ -787,6 +841,8 @@ extern DECLSPEC const char *SDLCALL SDL_GetWindowTitle(SDL_Window * window);
|
|||||||
*
|
*
|
||||||
* \param window the window to change
|
* \param window the window to change
|
||||||
* \param icon an SDL_Surface structure containing the icon for the window
|
* \param icon an SDL_Surface structure containing the icon for the window
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC void SDLCALL SDL_SetWindowIcon(SDL_Window * window,
|
extern DECLSPEC void SDLCALL SDL_SetWindowIcon(SDL_Window * window,
|
||||||
SDL_Surface * icon);
|
SDL_Surface * icon);
|
||||||
@@ -801,6 +857,8 @@ extern DECLSPEC void SDLCALL SDL_SetWindowIcon(SDL_Window * window,
|
|||||||
* \param userdata the associated pointer
|
* \param userdata the associated pointer
|
||||||
* \returns the previous value associated with `name`.
|
* \returns the previous value associated with `name`.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_GetWindowData
|
* \sa SDL_GetWindowData
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC void* SDLCALL SDL_SetWindowData(SDL_Window * window,
|
extern DECLSPEC void* SDLCALL SDL_SetWindowData(SDL_Window * window,
|
||||||
@@ -814,6 +872,8 @@ extern DECLSPEC void* SDLCALL SDL_SetWindowData(SDL_Window * window,
|
|||||||
* \param name the name of the pointer
|
* \param name the name of the pointer
|
||||||
* \returns the value associated with `name`.
|
* \returns the value associated with `name`.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_SetWindowData
|
* \sa SDL_SetWindowData
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC void *SDLCALL SDL_GetWindowData(SDL_Window * window,
|
extern DECLSPEC void *SDLCALL SDL_GetWindowData(SDL_Window * window,
|
||||||
@@ -830,6 +890,8 @@ extern DECLSPEC void *SDLCALL SDL_GetWindowData(SDL_Window * window,
|
|||||||
* \param y the y coordinate of the window in screen coordinates, or
|
* \param y the y coordinate of the window in screen coordinates, or
|
||||||
* `SDL_WINDOWPOS_CENTERED` or `SDL_WINDOWPOS_UNDEFINED`
|
* `SDL_WINDOWPOS_CENTERED` or `SDL_WINDOWPOS_UNDEFINED`
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_GetWindowPosition
|
* \sa SDL_GetWindowPosition
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC void SDLCALL SDL_SetWindowPosition(SDL_Window * window,
|
extern DECLSPEC void SDLCALL SDL_SetWindowPosition(SDL_Window * window,
|
||||||
@@ -847,6 +909,8 @@ extern DECLSPEC void SDLCALL SDL_SetWindowPosition(SDL_Window * window,
|
|||||||
* \param y a pointer filled in with the y position of the window, in screen
|
* \param y a pointer filled in with the y position of the window, in screen
|
||||||
* coordinates, may be NULL
|
* coordinates, may be NULL
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_SetWindowPosition
|
* \sa SDL_SetWindowPosition
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC void SDLCALL SDL_GetWindowPosition(SDL_Window * window,
|
extern DECLSPEC void SDLCALL SDL_GetWindowPosition(SDL_Window * window,
|
||||||
@@ -869,6 +933,8 @@ extern DECLSPEC void SDLCALL SDL_GetWindowPosition(SDL_Window * window,
|
|||||||
* \param h the height of the window in pixels, in screen coordinates, must be
|
* \param h the height of the window in pixels, in screen coordinates, must be
|
||||||
* > 0
|
* > 0
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_GetWindowSize
|
* \sa SDL_GetWindowSize
|
||||||
* \sa SDL_SetWindowDisplayMode
|
* \sa SDL_SetWindowDisplayMode
|
||||||
*/
|
*/
|
||||||
@@ -893,6 +959,8 @@ extern DECLSPEC void SDLCALL SDL_SetWindowSize(SDL_Window * window, int w,
|
|||||||
* \param h a pointer filled in with the height of the window, in screen
|
* \param h a pointer filled in with the height of the window, in screen
|
||||||
* coordinates, may be NULL
|
* coordinates, may be NULL
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_GL_GetDrawableSize
|
* \sa SDL_GL_GetDrawableSize
|
||||||
* \sa SDL_Vulkan_GetDrawableSize
|
* \sa SDL_Vulkan_GetDrawableSize
|
||||||
* \sa SDL_SetWindowSize
|
* \sa SDL_SetWindowSize
|
||||||
@@ -943,6 +1011,8 @@ extern DECLSPEC int SDLCALL SDL_GetWindowBordersSize(SDL_Window * window,
|
|||||||
* \param min_w the minimum width of the window in pixels
|
* \param min_w the minimum width of the window in pixels
|
||||||
* \param min_h the minimum height of the window in pixels
|
* \param min_h the minimum height of the window in pixels
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_GetWindowMinimumSize
|
* \sa SDL_GetWindowMinimumSize
|
||||||
* \sa SDL_SetWindowMaximumSize
|
* \sa SDL_SetWindowMaximumSize
|
||||||
*/
|
*/
|
||||||
@@ -958,6 +1028,8 @@ extern DECLSPEC void SDLCALL SDL_SetWindowMinimumSize(SDL_Window * window,
|
|||||||
* \param h a pointer filled in with the minimum height of the window, may be
|
* \param h a pointer filled in with the minimum height of the window, may be
|
||||||
* NULL
|
* NULL
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_GetWindowMaximumSize
|
* \sa SDL_GetWindowMaximumSize
|
||||||
* \sa SDL_SetWindowMinimumSize
|
* \sa SDL_SetWindowMinimumSize
|
||||||
*/
|
*/
|
||||||
@@ -971,6 +1043,8 @@ extern DECLSPEC void SDLCALL SDL_GetWindowMinimumSize(SDL_Window * window,
|
|||||||
* \param max_w the maximum width of the window in pixels
|
* \param max_w the maximum width of the window in pixels
|
||||||
* \param max_h the maximum height of the window in pixels
|
* \param max_h the maximum height of the window in pixels
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_GetWindowMaximumSize
|
* \sa SDL_GetWindowMaximumSize
|
||||||
* \sa SDL_SetWindowMinimumSize
|
* \sa SDL_SetWindowMinimumSize
|
||||||
*/
|
*/
|
||||||
@@ -986,6 +1060,8 @@ extern DECLSPEC void SDLCALL SDL_SetWindowMaximumSize(SDL_Window * window,
|
|||||||
* \param h a pointer filled in with the maximum height of the window, may be
|
* \param h a pointer filled in with the maximum height of the window, may be
|
||||||
* NULL
|
* NULL
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_GetWindowMinimumSize
|
* \sa SDL_GetWindowMinimumSize
|
||||||
* \sa SDL_SetWindowMaximumSize
|
* \sa SDL_SetWindowMaximumSize
|
||||||
*/
|
*/
|
||||||
@@ -1031,25 +1107,29 @@ extern DECLSPEC void SDLCALL SDL_SetWindowResizable(SDL_Window * window,
|
|||||||
SDL_bool resizable);
|
SDL_bool resizable);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Set the window to always be above the others.
|
* Set the window to always be above the others.
|
||||||
*
|
*
|
||||||
* This will add or remove the window's `SDL_WINDOW_ALWAYS_ON_TOP`
|
* This will add or remove the window's `SDL_WINDOW_ALWAYS_ON_TOP` flag. This
|
||||||
* flag. This will bring the window to the front and keep the window above
|
* will bring the window to the front and keep the window above the rest.
|
||||||
* the rest.
|
|
||||||
*
|
*
|
||||||
* \param window The window of which to change the always on top state.
|
* \param window The window of which to change the always on top state
|
||||||
* \param on_top SDL_TRUE to set the window always on top, SDL_FALSE to disable.
|
* \param on_top SDL_TRUE to set the window always on top, SDL_FALSE to
|
||||||
|
* disable
|
||||||
*
|
*
|
||||||
* \sa SDL_SetWindowAlwaysOnTop
|
* \since This function is available since SDL 2.0.16.
|
||||||
|
*
|
||||||
|
* \sa SDL_GetWindowFlags
|
||||||
*/
|
*/
|
||||||
|
|
||||||
extern DECLSPEC void SDLCALL SDL_SetWindowAlwaysOnTop(SDL_Window * window,
|
extern DECLSPEC void SDLCALL SDL_SetWindowAlwaysOnTop(SDL_Window * window,
|
||||||
SDL_bool on_top);
|
SDL_bool on_top);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Show a window.
|
* Show a window.
|
||||||
*
|
*
|
||||||
* \param window the window to show
|
* \param window the window to show
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_HideWindow
|
* \sa SDL_HideWindow
|
||||||
* \sa SDL_RaiseWindow
|
* \sa SDL_RaiseWindow
|
||||||
*/
|
*/
|
||||||
@@ -1060,6 +1140,8 @@ extern DECLSPEC void SDLCALL SDL_ShowWindow(SDL_Window * window);
|
|||||||
*
|
*
|
||||||
* \param window the window to hide
|
* \param window the window to hide
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_ShowWindow
|
* \sa SDL_ShowWindow
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC void SDLCALL SDL_HideWindow(SDL_Window * window);
|
extern DECLSPEC void SDLCALL SDL_HideWindow(SDL_Window * window);
|
||||||
@@ -1068,6 +1150,8 @@ extern DECLSPEC void SDLCALL SDL_HideWindow(SDL_Window * window);
|
|||||||
* Raise a window above other windows and set the input focus.
|
* Raise a window above other windows and set the input focus.
|
||||||
*
|
*
|
||||||
* \param window the window to raise
|
* \param window the window to raise
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC void SDLCALL SDL_RaiseWindow(SDL_Window * window);
|
extern DECLSPEC void SDLCALL SDL_RaiseWindow(SDL_Window * window);
|
||||||
|
|
||||||
@@ -1076,6 +1160,8 @@ extern DECLSPEC void SDLCALL SDL_RaiseWindow(SDL_Window * window);
|
|||||||
*
|
*
|
||||||
* \param window the window to maximize
|
* \param window the window to maximize
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_MinimizeWindow
|
* \sa SDL_MinimizeWindow
|
||||||
* \sa SDL_RestoreWindow
|
* \sa SDL_RestoreWindow
|
||||||
*/
|
*/
|
||||||
@@ -1086,6 +1172,8 @@ extern DECLSPEC void SDLCALL SDL_MaximizeWindow(SDL_Window * window);
|
|||||||
*
|
*
|
||||||
* \param window the window to minimize
|
* \param window the window to minimize
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_MaximizeWindow
|
* \sa SDL_MaximizeWindow
|
||||||
* \sa SDL_RestoreWindow
|
* \sa SDL_RestoreWindow
|
||||||
*/
|
*/
|
||||||
@@ -1096,6 +1184,8 @@ extern DECLSPEC void SDLCALL SDL_MinimizeWindow(SDL_Window * window);
|
|||||||
*
|
*
|
||||||
* \param window the window to restore
|
* \param window the window to restore
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_MaximizeWindow
|
* \sa SDL_MaximizeWindow
|
||||||
* \sa SDL_MinimizeWindow
|
* \sa SDL_MinimizeWindow
|
||||||
*/
|
*/
|
||||||
@@ -1139,6 +1229,8 @@ extern DECLSPEC int SDLCALL SDL_SetWindowFullscreen(SDL_Window * window,
|
|||||||
* \returns the surface associated with the window, or NULL on failure; call
|
* \returns the surface associated with the window, or NULL on failure; call
|
||||||
* SDL_GetError() for more information.
|
* SDL_GetError() for more information.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_UpdateWindowSurface
|
* \sa SDL_UpdateWindowSurface
|
||||||
* \sa SDL_UpdateWindowSurfaceRects
|
* \sa SDL_UpdateWindowSurfaceRects
|
||||||
*/
|
*/
|
||||||
@@ -1156,6 +1248,8 @@ extern DECLSPEC SDL_Surface * SDLCALL SDL_GetWindowSurface(SDL_Window * window);
|
|||||||
* \returns 0 on success or a negative error code on failure; call
|
* \returns 0 on success or a negative error code on failure; call
|
||||||
* SDL_GetError() for more information.
|
* SDL_GetError() for more information.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_GetWindowSurface
|
* \sa SDL_GetWindowSurface
|
||||||
* \sa SDL_UpdateWindowSurfaceRects
|
* \sa SDL_UpdateWindowSurfaceRects
|
||||||
*/
|
*/
|
||||||
@@ -1176,6 +1270,8 @@ extern DECLSPEC int SDLCALL SDL_UpdateWindowSurface(SDL_Window * window);
|
|||||||
* \returns 0 on success or a negative error code on failure; call
|
* \returns 0 on success or a negative error code on failure; call
|
||||||
* SDL_GetError() for more information.
|
* SDL_GetError() for more information.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_GetWindowSurface
|
* \sa SDL_GetWindowSurface
|
||||||
* \sa SDL_UpdateWindowSurface
|
* \sa SDL_UpdateWindowSurface
|
||||||
*/
|
*/
|
||||||
@@ -1186,7 +1282,9 @@ extern DECLSPEC int SDLCALL SDL_UpdateWindowSurfaceRects(SDL_Window * window,
|
|||||||
/**
|
/**
|
||||||
* Set a window's input grab mode.
|
* Set a window's input grab mode.
|
||||||
*
|
*
|
||||||
* When input is grabbed the mouse is confined to the window.
|
* When input is grabbed, the mouse is confined to the window. This function
|
||||||
|
* will also grab the keyboard if `SDL_HINT_GRAB_KEYBOARD` is set. To grab the
|
||||||
|
* keyboard without also grabbing the mouse, use SDL_SetWindowKeyboardGrab().
|
||||||
*
|
*
|
||||||
* If the caller enables a grab while another window is currently grabbed, the
|
* If the caller enables a grab while another window is currently grabbed, the
|
||||||
* other window loses its grab in favor of the caller's window.
|
* other window loses its grab in favor of the caller's window.
|
||||||
@@ -1194,6 +1292,8 @@ extern DECLSPEC int SDLCALL SDL_UpdateWindowSurfaceRects(SDL_Window * window,
|
|||||||
* \param window the window for which the input grab mode should be set
|
* \param window the window for which the input grab mode should be set
|
||||||
* \param grabbed SDL_TRUE to grab input or SDL_FALSE to release input
|
* \param grabbed SDL_TRUE to grab input or SDL_FALSE to release input
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_GetGrabbedWindow
|
* \sa SDL_GetGrabbedWindow
|
||||||
* \sa SDL_GetWindowGrab
|
* \sa SDL_GetWindowGrab
|
||||||
*/
|
*/
|
||||||
@@ -1203,12 +1303,27 @@ extern DECLSPEC void SDLCALL SDL_SetWindowGrab(SDL_Window * window,
|
|||||||
/**
|
/**
|
||||||
* Set a window's keyboard grab mode.
|
* Set a window's keyboard grab mode.
|
||||||
*
|
*
|
||||||
|
* Keyboard grab enables capture of system keyboard shortcuts like Alt+Tab or
|
||||||
|
* the Meta/Super key. Note that not all system keyboard shortcuts can be
|
||||||
|
* captured by applications (one example is Ctrl+Alt+Del on Windows).
|
||||||
|
*
|
||||||
|
* This is primarily intended for specialized applications such as VNC clients
|
||||||
|
* or VM frontends. Normal games should not use keyboard grab.
|
||||||
|
*
|
||||||
|
* When keyboard grab is enabled, SDL will continue to handle Alt+Tab when the
|
||||||
|
* window is full-screen to ensure the user is not trapped in your
|
||||||
|
* application. If you have a custom keyboard shortcut to exit fullscreen
|
||||||
|
* mode, you may suppress this behavior with
|
||||||
|
* `SDL_HINT_ALLOW_ALT_TAB_WHILE_GRABBED`.
|
||||||
|
*
|
||||||
* If the caller enables a grab while another window is currently grabbed, the
|
* If the caller enables a grab while another window is currently grabbed, the
|
||||||
* other window loses its grab in favor of the caller's window.
|
* other window loses its grab in favor of the caller's window.
|
||||||
*
|
*
|
||||||
* \param window The window for which the keyboard grab mode should be set.
|
* \param window The window for which the keyboard grab mode should be set.
|
||||||
* \param grabbed This is SDL_TRUE to grab keyboard, and SDL_FALSE to release.
|
* \param grabbed This is SDL_TRUE to grab keyboard, and SDL_FALSE to release.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.16.
|
||||||
|
*
|
||||||
* \sa SDL_GetWindowKeyboardGrab
|
* \sa SDL_GetWindowKeyboardGrab
|
||||||
* \sa SDL_SetWindowMouseGrab
|
* \sa SDL_SetWindowMouseGrab
|
||||||
* \sa SDL_SetWindowGrab
|
* \sa SDL_SetWindowGrab
|
||||||
@@ -1219,8 +1334,12 @@ extern DECLSPEC void SDLCALL SDL_SetWindowKeyboardGrab(SDL_Window * window,
|
|||||||
/**
|
/**
|
||||||
* Set a window's mouse grab mode.
|
* Set a window's mouse grab mode.
|
||||||
*
|
*
|
||||||
|
* Mouse grab confines the mouse cursor to the window.
|
||||||
|
*
|
||||||
* \param window The window for which the mouse grab mode should be set.
|
* \param window The window for which the mouse grab mode should be set.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.16.
|
||||||
|
*
|
||||||
* \sa SDL_GetWindowMouseGrab
|
* \sa SDL_GetWindowMouseGrab
|
||||||
* \sa SDL_SetWindowKeyboardGrab
|
* \sa SDL_SetWindowKeyboardGrab
|
||||||
* \sa SDL_SetWindowGrab
|
* \sa SDL_SetWindowGrab
|
||||||
@@ -1234,6 +1353,8 @@ extern DECLSPEC void SDLCALL SDL_SetWindowMouseGrab(SDL_Window * window,
|
|||||||
* \param window the window to query
|
* \param window the window to query
|
||||||
* \returns SDL_TRUE if input is grabbed, SDL_FALSE otherwise.
|
* \returns SDL_TRUE if input is grabbed, SDL_FALSE otherwise.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_SetWindowGrab
|
* \sa SDL_SetWindowGrab
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC SDL_bool SDLCALL SDL_GetWindowGrab(SDL_Window * window);
|
extern DECLSPEC SDL_bool SDLCALL SDL_GetWindowGrab(SDL_Window * window);
|
||||||
@@ -1244,6 +1365,8 @@ extern DECLSPEC SDL_bool SDLCALL SDL_GetWindowGrab(SDL_Window * window);
|
|||||||
* \param window the window to query
|
* \param window the window to query
|
||||||
* \returns SDL_TRUE if keyboard is grabbed, and SDL_FALSE otherwise.
|
* \returns SDL_TRUE if keyboard is grabbed, and SDL_FALSE otherwise.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.16.
|
||||||
|
*
|
||||||
* \sa SDL_SetWindowKeyboardGrab
|
* \sa SDL_SetWindowKeyboardGrab
|
||||||
* \sa SDL_GetWindowGrab
|
* \sa SDL_GetWindowGrab
|
||||||
*/
|
*/
|
||||||
@@ -1255,6 +1378,8 @@ extern DECLSPEC SDL_bool SDLCALL SDL_GetWindowKeyboardGrab(SDL_Window * window);
|
|||||||
* \param window the window to query
|
* \param window the window to query
|
||||||
* \returns SDL_TRUE if mouse is grabbed, and SDL_FALSE otherwise.
|
* \returns SDL_TRUE if mouse is grabbed, and SDL_FALSE otherwise.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.16.
|
||||||
|
*
|
||||||
* \sa SDL_SetWindowKeyboardGrab
|
* \sa SDL_SetWindowKeyboardGrab
|
||||||
* \sa SDL_GetWindowGrab
|
* \sa SDL_GetWindowGrab
|
||||||
*/
|
*/
|
||||||
@@ -1272,6 +1397,38 @@ extern DECLSPEC SDL_bool SDLCALL SDL_GetWindowMouseGrab(SDL_Window * window);
|
|||||||
*/
|
*/
|
||||||
extern DECLSPEC SDL_Window * SDLCALL SDL_GetGrabbedWindow(void);
|
extern DECLSPEC SDL_Window * SDLCALL SDL_GetGrabbedWindow(void);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Confines the cursor to the specified area of a window.
|
||||||
|
*
|
||||||
|
* Note that this does NOT grab the cursor, it only defines the area a cursor
|
||||||
|
* is restricted to when the window has mouse focus.
|
||||||
|
*
|
||||||
|
* \param window The window that will be associated with the barrier.
|
||||||
|
* \param rect A rectangle area in window-relative coordinates. If NULL the
|
||||||
|
* barrier for the specified window will be destroyed.
|
||||||
|
* \returns 0 on success or a negative error code on failure; call
|
||||||
|
* SDL_GetError() for more information.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.18.
|
||||||
|
*
|
||||||
|
* \sa SDL_GetWindowMouseRect
|
||||||
|
* \sa SDL_SetWindowMouseGrab
|
||||||
|
*/
|
||||||
|
extern DECLSPEC int SDLCALL SDL_SetWindowMouseRect(SDL_Window * window, const SDL_Rect * rect);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the mouse confinement rectangle of a window.
|
||||||
|
*
|
||||||
|
* \param window The window to query
|
||||||
|
* \returns A pointer to the mouse confinement rectangle of a window, or NULL
|
||||||
|
* if there isn't one.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.18.
|
||||||
|
*
|
||||||
|
* \sa SDL_SetWindowMouseRect
|
||||||
|
*/
|
||||||
|
extern DECLSPEC const SDL_Rect * SDLCALL SDL_GetWindowMouseRect(SDL_Window * window);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the brightness (gamma multiplier) for a given window's display.
|
* Set the brightness (gamma multiplier) for a given window's display.
|
||||||
*
|
*
|
||||||
@@ -1293,6 +1450,8 @@ extern DECLSPEC SDL_Window * SDLCALL SDL_GetGrabbedWindow(void);
|
|||||||
* \returns 0 on success or a negative error code on failure; call
|
* \returns 0 on success or a negative error code on failure; call
|
||||||
* SDL_GetError() for more information.
|
* SDL_GetError() for more information.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_GetWindowBrightness
|
* \sa SDL_GetWindowBrightness
|
||||||
* \sa SDL_SetWindowGammaRamp
|
* \sa SDL_SetWindowGammaRamp
|
||||||
*/
|
*/
|
||||||
@@ -1311,6 +1470,8 @@ extern DECLSPEC int SDLCALL SDL_SetWindowBrightness(SDL_Window * window, float b
|
|||||||
* \returns the brightness for the display where 0.0 is completely dark and
|
* \returns the brightness for the display where 0.0 is completely dark and
|
||||||
* 1.0 is normal brightness.
|
* 1.0 is normal brightness.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_SetWindowBrightness
|
* \sa SDL_SetWindowBrightness
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC float SDLCALL SDL_GetWindowBrightness(SDL_Window * window);
|
extern DECLSPEC float SDLCALL SDL_GetWindowBrightness(SDL_Window * window);
|
||||||
@@ -1410,6 +1571,8 @@ extern DECLSPEC int SDLCALL SDL_SetWindowInputFocus(SDL_Window * window);
|
|||||||
* \returns 0 on success or a negative error code on failure; call
|
* \returns 0 on success or a negative error code on failure; call
|
||||||
* SDL_GetError() for more information.
|
* SDL_GetError() for more information.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_GetWindowGammaRamp
|
* \sa SDL_GetWindowGammaRamp
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC int SDLCALL SDL_SetWindowGammaRamp(SDL_Window * window,
|
extern DECLSPEC int SDLCALL SDL_SetWindowGammaRamp(SDL_Window * window,
|
||||||
@@ -1436,6 +1599,8 @@ extern DECLSPEC int SDLCALL SDL_SetWindowGammaRamp(SDL_Window * window,
|
|||||||
* \returns 0 on success or a negative error code on failure; call
|
* \returns 0 on success or a negative error code on failure; call
|
||||||
* SDL_GetError() for more information.
|
* SDL_GetError() for more information.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_SetWindowGammaRamp
|
* \sa SDL_SetWindowGammaRamp
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC int SDLCALL SDL_GetWindowGammaRamp(SDL_Window * window,
|
extern DECLSPEC int SDLCALL SDL_GetWindowGammaRamp(SDL_Window * window,
|
||||||
@@ -1527,6 +1692,8 @@ extern DECLSPEC int SDLCALL SDL_SetWindowHitTest(SDL_Window * window,
|
|||||||
* \param operation the flash operation
|
* \param operation the flash operation
|
||||||
* \returns 0 on success or a negative error code on failure; call
|
* \returns 0 on success or a negative error code on failure; call
|
||||||
* SDL_GetError() for more information.
|
* SDL_GetError() for more information.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.16.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC int SDLCALL SDL_FlashWindow(SDL_Window * window, SDL_FlashOperation operation);
|
extern DECLSPEC int SDLCALL SDL_FlashWindow(SDL_Window * window, SDL_FlashOperation operation);
|
||||||
|
|
||||||
@@ -1538,6 +1705,8 @@ extern DECLSPEC int SDLCALL SDL_FlashWindow(SDL_Window * window, SDL_FlashOperat
|
|||||||
*
|
*
|
||||||
* \param window the window to destroy
|
* \param window the window to destroy
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_CreateWindow
|
* \sa SDL_CreateWindow
|
||||||
* \sa SDL_CreateWindowFrom
|
* \sa SDL_CreateWindowFrom
|
||||||
*/
|
*/
|
||||||
@@ -1606,6 +1775,8 @@ extern DECLSPEC void SDLCALL SDL_DisableScreenSaver(void);
|
|||||||
* \returns 0 on success or a negative error code on failure; call
|
* \returns 0 on success or a negative error code on failure; call
|
||||||
* SDL_GetError() for more information.
|
* SDL_GetError() for more information.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_GL_GetProcAddress
|
* \sa SDL_GL_GetProcAddress
|
||||||
* \sa SDL_GL_UnloadLibrary
|
* \sa SDL_GL_UnloadLibrary
|
||||||
*/
|
*/
|
||||||
@@ -1656,6 +1827,8 @@ extern DECLSPEC int SDLCALL SDL_GL_LoadLibrary(const char *path);
|
|||||||
* \returns a pointer to the named OpenGL function. The returned pointer
|
* \returns a pointer to the named OpenGL function. The returned pointer
|
||||||
* should be cast to the appropriate function signature.
|
* should be cast to the appropriate function signature.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_GL_ExtensionSupported
|
* \sa SDL_GL_ExtensionSupported
|
||||||
* \sa SDL_GL_LoadLibrary
|
* \sa SDL_GL_LoadLibrary
|
||||||
* \sa SDL_GL_UnloadLibrary
|
* \sa SDL_GL_UnloadLibrary
|
||||||
@@ -1665,6 +1838,8 @@ extern DECLSPEC void *SDLCALL SDL_GL_GetProcAddress(const char *proc);
|
|||||||
/**
|
/**
|
||||||
* Unload the OpenGL library previously loaded by SDL_GL_LoadLibrary().
|
* Unload the OpenGL library previously loaded by SDL_GL_LoadLibrary().
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_GL_LoadLibrary
|
* \sa SDL_GL_LoadLibrary
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC void SDLCALL SDL_GL_UnloadLibrary(void);
|
extern DECLSPEC void SDLCALL SDL_GL_UnloadLibrary(void);
|
||||||
@@ -1714,6 +1889,8 @@ extern DECLSPEC void SDLCALL SDL_GL_ResetAttributes(void);
|
|||||||
* \returns 0 on success or a negative error code on failure; call
|
* \returns 0 on success or a negative error code on failure; call
|
||||||
* SDL_GetError() for more information.
|
* SDL_GetError() for more information.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_GL_GetAttribute
|
* \sa SDL_GL_GetAttribute
|
||||||
* \sa SDL_GL_ResetAttributes
|
* \sa SDL_GL_ResetAttributes
|
||||||
*/
|
*/
|
||||||
@@ -1727,6 +1904,8 @@ extern DECLSPEC int SDLCALL SDL_GL_SetAttribute(SDL_GLattr attr, int value);
|
|||||||
* \returns 0 on success or a negative error code on failure; call
|
* \returns 0 on success or a negative error code on failure; call
|
||||||
* SDL_GetError() for more information.
|
* SDL_GetError() for more information.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_GL_ResetAttributes
|
* \sa SDL_GL_ResetAttributes
|
||||||
* \sa SDL_GL_SetAttribute
|
* \sa SDL_GL_SetAttribute
|
||||||
*/
|
*/
|
||||||
@@ -1747,6 +1926,8 @@ extern DECLSPEC int SDLCALL SDL_GL_GetAttribute(SDL_GLattr attr, int *value);
|
|||||||
* \returns the OpenGL context associated with `window` or NULL on error; call
|
* \returns the OpenGL context associated with `window` or NULL on error; call
|
||||||
* SDL_GetError() for more details.
|
* SDL_GetError() for more details.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_GL_DeleteContext
|
* \sa SDL_GL_DeleteContext
|
||||||
* \sa SDL_GL_MakeCurrent
|
* \sa SDL_GL_MakeCurrent
|
||||||
*/
|
*/
|
||||||
@@ -1763,6 +1944,8 @@ extern DECLSPEC SDL_GLContext SDLCALL SDL_GL_CreateContext(SDL_Window *
|
|||||||
* \returns 0 on success or a negative error code on failure; call
|
* \returns 0 on success or a negative error code on failure; call
|
||||||
* SDL_GetError() for more information.
|
* SDL_GetError() for more information.
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_GL_CreateContext
|
* \sa SDL_GL_CreateContext
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC int SDLCALL SDL_GL_MakeCurrent(SDL_Window * window,
|
extern DECLSPEC int SDLCALL SDL_GL_MakeCurrent(SDL_Window * window,
|
||||||
@@ -1875,6 +2058,8 @@ extern DECLSPEC int SDLCALL SDL_GL_GetSwapInterval(void);
|
|||||||
* extra.
|
* extra.
|
||||||
*
|
*
|
||||||
* \param window the window to change
|
* \param window the window to change
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC void SDLCALL SDL_GL_SwapWindow(SDL_Window * window);
|
extern DECLSPEC void SDLCALL SDL_GL_SwapWindow(SDL_Window * window);
|
||||||
|
|
||||||
@@ -1883,6 +2068,8 @@ extern DECLSPEC void SDLCALL SDL_GL_SwapWindow(SDL_Window * window);
|
|||||||
*
|
*
|
||||||
* \param context the OpenGL context to be deleted
|
* \param context the OpenGL context to be deleted
|
||||||
*
|
*
|
||||||
|
* \since This function is available since SDL 2.0.0.
|
||||||
|
*
|
||||||
* \sa SDL_GL_CreateContext
|
* \sa SDL_GL_CreateContext
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC void SDLCALL SDL_GL_DeleteContext(SDL_GLContext context);
|
extern DECLSPEC void SDLCALL SDL_GL_DeleteContext(SDL_GLContext context);
|
||||||
|
|||||||
+7
-5
@@ -101,7 +101,7 @@ typedef VkSurfaceKHR SDL_vulkanSurface; /* for compatibility with Tizen */
|
|||||||
* \returns 0 on success or -1 if the library couldn't be loaded; call
|
* \returns 0 on success or -1 if the library couldn't be loaded; call
|
||||||
* SDL_GetError() for more information.
|
* SDL_GetError() for more information.
|
||||||
*
|
*
|
||||||
* \since This function is available in SDL 2.0.8
|
* \since This function is available since SDL 2.0.6.
|
||||||
*
|
*
|
||||||
* \sa SDL_Vulkan_GetVkInstanceProcAddr
|
* \sa SDL_Vulkan_GetVkInstanceProcAddr
|
||||||
* \sa SDL_Vulkan_UnloadLibrary
|
* \sa SDL_Vulkan_UnloadLibrary
|
||||||
@@ -115,13 +115,15 @@ extern DECLSPEC int SDLCALL SDL_Vulkan_LoadLibrary(const char *path);
|
|||||||
* creating an SDL_Window with the `SDL_WINDOW_VULKAN` flag.
|
* creating an SDL_Window with the `SDL_WINDOW_VULKAN` flag.
|
||||||
*
|
*
|
||||||
* \returns the function pointer for `vkGetInstanceProcAddr` or NULL on error.
|
* \returns the function pointer for `vkGetInstanceProcAddr` or NULL on error.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.0.6.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC void *SDLCALL SDL_Vulkan_GetVkGetInstanceProcAddr(void);
|
extern DECLSPEC void *SDLCALL SDL_Vulkan_GetVkGetInstanceProcAddr(void);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unload the Vulkan library previously loaded by SDL_Vulkan_LoadLibrary()
|
* Unload the Vulkan library previously loaded by SDL_Vulkan_LoadLibrary()
|
||||||
*
|
*
|
||||||
* \since This function is available in SDL 2.0.8
|
* \since This function is available since SDL 2.0.6.
|
||||||
*
|
*
|
||||||
* \sa SDL_Vulkan_LoadLibrary
|
* \sa SDL_Vulkan_LoadLibrary
|
||||||
*/
|
*/
|
||||||
@@ -151,7 +153,7 @@ extern DECLSPEC void SDLCALL SDL_Vulkan_UnloadLibrary(void);
|
|||||||
* Vulkan instance extensions
|
* Vulkan instance extensions
|
||||||
* \returns SDL_TRUE on success, SDL_FALSE on error.
|
* \returns SDL_TRUE on success, SDL_FALSE on error.
|
||||||
*
|
*
|
||||||
* \since This function is available in SDL 2.0.8
|
* \since This function is available since SDL 2.0.6.
|
||||||
*
|
*
|
||||||
* \sa SDL_Vulkan_CreateSurface
|
* \sa SDL_Vulkan_CreateSurface
|
||||||
*/
|
*/
|
||||||
@@ -172,7 +174,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_Vulkan_GetInstanceExtensions(SDL_Window *wi
|
|||||||
* created surface
|
* created surface
|
||||||
* \returns SDL_TRUE on success, SDL_FALSE on error.
|
* \returns SDL_TRUE on success, SDL_FALSE on error.
|
||||||
*
|
*
|
||||||
* \since This function is available in SDL 2.0.8
|
* \since This function is available since SDL 2.0.6.
|
||||||
*
|
*
|
||||||
* \sa SDL_Vulkan_GetInstanceExtensions
|
* \sa SDL_Vulkan_GetInstanceExtensions
|
||||||
* \sa SDL_Vulkan_GetDrawableSize
|
* \sa SDL_Vulkan_GetDrawableSize
|
||||||
@@ -193,7 +195,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_Vulkan_CreateSurface(SDL_Window *window,
|
|||||||
* \param w Pointer to the variable to write the width to or NULL
|
* \param w Pointer to the variable to write the width to or NULL
|
||||||
* \param h Pointer to the variable to write the height to or NULL
|
* \param h Pointer to the variable to write the height to or NULL
|
||||||
*
|
*
|
||||||
* \since This function is available in SDL 2.0.8
|
* \since This function is available since SDL 2.0.6.
|
||||||
*
|
*
|
||||||
* \sa SDL_GetWindowSize
|
* \sa SDL_GetWindowSize
|
||||||
* \sa SDL_CreateWindow
|
* \sa SDL_CreateWindow
|
||||||
|
|||||||
+22
-1
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
Simple DirectMedia Layer
|
Simple DirectMedia Layer
|
||||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
||||||
|
|
||||||
This software is provided 'as-is', without any express or implied
|
This software is provided 'as-is', without any express or implied
|
||||||
warranty. In no event will the authors be held liable for any damages
|
warranty. In no event will the authors be held liable for any damages
|
||||||
@@ -164,3 +164,24 @@
|
|||||||
#endif
|
#endif
|
||||||
#endif /* NULL */
|
#endif /* NULL */
|
||||||
#endif /* ! Mac OS X - breaks precompiled headers */
|
#endif /* ! Mac OS X - breaks precompiled headers */
|
||||||
|
|
||||||
|
#ifndef SDL_FALLTHROUGH
|
||||||
|
#if (defined(__cplusplus) && __cplusplus >= 201703L) || \
|
||||||
|
(defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202000L)
|
||||||
|
#define SDL_FALLTHROUGH [[fallthrough]]
|
||||||
|
#else
|
||||||
|
#if defined(__has_attribute)
|
||||||
|
#define _HAS_FALLTHROUGH __has_attribute(__fallthrough__)
|
||||||
|
#else
|
||||||
|
#define _HAS_FALLTHROUGH 0
|
||||||
|
#endif /* __has_attribute */
|
||||||
|
#if _HAS_FALLTHROUGH && \
|
||||||
|
((defined(__GNUC__) && __GNUC__ >= 7) || \
|
||||||
|
(defined(__clang_major__) && __clang_major__ >= 10))
|
||||||
|
#define SDL_FALLTHROUGH __attribute__((__fallthrough__))
|
||||||
|
#else
|
||||||
|
#define SDL_FALLTHROUGH do {} while (0) /* fallthrough */
|
||||||
|
#endif /* _HAS_FALLTHROUGH */
|
||||||
|
#undef _HAS_FALLTHROUGH
|
||||||
|
#endif /* C++17 or C2x */
|
||||||
|
#endif /* SDL_FALLTHROUGH not defined */
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
Simple DirectMedia Layer
|
Simple DirectMedia Layer
|
||||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
||||||
|
|
||||||
This software is provided 'as-is', without any express or implied
|
This software is provided 'as-is', without any express or implied
|
||||||
warranty. In no event will the authors be held liable for any damages
|
warranty. In no event will the authors be held liable for any damages
|
||||||
|
|||||||
BIN
Binary file not shown.
BIN
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user