SDL_CreateWindow() has been simplified and no longer takes a window position.

This commit is contained in:
Sam Lantinga
2023-03-05 14:44:38 -08:00
parent 7905254087
commit 698dbd8464
51 changed files with 106 additions and 326 deletions

View File

@@ -1,12 +1,12 @@
#define SDL_MAIN_HANDLED
#include <SDL3/SDL.h>
#include <SDL3/SDL_main.h>
#include <stdio.h>
int main(int argc, char *argv[]) {
int main(int argc, char *argv[])
{
SDL_SetMainReady();
if (SDL_Init(0) < 0) {
fprintf(stderr, "Could not initialize SDL: %s\n", SDL_GetError());
SDL_Log("Could not initialize SDL: %s\n", SDL_GetError());
return 1;
}
SDL_Delay(100);

View File

@@ -1,22 +1,17 @@
#include <SDL3/SDL.h>
#include <SDL3/SDL_main.h>
#include <stdio.h>
int main(int argc, char *argv[]) {
int main(int argc, char *argv[])
{
SDL_Window *window = NULL;
SDL_Surface *screenSurface = NULL;
if (SDL_Init(SDL_INIT_VIDEO) < 0) {
fprintf(stderr, "Could not initialize SDL: %s\n", SDL_GetError());
SDL_Log("Could not initialize SDL: %s\n", SDL_GetError());
return 1;
}
window = SDL_CreateWindow(
"Hello SDL",
SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED,
640, 480,
0
);
window = SDL_CreateWindow("Hello SDL", 640, 480, 0);
if (window == NULL) {
fprintf(stderr, "could not create window: %s\n", SDL_GetError());
SDL_Log("could not create window: %s\n", SDL_GetError());
return 1;
}
screenSurface = SDL_GetWindowSurface(window);

View File

@@ -1,7 +1,6 @@
#include <SDL3/SDL.h>
#define SDL_MAIN_HANDLED /* don't drag in header-only SDL_main implementation */
#include <SDL3/SDL_main.h>
#include <stdio.h>
#include EXPORT_HEADER
@@ -19,7 +18,7 @@ int MYLIBRARY_EXPORT mylibrary_work(void);
int mylibrary_init(void) {
SDL_SetMainReady();
if (SDL_Init(0) < 0) {
fprintf(stderr, "Could not initialize SDL: %s\n", SDL_GetError());
SDL_Log("Could not initialize SDL: %s\n", SDL_GetError());
return 1;
}
return 0;