sdl

No appropriate default constructor available for std::unique_ptr

我与影子孤独终老i 提交于 2019-12-10 11:29:45
问题 This is a continuation of my previous post. Since it has already been closed I decided to make a new post. I removed half of the code to make it more readable. Some of the posts I read: Smart pointers with SDL Is it possible to use SDL2 with smart pointers? Couple of questions about SDL_Window and unique_ptr class cGraphics { public: // Creator functions std::unique_ptr<SDL_Window, decltype(&SDL_DestroyWindow)> Create_Window(int xWin, int yWin); // ctor & dtor cGraphics() : m_Window(nullptr,

How to compile SDL program and run it without DLL

一世执手 提交于 2019-12-10 10:54:24
问题 is it possible to compile SDL library program into exec and run it without having "sdl.dll"? for example let say i wrote sdl program and it works and everything but the thing is to run the program on windows, i need to have "sdl.dll" within the same folder or system folder. is it possible to compile it so that i can just take the exec with me without needing to have "sdl.dll" along with it? i am using visual studio 2010 express. 回答1: Typically the procedure for this kind of stuff is: Download

SDL: Fullscreen translucent background

核能气质少年 提交于 2019-12-10 10:41:13
问题 I'm trying to write a program that has a translucent background covering the whole screen. After some research it appeared that SDL would be the way to go. I've written the code to create a full screen window with a background whose alpha is equal to 100 (out of 255), but for some reason it just draws the solid colour. What have I done wrong? // Initialise SDL if (SDL_Init(SDL_INIT_EVERYTHING) != 0) { this->throwSDLError("SDL_Init Error"); } // Create the window and renderer if (SDL

Trying to use pkg-config but it not being a registered command

ぐ巨炮叔叔 提交于 2019-12-10 10:15:44
问题 Ok so I've got my whole Go development environment up under Windows 8, also with MinGW. I'm using the LiteIde . C:/Go/bin/go.exe build [C:/Users/Alyx/Go/Hi] pkg-config --cflags sdl exec: "pkg-config": executable file not found in %PATH% Error: process exited with code 2. But then I get an error for "pkg-config" which at first I didn't have installed. (I'm trying to compile the SDL binding with a test that lists the fullscreen modes) Then I got it all set up in the C:\MinGW\Bin folder (pkg

Why does my unique_ptr think is has a null function pointer deleter? [duplicate]

好久不见. 提交于 2019-12-10 04:22:58
问题 This question already has answers here : Cannot move std::unique_ptr with NULL deleter to std::shared_ptr? (2 answers) Closed 6 months ago . I'm trying to learn SDL using C++. I've created a window.h header and a window.cpp source file for storing a Window class. In window.h it looks something like this: Class Window { public: Window(); . . . private: std::unique_ptr<SDL_Window, void (*)(SDL_Window*)> window; std::unique_ptr<SDL_Renderer, void (*)(SDL_Renderer*)> renderer; . . . } with some

OpenGL Textures form SDLSurface goes too dark

此生再无相见时 提交于 2019-12-10 03:49:10
问题 I've quite the same problem than this OpenGl goes too dark but the answer doesn't work for me. I'm trying to display a image thanks to a surface converted to a texture and the result is too damn dark: Original: after openGL On the left is the original, on the right the OpenGl img. Here's my code: void TexturedRect::draw(int scroll){ glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glBindTexture(GL_TEXTURE_2D, _texture); glEnable(GL_TEXTURE_2D); glBegin(GL_QUADS); //Begining the cube's drawing

What specifically causes EPrivilege to be raised?

人走茶凉 提交于 2019-12-10 01:45:33
问题 I'm getting a bug report that some functionality in some music-playing code in an external DLL (SDL_Mixer, in case it helps) that my program uses is raising EPrivilege. The DLL is written in C, so I can't get useful stack trace information out of it with MadExcept, and the problem is not reproducible on my end. And just to make things worse, I don't even know what EPrivilege is . I've never seen it come up in my own code, there's very little information about it available online, and what

SDL 2.0 retina mac

主宰稳场 提交于 2019-12-09 15:42:12
问题 I have been playing around with SDL 2.0 but after searching I haven't found anything online about how to support retina macs. When creating a window using the following code. gWindow = SDL_CreateWindow("SDL Tutorial", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 500, 500, SDL_WINDOW_SHOWN); It creates a window that has an actual size of 1000 * 1000. This isn't really an issue because it's how apps are supposed to work using a hidpi screen. However, when loading images I can't seem to

SDL_BlitScaled doesn't work

微笑、不失礼 提交于 2019-12-09 08:22:26
here is my c++ code: #include <SDL2/SDL.h> SDL_Window* gWindow = NULL; SDL_Renderer* gRenderer = NULL; int main( int argc, char* args[] ) { SDL_Init( SDL_INIT_VIDEO ); gWindow = SDL_CreateWindow( "test", 0,0,640,480, SDL_WINDOW_SHOWN ); gRenderer = SDL_CreateRenderer(gWindow,-1,SDL_RENDERER_ACCELERATED); SDL_Surface* x = SDL_CreateRGBSurface(0,50,50,32,0xFF,0xFF00,0xFF0000,0XFF000000); SDL_Surface* y = SDL_CreateRGBSurface(0,640,480,32,0xFF,0xFF00,0xFF0000,0XFF000000); SDL_Rect a = {0,0,50,50}; SDL_RenderClear(gRenderer); SDL_FillRect(x,&a,SDL_MapRGBA(x->format,255,255,0,255)); SDL_Rect dest =

How to blit Score on screen in SDL?

做~自己de王妃 提交于 2019-12-08 14:13:56
问题 I have been working on a Pong clone game. It's almost done, just when I thought everything is perfect. The SDL_ttf.h Library seems to be a pain. I am going to give a general overview and not the whole code just to make things simple. I have used- int PlayerScore=0; int AIScore=0; Here's the syntax to render text in SDL. SDL_Surface *TTF_RenderText_Solid(TTF_Font *font, const char *text, SDL_Color fg); Now, see that const char* text ? That's where I need to give my PlayerScore/AIScore there.