История изменений
Исправление fsb4000, (текущая версия) :
Не думаю, что под Windows используется DirectX
100% по-умолчанию авторы SDL используют DirectX под Windows.
#include <stdio.h>
#include <stdlib.h>
#include <SDL2/SDL.h>
int main(void)
{
if (SDL_Init(SDL_INIT_VIDEO) != 0)
{
fprintf(stderr, "Failed to initialize SDL (%s)\n", SDL_GetError());
return -1;
}
SDL_Window* window = SDL_CreateWindow("test SDL2", SDL_WINDOWPOS_UNDEFINED,
SDL_WINDOWPOS_UNDEFINED,
800,
600,
SDL_WINDOW_SHOWN);
if (window)
{
// -1 это у них типа renderer по-умолчанию.
SDL_Renderer* renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED);
if (renderer)
{
SDL_RendererInfo info;
SDL_GetRendererInfo(renderer, &info);
printf("%s", info.name);
SDL_DestroyRenderer(renderer);
}
SDL_DestroyWindow(window);
}
SDL_Quit();
}
// документация
/**
* \brief Create a 2D rendering context for a window.
*
* \param window The window where rendering is displayed.
* \param index The index of the rendering driver to initialize, or -1 to
* initialize the first one supporting the requested flags.
* \param flags ::SDL_RendererFlags.
*
* \return A valid rendering context or NULL if there was an error.
*
* \sa SDL_CreateSoftwareRenderer()
* \sa SDL_GetRendererInfo()
* \sa SDL_DestroyRenderer()
*/
extern DECLSPEC SDL_Renderer * SDLCALL SDL_CreateRenderer(SDL_Window * window,
int index, Uint32 flags);
Исправление fsb4000, :
Не думаю, что под Windows используется DirectX
100% по-умолчанию авторы SDL используют DirectX под Windows.
#include <stdio.h>
#include <stdlib.h>
#include <SDL2/SDL.h>
int main(void)
{
if (SDL_Init(SDL_INIT_VIDEO) != 0)
{
fprintf(stderr, "Failed to initialize SDL (%s)\n", SDL_GetError());
return -1;
}
SDL_Window* window = SDL_CreateWindow("test SDL2", SDL_WINDOWPOS_UNDEFINED,
SDL_WINDOWPOS_UNDEFINED,
800,
600,
SDL_WINDOW_SHOWN);
if (window)
{
// -1 это у них типа renderer по умолчанию.
SDL_Renderer* renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED);
if (renderer)
{
SDL_RendererInfo info;
SDL_GetRendererInfo(renderer, &info);
printf("%s", info.name);
SDL_DestroyRenderer(renderer);
}
SDL_DestroyWindow(window);
}
SDL_Quit();
}
// документация
/**
* \brief Create a 2D rendering context for a window.
*
* \param window The window where rendering is displayed.
* \param index The index of the rendering driver to initialize, or -1 to
* initialize the first one supporting the requested flags.
* \param flags ::SDL_RendererFlags.
*
* \return A valid rendering context or NULL if there was an error.
*
* \sa SDL_CreateSoftwareRenderer()
* \sa SDL_GetRendererInfo()
* \sa SDL_DestroyRenderer()
*/
extern DECLSPEC SDL_Renderer * SDLCALL SDL_CreateRenderer(SDL_Window * window,
int index, Uint32 flags);
Исходная версия fsb4000, :
Не думаю, что под Windows используется DirectX
100% по-умолчанию авторы SDL используют DirectX под Windows.
#include <stdio.h>
#include <stdlib.h>
#include <SDL2/SDL.h>
int main(void)
{
if (SDL_Init(SDL_INIT_VIDEO) != 0)
{
fprintf(stderr, "Failed to initialize SDL (%s)\n", SDL_GetError());
return -1;
}
SDL_Window* window = SDL_CreateWindow("test SDL2", SDL_WINDOWPOS_UNDEFINED,
SDL_WINDOWPOS_UNDEFINED,
800,
600,
SDL_WINDOW_SHOWN);
if (window)
{
SDL_Renderer* renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED); // -1 это у них типа renderer по умолчанию.
if (renderer)
{
SDL_RendererInfo info;
SDL_GetRendererInfo(renderer, &info);
printf("%s", info.name);
SDL_DestroyRenderer(renderer);
}
SDL_DestroyWindow(window);
}
SDL_Quit();
}
// документация
/**
* \brief Create a 2D rendering context for a window.
*
* \param window The window where rendering is displayed.
* \param index The index of the rendering driver to initialize, or -1 to
* initialize the first one supporting the requested flags.
* \param flags ::SDL_RendererFlags.
*
* \return A valid rendering context or NULL if there was an error.
*
* \sa SDL_CreateSoftwareRenderer()
* \sa SDL_GetRendererInfo()
* \sa SDL_DestroyRenderer()
*/
extern DECLSPEC SDL_Renderer * SDLCALL SDL_CreateRenderer(SDL_Window * window,
int index, Uint32 flags);