sdl-2

Header file for SDL_Overlay

丶灬走出姿态 提交于 2019-12-13 02:59:44
问题 I plan to use both SDL_GetKeyboardState and SDL_Overlay but it seems there is a conflict. #include <stdio.h> #include <SDL/SDL.h> #include <SDL2/SDL.h> int main() { const Uint8 *keystate = SDL_GetKeyboardState(NULL); SDL_Overlay *bmp; printf("hello world!"); } Compile: gcc -c main.cpp When order of headers are: #include <SDL/SDL.h> #include <SDL2/SDL.h> error: ‘SDL_GetKeyboardState’ was not declared in this scope const Uint8 *keystate = SDL_GetKeyboardState(NULL); ^ or #include <SDL2/SDL.h>

SDL2 rendering text issues

☆樱花仙子☆ 提交于 2019-12-13 02:33:52
问题 I have a menu where there is a lot of text being rendered that can change in size/color/position, so I made two functions in my menu class...: void drawText(string text,int text_size,int x,int y, Uint8 r,Uint8 g,Uint8 b); void updateTexts(); The updateTexts() function sits in the game loop and contains many drawText functions, When I launch the program I notice the programs memory gradually increase from 4mb about 1gb (it should stay at 4mb) then it crashes. I assume the problem exists

Can this line drawing algorithm be optimized? - SDL

試著忘記壹切 提交于 2019-12-12 22:19:08
问题 For a project I have been working on, the ability to draw lines with a gradient (I.E. they change color over the interval they are drawn) would be very useful. I have an algorithm for this, as I will paste below, but it turns out to be DREADFULLY slow. I'm using the Bresenham algorithm to find each point, but I fear that I have reached the limits of software rendering. I've been using SDL2 thus far, and my line drawing algorithm appears 200x slower than SDL_RenderDrawLine . This is an

SDL2 Multiple renderers?

て烟熏妆下的殇ゞ 提交于 2019-12-12 16:38:41
问题 I'm new to game development, SDL and C++. I have been learning with the code here: http://gamedevgeek.com/tutorials/managing-game-states-in-c/ The relevant bit: Multiple states are not only important in demos, but also in games in general. Every game starts off in an introduction state, then moves to a menu of some kind, a finally play begins. When you’re finally defeated, the game moves to a game-over state, usually followed by a return to the menu. In most games it is possible to be in more

failed: dlopen failed: cannot locate symbol “signal” referenced by “libSDL2.so”

寵の児 提交于 2019-12-12 15:39:29
问题 building an Android application using the SDL, I am loading this in the java file using System.loadLibrary("SDL2");but when I try to run the application on an android tablet, it gives the following error "java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol “signal” referenced by “libSDL2.so”…" 回答1: Make sure your ndk platform version matches your phone's architecture. I had to experiment with a few different ndk versions to figure it out myself. If that fails, perhaps you are

Can we use std::fstream instead of SDL_RWops in SDL2?

自闭症网瘾萝莉.ら 提交于 2019-12-12 13:29:18
问题 As the title, does SDL_RWops have any advantages over std::fstream in dealing with I/O file? Can I use std::fstream instead because I am more familiar with it? 回答1: By reading their documentation, you can find that std::fstream is an: Input/output stream class to operate on files. On the other side, SDL_RWops is something more: SDL_RWops is an abstraction over I/O. It provides interfaces to read, write and seek data in a stream, without the caller needing to know where the data is coming from

Kivy error - “Unable to get a window, abort”

≡放荡痞女 提交于 2019-12-12 03:55:45
问题 I installed kivy on my Raspberry pi3, where i run a python program that already works on another pi3. I now am trying to install the same thing on this second pi, and it doesn't work...maybe I forgot something, but i think i did all the same steps as before.. kivy is well installed indeed, as other packages for the python program. here below the error: pi@raspberrypi:~ $ python pi4.py [INFO ] [Logger ] Record log in /home/pi/.kivy/logs/kivy_17-01-19_4.txt [INFO ] [Kivy ] v1.9.2-dev0 [INFO ]

SDL Max OSX via Homebrew, Makefile not quite working

和自甴很熟 提交于 2019-12-12 03:47:21
问题 I have installed SDL through homebrew, and it works perfectly with my test program if I enter the following command directly in the terminal: g++ -O3 -g -Wall -Wextra -std=c++1y hello.cpp hello_main.cpp `sdl2-config --cflags --libs` -o hello but unfortunately my attempts to write a makefile (I will definitely need one) have yielded unsuccessful/unexplained results. I am following this, but my configuration is different/I am not specifying Cocoa (I don't need to) so I expect that the issues I

JNI calling non static function segfaults

杀马特。学长 韩版系。学妹 提交于 2019-12-12 03:17:47
问题 I am doing some work with the SDL library for android but i'm having a little obstacle. This function is defined in Java: /** * This method is called by SDL using JNI. * @return an array which may be empty but is never null. */ public static int[] inputGetInputDeviceIds(int sources) { int[] ids = InputDevice.getDeviceIds(); int[] filtered = new int[ids.length]; int used = 0; for (int i = 0; i < ids.length; ++i) { InputDevice device = InputDevice.getDevice(ids[i]); if ((device != null) && (

How do you fix a program from freezing when you move the window in SDL2?

僤鯓⒐⒋嵵緔 提交于 2019-12-12 01:53:10
问题 I'm making a small game with a friend and one problem is that when you drag the window around, it freezes and the program completely stops until you let go. I searched for a simple solution but I only found out that it happens with everything. Also, it screws up the delta time since it acts like a really long frame. Is there any way to either simply have the program continue running while you move it or if that's too complicated, fix the delta time? Thanks? 回答1: Your application is most