What is the point of an SDL2 Texture?

SDL_Texture objects are stored as close as possible to video card memory and therefore can easily be accelerated by your GPU. Resizing, alpha blending, anti-aliasing and almost any compute-heavy operation can harshly be affected by this performance boost. If your program needs to run a per-pixel logic on your textures, you are encouraged to convert … Read more

Xcode 5 crashes when running an app with SDL 2

It looks like the problem is that SDL2 isn’t properly signed. There’s a ticket to fix the issue at https://bugzilla.libsdl.org/show_bug.cgi?id=2058. When you spawn an application from Xcode 5 with lldb, Xcode loads a plugin that will inspect modules your application loads, presumably to give you insight into your program. Xcode is set up to crash … Read more

How to use SDL2 and SDL_image with cmake

I think that the following will work, as it finds the libraries on my ubuntu system and the example function you provided can link: project(shooter-cmake2) cmake_minimum_required(VERSION 2.8) set(CMAKE_CXX_FLAGS “${CMAKE_CXX_FLAGS} -std=c++0x”) add_executable(${PROJECT_NAME} src/test.cpp) INCLUDE(FindPkgConfig) PKG_SEARCH_MODULE(SDL2 REQUIRED sdl2) PKG_SEARCH_MODULE(SDL2IMAGE REQUIRED SDL2_image>=2.0.0) INCLUDE_DIRECTORIES(${SDL2_INCLUDE_DIRS} ${SDL2IMAGE_INCLUDE_DIRS}) TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${SDL2_LIBRARIES} ${SDL2IMAGE_LIBRARIES}) If cmake is executed with –debug-output it outputs: — Found PkgConfig: … Read more

“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

Using SDL2 with CMake

This blog post shows how you can do it: Using SDL2 with CMake On Linux you can use a recent CMake (e.g. version 3.7) and using SDL2 works out of the box. cmake_minimum_required(VERSION 3.7) project(SDL2Test) find_package(SDL2 REQUIRED) include_directories(SDL2Test ${SDL2_INCLUDE_DIRS}) add_executable(SDL2Test Main.cpp) target_link_libraries(SDL2Test ${SDL2_LIBRARIES}) Under Windows you can download the SDL2 development package, extract it somewhere … Read more

How to render text in SDL2?

Yep, it is possible, given that you have a renderer and a window plus you don’t really have any thoughts on dabbling with surfaces then you might want to mind on creating texture, here is a sample code //this opens a font style and sets a size TTF_Font* Sans = TTF_OpenFont(“Sans.ttf”, 24); // this is … 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

unresolved external symbol __imp__fprintf and __imp____iob_func, SDL2

I have finally figured out why this is happening ! In visual studio 2015, stdin, stderr, stdout are defined as follow : #define stdin (__acrt_iob_func(0)) #define stdout (__acrt_iob_func(1)) #define stderr (__acrt_iob_func(2)) But previously, they were defined as: #define stdin (&__iob_func()[0]) #define stdout (&__iob_func()[1]) #define stderr (&__iob_func()[2]) So now __iob_func is not defined anymore which leads … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)