sdl-2

SDL2: Fast Pixel Manipulation

怎甘沉沦 提交于 2019-11-27 07:54:01
I want to draw pixels on the monitor which change frequently after certain parameters. E.G. if a Red and Green Pixel collide, they would both vanish, etc. In every frame I have to manipulate about 100 - 1000 pixels. I have a multi-threaded approach here, which wont give me 30FPS (what I want). Currently I store a Pixel array in the RAM which contains all Pixels and have a SDL_Surface . When a pixel in the array changes, it gets changed in the Surface too and is then after all manipulation is done gets blitted to the screen. My current approach is too slow and I did a bit of thinking on how I

SDL2.0 Alternative for SDL_Overlay

人盡茶涼 提交于 2019-11-27 05:37:58
问题 So I've been trying to go through the following tutorial on ffmpeg: http://dranger.com/ffmpeg/tutorial02.html However, when I try to compile using gcc, I get the following output: root:/Users/mbrodeur/Downloads/HACKATHON CONTENT/Tutorials-> gcc -o tutorial02 tutorial02.c -lavutil -lavformat -lavcodec -lz -lavutil -lm -lswscale -D_THREAD_SAFE -lSDL2 tutorial02.c: In function ‘main’: tutorial02.c:41: error: ‘SDL_Overlay’ undeclared (first use in this function) tutorial02.c:41: error: (Each

How to use SDL2 and SDL_image with cmake

廉价感情. 提交于 2019-11-27 03:58:33
I'm looking for the simplest way to compile a c++ program using SDL2 and SDL_image with cmake. Here is my best attempt, after hours of searching: CMakeLists.txt project(shooter-cmake2) cmake_minimum_required(VERSION 2.8) set(SOURCES shooter.cpp classes.cpp utils.cpp ) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") add_executable(${PROJECT_NAME} ${SOURCES}) INCLUDE(FindPkgConfig) PKG_SEARCH_MODULE(SDL2 REQUIRED sdl2) PKG_SEARCH_MODULE(SDL2_image REQUIRED sdl2_image) INCLUDE_DIRECTORIES(${SDL2_INCLUDE_DIRS} ${SDL2IMAGE_INCLUDE_DIR}) TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${SDL2_LIBRARIES} $

sdl2 - ImportError: DLL load failed: The specified module could not be found and [CRITICAL] [App] Unable to get a Window, abort

江枫思渺然 提交于 2019-11-27 03:23:17
问题 Python: 3.6.4 OS: Windows 10 Kivy: 1.10.0 Kivy Installation Method python -m pip install --upgrade pip wheel setuptools python -m pip install docutils pygments pypiwin32 kivy.deps.sdl2 kivy.deps.glew python -m pip install kivy.deps.gstreamer python -m pip install kivy.deps.angle python -m pip install kivy python -m pip install kivy_examples python -m pip install Pillow python -m pip install cython python -m pip install PyEnchant Description Hi, I am trying to run the example code from the

Xcode 5 crashes when running an app with SDL 2

大城市里の小女人 提交于 2019-11-27 00:22:07
问题 I tried to follow these two tutorials (or the applicable parts of them, due to version differences) to install SDL 2.0.2 to work with Xcode 5.1: Tutorial 1 Tutorial 2 Running any program with the SDL 2 framework linked causes Xcode to crash with the following problem details: Process: Xcode [1787] Path: /Applications/Xcode.app/Contents/MacOS/Xcode Identifier: com.apple.dt.Xcode Version: 5.1 (5084) Build Info: IDEFrameworks-5084000000000000~21 App Item ID: 497799835 App External ID: 444172641

Odd segmentation fault with CC/GCC but not G++ (C/SDL2/Linux)

被刻印的时光 ゝ 提交于 2019-11-26 23:25:50
问题 The code posted is copied directly from an example of a popular SDL2 tutorial, to ensure that it wasn't I who had made some silly mistake. All I've done to the example is changing the path of the image file in question, I changed type bool to int, false to 0 and true to 1. As I understand it, nothing C++ specific should remain. Everything seems to work regardless what I do, but when compiling with CC/GCC (I suppose that's really the same deal) I get a segmentation fault in the very end, I

“winapifamily.h: No such file or directory” when compiling SDL in Code::Blocks

為{幸葍}努か 提交于 2019-11-26 22:37:07
问题 I am following along with the SDL2.0 tutorials by LazyFoo, using Code::Blocks 13.12. I have had no trouble getting SDL2 linked and running in VS2010 but have changed IDE and come across this error: winapifamily.h: No such file or directory I think everything is linked correctly. I have pointed the program to my SDL2 include and lib directories. Buildlog: (error is occuring in file: ..\include\SDL2\SDL_platform.h) === Build: Debug in SDL2_Setup (compiler: GNU GCC Compiler) === fatal error:

Drawing 2D stuff with SDL_Renderer and OpenGL stuff with SDL_GLContext

房东的猫 提交于 2019-11-26 22:05:07
问题 I have been learning about SDL 2D programming for a while and now I wanted to create a program using SDL and OpenGL combined. I set it up like this: SDL_Init(SDL_INIT_VIDEO); window = SDL_CreateWindow("SDL and OpenGL", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, width, height, SDL_WINDOW_OPENGL); context = SDL_GL_CreateContext(window); The program is for now just a black window with a white line displayed using OpenGl. Here is the code for the rendering: glClearColor(0, 0, 0, 0); glClear

Smart pointers with SDL

我的未来我决定 提交于 2019-11-26 19:54:43
问题 For my game should I use a raw pointer to create SDL_Window , SDL_Renderer , SDL_Texture etc. as they have specific delete functions SDL_DestroyTexture(texture); or should I add a custom deleter when I create a unique_ptr or shared_ptr and if so how would I do this with SDL types? 回答1: You could create a functor that has several overloaded operator() implementations, each of which call the correct destroy function for the respective argument type. struct sdl_deleter { void operator()(SDL

Using SDL2 with CMake

孤街浪徒 提交于 2019-11-26 16:42:21
问题 I'm trying to use CLion to create a SDL2 project. The problem is that the SDL headers can't be found when using #include's. My CMakeLists.txt file: cmake_minimum_required(VERSION 2.8.4) project(ChickenShooter) set(SDL2_INCLUDE_DIR C:/SDL/SDL2-2.0.3/include) set(SDL2_LIBRARY C:/SDL/SDL2-2.0.3/lib/x64) include_directories(${SDL2_INCLUDE_DIR}) set(SOURCE_FILES main.cpp) add_executable(ChickenShooter ${SOURCE_FILES}) target_link_libraries(ChickenShooter ${SDL2_LIBRARY}) My test main.cpp: #include