sdl
Haskell library for 2D drawing [closed]
Instead of picking individual libraries, I’ll have a go at a quick overview at all of them, as listed in the Graphics section on Hackage. Basic frameworks: OpenGL Part of the Haskell Platform Used for many small 2 and 3D games. Examples: lambdacube-engine, roguestar-gl, hpong, monadius, raincat, frag GTK cabal install cairo Used for high … Read more
Problems using member function as custom deleter with std::shared_ptr
std::shared_ptr<SDL_Surface>(SDL_LoadBMP(….), [=](SDL_Surface* surface) { std::cout << “Deleting surface\n”; SDL_FreeSurface(surface); }); or void DeleteSurface(SDL_Surface* surface) { std::cout << “Deleting surface\n”; SDL_FreeSurface(surface); } std::shared_ptr<SDL_Surface>(SDL_LoadBMP(….), DeleteSurface); EDIT: Seeing your updated question, DeleteSurface should be a non-member function, otherwise you need to use std::bind or std::mem_fn or some other member function pointer adapter.
“winapifamily.h: No such file or directory” when compiling SDL in Code::Blocks
UPDATE: SDL 2.0.4 is now out, includes a fix for this bug, and is available for download at http://libsdl.org/download-2.0.php This is a bug in SDL 2.0.3. A fix has been committed for SDL’s next release. In the meantime, here’s a link to the fixed copy of SDL_platform.h: https://hg.libsdl.org/SDL/raw-file/e217ed463f25/include/SDL_platform.h If you drop the file into SDL … Read more
How to suppress console output in Python?
Just for completeness, here’s a nice solution from Dave Smith’s blog: from contextlib import contextmanager import sys, os @contextmanager def suppress_stdout(): with open(os.devnull, “w”) as devnull: old_stdout = sys.stdout sys.stdout = devnull try: yield finally: sys.stdout = old_stdout With this, you can use context management wherever you want to suppress output: print(“Now you see it”) … Read more
Why SDL defines main macro?
Per the SDL Windows FAQ: You should be using main() instead of WinMain() even though you are creating a Windows application, because SDL provides a version of WinMain() which performs some SDL initialization before calling your main code. If for some reason you need to use WinMain(), take a look at the SDL source code … Read more
Why are SDL and OpenGL related?
SDL is a layer above OpenGL; in fact it uses GDI on Windows by default and also has a DirectX backend. People are probably saying you can use OpenGL to get around limitations of SDL on platforms that by default use OpenGL (ahem, Linux) because the higher level abstraction doesn’t expose that functionality. However, then … Read more
Difference between surface and texture (SDL / general)
Basically your assumption “has to do something with GPU?” is right. SDL_Surface is used in software rendering. With software rendering, as saloomi2012 correctly noticed, you are using regular RAM to store image data. Thus, in most cases you can access data buffer associated with surface directly, modifying its content, i.e. it is using CPU, hence … Read more
What is an SDL renderer?
SDL_Window SDL_Window is the struct that holds all info about the Window itself: size, position, full screen, borders etc. SDL_Renderer SDL_Renderer is a struct that handles all rendering. It is tied to a SDL_Window so it can only render within that SDL_Window. It also keeps track the settings related to the rendering. There are several … Read more
libpng warning: iCCP: known incorrect sRGB profile
Libpng-1.6 is more stringent about checking ICC profiles than previous versions. You can ignore the warning. To get rid of it, remove the iCCP chunk from the PNG image. Some applications treat warnings as errors; if you are using such an application you do have to remove the chunk. You can do that with any … Read more