sdl-2

How to draw pixels in SDL 2.0?

天涯浪子 提交于 2019-11-30 03:53:40
How does one draw with pixels in SDL2.0? I'm trying to get familiar with C++, but this is very difficult to do without pretty pictures, so I'm trying to get a very basic graphics display thing running. All I really want it to do is give me a window, let me draw rgbα pixels on it, and access information about those pixels. There may be other things I want that I'm not aware of, but that's all that's on my list right now. My research on this has lead me to try using SDL, the current version being 2.0. Almost all my graphics experience comes from using JavaScript on a <canvas> . Most of the other

Why do I get bad performance with SDL2 and SDL_RenderCopy inside a double for loop over all pixels?

帅比萌擦擦* 提交于 2019-11-29 11:10:58
I am programming a raycasting game using SDL2. When drawing the floor, I need to call SDL_RenderCopy pixelwise. This leads to a bottleneck which drops the framerate below 10 fps. I am looking for performance boosts but can't seem to find some. Here's a rough overview of the performance drop: int main() { while(true) { for(x=0; x<800; x++) { for(y=0; y<600; y++) { SDL_Rect src = { 0, 0, 1, 1 }; SDL_Rect dst = { x, y, 1, 1 }; SDL_RenderCopy(ren, tx, &src, &dst); // this drops the framerate below 10 } } SDL_RenderPresent(ren); } } You should probably be using texture streaming for this. Basically

How can I get the screen resolution using SDL2?

旧时模样 提交于 2019-11-29 10:45:52
I'm using pixel-perfect source images and SDL2 to make a program. When set to fullscreen, I'd like it to use the native resolution (the SDL_WINDOW_FULLSCREEN_DESKTOP flag) but only between a certain minimum resolution and a reasonable maximum one, after which it will stretch from the largest legal resolution. The problem is that I can only find references to the program's own window or program size on the SDL2 documentation. Is there any function in SDL from which I could retrieve the screen width and height at least almost directly? Or I should do something like using SDL_WINDOW_FULLCREEN

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

浪子不回头ぞ 提交于 2019-11-29 04:01:12
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 install Kivy. The following is the error I receive back. Any help would be great. I have tried looking at

Using homebrew installed SDL2 with Xcode

本秂侑毒 提交于 2019-11-29 01:54:38
I have installed SDL2 using Homebrew but now I don't know how to make sure Xcode can use it! I imported the created library and added it to the build phases tab of my project. But when I try to build I get the error 'SDL2/SDL.h' not found To be able to use SDL2 on Xcode you must set two things (which are required for SDL in general): where to find header files (so that Clang can compile with -Iheader/path ) where to find the .dylib to link it to the project (since with brew you don't have a real .framework ) To know the correct paths you should invoke sdl2-config --cflags and sdl2-config -

How to draw pixels in SDL 2.0?

怎甘沉沦 提交于 2019-11-29 01:24:49
问题 How does one draw with pixels in SDL2.0? I'm trying to get familiar with C++, but this is very difficult to do without pretty pictures, so I'm trying to get a very basic graphics display thing running. All I really want it to do is give me a window, let me draw rgbα pixels on it, and access information about those pixels. There may be other things I want that I'm not aware of, but that's all that's on my list right now. My research on this has lead me to try using SDL, the current version

Static-linking of SDL2 libraries

故事扮演 提交于 2019-11-28 18:26:59
I am using Windows 7, Code::Blocks and MinGW. I have little to no experience when it comes to compiling/building anything, especially when Code::Blocks doesn't use makefiles. I downloaded SDL2-devel-2.0.0-mingw.tar.gz (SDL Development Libraries) from http://www.libsdl.org/tmp/download-2.0.php , and I'd like to create a standalone executable using SDL2 libraries, but so far I've always had to bundle the SDL2.dll file with the executable to make it work. I've heard that I can not static-link dynamic libraries, so my only option seems to be doing something with the source files using the file

SDL2: LNK1561: entry point must be defined

你。 提交于 2019-11-28 07:34:56
I want to compile this code: #include <SDL.h> int main(int argc, char* argv[]) { return 0; } But it can't be linked: Error 1 error LNK1561: entry point must be defined There is some strange code in this library: http://hg.libsdl.org/SDL/file/75726efbf679/include/SDL_main.h #define main SDL_main Also I added SDL2.lib;SDL2main.lib to Project Settings => Linker => Input. What can I do to run this project? VS 2012 SP3, empty C++ project. 4pie0 According to this thread on Dream.In.Code: Right click on project name -> Properties -> Expand Linker tab -> System -> SubSystem: make sure that it is

SDL2.0 Alternative for SDL_Overlay

心不动则不痛 提交于 2019-11-28 06:01:49
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 undeclared identifier is reported only once tutorial02.c:41: error: for each function it appears in.)

Xcode 5 crashes when running an app with SDL 2

六眼飞鱼酱① 提交于 2019-11-28 04:22:01
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 Code Type: X86-64 (Native) Parent Process: launchd [257] Responsible: Xcode [1787] User ID: 501 PlugIn