c++ sdl window freeze and issues with sdl
SDL just pisses me off, please help.
I'm trying just to show a window, this is the code :
#include <iostream>
#define SDL_MAIN_HANDLED
#include "SDL.h"
int main()
{
if (SDL_Init(SDL_INIT_VIDEO) != 0) {
std::cout << "SDL_Init Error: " << SDL_GetError() << std::endl;
return 1;
}
SDL_Window *window = SDL_CreateWindow("Game", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 600, 480, SDL_WINDOW_SHOWN);
if (window == NULL)
return 1;
SDL_Event event;
bool running = true;
while (running) {
while (SDL_PollEvent(&event)) {
switch (event.type) {
case SDL_QUIT:
running = false;
break;
}
}
}
SDL_Quit();
std::cout << "Hello :)" << std::endl;
return 0;
}
Now, the issue is that it says that the program now responding and I have a "loading" icon for the mouse. Second issue is that I cannot use SDL_INIT_EVERYTHING for some reason, it just gets stuck and nothing outputs when I try to output after init.
I tried multiple sdl files x86 , x64.
I have windows 10 64bit OS.
I really start to lose my sanity here , please help.
EDIT :
the window works perfectly fine with SDL_INIT_EVERYTHING but it takes the computer to load everything for 1 minute and 50 seconds. which is a lot of time.
But when I only init SDL_INIT_VIDEO , it's not responding.
Any solution ?
c++ sdl
add a comment |
SDL just pisses me off, please help.
I'm trying just to show a window, this is the code :
#include <iostream>
#define SDL_MAIN_HANDLED
#include "SDL.h"
int main()
{
if (SDL_Init(SDL_INIT_VIDEO) != 0) {
std::cout << "SDL_Init Error: " << SDL_GetError() << std::endl;
return 1;
}
SDL_Window *window = SDL_CreateWindow("Game", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 600, 480, SDL_WINDOW_SHOWN);
if (window == NULL)
return 1;
SDL_Event event;
bool running = true;
while (running) {
while (SDL_PollEvent(&event)) {
switch (event.type) {
case SDL_QUIT:
running = false;
break;
}
}
}
SDL_Quit();
std::cout << "Hello :)" << std::endl;
return 0;
}
Now, the issue is that it says that the program now responding and I have a "loading" icon for the mouse. Second issue is that I cannot use SDL_INIT_EVERYTHING for some reason, it just gets stuck and nothing outputs when I try to output after init.
I tried multiple sdl files x86 , x64.
I have windows 10 64bit OS.
I really start to lose my sanity here , please help.
EDIT :
the window works perfectly fine with SDL_INIT_EVERYTHING but it takes the computer to load everything for 1 minute and 50 seconds. which is a lot of time.
But when I only init SDL_INIT_VIDEO , it's not responding.
Any solution ?
c++ sdl
In the first case: can you click the x button to close the window?
– ubadub
Nov 17 '18 at 17:46
@ubadub when I use SDL_INIT_VIDEO not I cannot. When I use SDL_INIT_EVERYTHING I can but it takes 2 minutes to load the screen and show it up.
– Daniel Nagornov
Nov 17 '18 at 17:57
anyone ? please help :(
– Daniel Nagornov
Nov 17 '18 at 19:16
Why are you definingSDL_MAIN_HANDLED
? It doesn't look like you even know what it's used for. You might just want to follow a tutorial or something, because you are missing an important thing that pretty much every program does: delay. In any case, this is hardly the fault of the library.
– Nelfeal
Nov 18 '18 at 7:06
add a comment |
SDL just pisses me off, please help.
I'm trying just to show a window, this is the code :
#include <iostream>
#define SDL_MAIN_HANDLED
#include "SDL.h"
int main()
{
if (SDL_Init(SDL_INIT_VIDEO) != 0) {
std::cout << "SDL_Init Error: " << SDL_GetError() << std::endl;
return 1;
}
SDL_Window *window = SDL_CreateWindow("Game", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 600, 480, SDL_WINDOW_SHOWN);
if (window == NULL)
return 1;
SDL_Event event;
bool running = true;
while (running) {
while (SDL_PollEvent(&event)) {
switch (event.type) {
case SDL_QUIT:
running = false;
break;
}
}
}
SDL_Quit();
std::cout << "Hello :)" << std::endl;
return 0;
}
Now, the issue is that it says that the program now responding and I have a "loading" icon for the mouse. Second issue is that I cannot use SDL_INIT_EVERYTHING for some reason, it just gets stuck and nothing outputs when I try to output after init.
I tried multiple sdl files x86 , x64.
I have windows 10 64bit OS.
I really start to lose my sanity here , please help.
EDIT :
the window works perfectly fine with SDL_INIT_EVERYTHING but it takes the computer to load everything for 1 minute and 50 seconds. which is a lot of time.
But when I only init SDL_INIT_VIDEO , it's not responding.
Any solution ?
c++ sdl
SDL just pisses me off, please help.
I'm trying just to show a window, this is the code :
#include <iostream>
#define SDL_MAIN_HANDLED
#include "SDL.h"
int main()
{
if (SDL_Init(SDL_INIT_VIDEO) != 0) {
std::cout << "SDL_Init Error: " << SDL_GetError() << std::endl;
return 1;
}
SDL_Window *window = SDL_CreateWindow("Game", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 600, 480, SDL_WINDOW_SHOWN);
if (window == NULL)
return 1;
SDL_Event event;
bool running = true;
while (running) {
while (SDL_PollEvent(&event)) {
switch (event.type) {
case SDL_QUIT:
running = false;
break;
}
}
}
SDL_Quit();
std::cout << "Hello :)" << std::endl;
return 0;
}
Now, the issue is that it says that the program now responding and I have a "loading" icon for the mouse. Second issue is that I cannot use SDL_INIT_EVERYTHING for some reason, it just gets stuck and nothing outputs when I try to output after init.
I tried multiple sdl files x86 , x64.
I have windows 10 64bit OS.
I really start to lose my sanity here , please help.
EDIT :
the window works perfectly fine with SDL_INIT_EVERYTHING but it takes the computer to load everything for 1 minute and 50 seconds. which is a lot of time.
But when I only init SDL_INIT_VIDEO , it's not responding.
Any solution ?
c++ sdl
c++ sdl
edited Nov 17 '18 at 17:27
Daniel Nagornov
asked Nov 17 '18 at 17:19
Daniel NagornovDaniel Nagornov
366
366
In the first case: can you click the x button to close the window?
– ubadub
Nov 17 '18 at 17:46
@ubadub when I use SDL_INIT_VIDEO not I cannot. When I use SDL_INIT_EVERYTHING I can but it takes 2 minutes to load the screen and show it up.
– Daniel Nagornov
Nov 17 '18 at 17:57
anyone ? please help :(
– Daniel Nagornov
Nov 17 '18 at 19:16
Why are you definingSDL_MAIN_HANDLED
? It doesn't look like you even know what it's used for. You might just want to follow a tutorial or something, because you are missing an important thing that pretty much every program does: delay. In any case, this is hardly the fault of the library.
– Nelfeal
Nov 18 '18 at 7:06
add a comment |
In the first case: can you click the x button to close the window?
– ubadub
Nov 17 '18 at 17:46
@ubadub when I use SDL_INIT_VIDEO not I cannot. When I use SDL_INIT_EVERYTHING I can but it takes 2 minutes to load the screen and show it up.
– Daniel Nagornov
Nov 17 '18 at 17:57
anyone ? please help :(
– Daniel Nagornov
Nov 17 '18 at 19:16
Why are you definingSDL_MAIN_HANDLED
? It doesn't look like you even know what it's used for. You might just want to follow a tutorial or something, because you are missing an important thing that pretty much every program does: delay. In any case, this is hardly the fault of the library.
– Nelfeal
Nov 18 '18 at 7:06
In the first case: can you click the x button to close the window?
– ubadub
Nov 17 '18 at 17:46
In the first case: can you click the x button to close the window?
– ubadub
Nov 17 '18 at 17:46
@ubadub when I use SDL_INIT_VIDEO not I cannot. When I use SDL_INIT_EVERYTHING I can but it takes 2 minutes to load the screen and show it up.
– Daniel Nagornov
Nov 17 '18 at 17:57
@ubadub when I use SDL_INIT_VIDEO not I cannot. When I use SDL_INIT_EVERYTHING I can but it takes 2 minutes to load the screen and show it up.
– Daniel Nagornov
Nov 17 '18 at 17:57
anyone ? please help :(
– Daniel Nagornov
Nov 17 '18 at 19:16
anyone ? please help :(
– Daniel Nagornov
Nov 17 '18 at 19:16
Why are you defining
SDL_MAIN_HANDLED
? It doesn't look like you even know what it's used for. You might just want to follow a tutorial or something, because you are missing an important thing that pretty much every program does: delay. In any case, this is hardly the fault of the library.– Nelfeal
Nov 18 '18 at 7:06
Why are you defining
SDL_MAIN_HANDLED
? It doesn't look like you even know what it's used for. You might just want to follow a tutorial or something, because you are missing an important thing that pretty much every program does: delay. In any case, this is hardly the fault of the library.– Nelfeal
Nov 18 '18 at 7:06
add a comment |
1 Answer
1
active
oldest
votes
Okay, so I have downloaded an older version 2.0.5 instead of the new "stable" version and seems like it works. I guess the new version just have bugs that needs to be fixed.
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53353636%2fc-sdl-window-freeze-and-issues-with-sdl%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Okay, so I have downloaded an older version 2.0.5 instead of the new "stable" version and seems like it works. I guess the new version just have bugs that needs to be fixed.
add a comment |
Okay, so I have downloaded an older version 2.0.5 instead of the new "stable" version and seems like it works. I guess the new version just have bugs that needs to be fixed.
add a comment |
Okay, so I have downloaded an older version 2.0.5 instead of the new "stable" version and seems like it works. I guess the new version just have bugs that needs to be fixed.
Okay, so I have downloaded an older version 2.0.5 instead of the new "stable" version and seems like it works. I guess the new version just have bugs that needs to be fixed.
answered Nov 17 '18 at 19:44
Daniel NagornovDaniel Nagornov
366
366
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53353636%2fc-sdl-window-freeze-and-issues-with-sdl%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
In the first case: can you click the x button to close the window?
– ubadub
Nov 17 '18 at 17:46
@ubadub when I use SDL_INIT_VIDEO not I cannot. When I use SDL_INIT_EVERYTHING I can but it takes 2 minutes to load the screen and show it up.
– Daniel Nagornov
Nov 17 '18 at 17:57
anyone ? please help :(
– Daniel Nagornov
Nov 17 '18 at 19:16
Why are you defining
SDL_MAIN_HANDLED
? It doesn't look like you even know what it's used for. You might just want to follow a tutorial or something, because you are missing an important thing that pretty much every program does: delay. In any case, this is hardly the fault of the library.– Nelfeal
Nov 18 '18 at 7:06