sdl-2

Can't run SDL(2) on Ubuntu, No available video device

心已入冬 提交于 2019-12-01 20:46:41
When i try to run my program i get the following error message: SDL could not initialize! SDL_Error: No available video device I have all the necessary SDL libraries installed and I'm currently running ubuntu 15.10 Here is my simple SDL code: #include <stdio.h> #include "SDL2/SDL.h" //Screen dimension constants const int SCREEN_WIDTH = 640; const int SCREEN_HEIGHT = 480; int main(int argc, char* argv[]) { //The window we'll be rendering to SDL_Window* window = NULL; //The surface contained by the window SDL_Surface* screenSurface = NULL; //Initialize SDL if( SDL_Init( SDL_INIT_VIDEO ) < 0 ) {

SDL_GetTicks() accuracy below the millisecond level

依然范特西╮ 提交于 2019-12-01 20:15:15
I program currently something with SDL2. All works fine, but I have a problem with the SDL_GetTicks() method. Normally it should return the total application time in milliseconds, but it always returns most of the time the value 0 and sometimes the value 1. I initialized SDL with SDL_INIT_EVERYTHING flag. The problem with the following code is the loop is too fast, so the delta time is smaller than 1 ms. Is there a method to achieve a higher precision? #include "Application.hpp" void Application::Initialize() { int sdl_initialize_result = SDL_Init(SDL_INIT_EVERYTHING); if(sdl_initialize_result

“undefined reference to `FT_Load_Glyph'” and other SDL2_ttf functions using CMAKE

≡放荡痞女 提交于 2019-12-01 13:55:57
Using this CMAKE-file in Clion on Windows 10 (using MinGW 5.0): cmake_minimum_required(VERSION 3.3) project(ClionProjects) # configure the SDL (cf. "SDL2-2.0.3\i686-w64-mingw32\lib\pkgconfig\sdl2.pc") # C++ flags set(SDL2_Flags "-mwindows -Wl,--no-undefined -static-libgcc") # library paths set(SDL2_ROOT "C:/SDL2/i686-w64-mingw32") set(SDL2_Includes "${SDL2_ROOT}/include") set(SDL2_LibDir "${SDL2_ROOT}/lib") # imported targets for CMake (cf. https://cmake.org/Wiki/CMake/Tutorials/Exporting_and_Importing_Targets) add_library(SDL2 STATIC IMPORTED) add_library(SDL2main STATIC IMPORTED) add_library

“undefined reference to `FT_Load_Glyph'” and other SDL2_ttf functions using CMAKE

回眸只為那壹抹淺笑 提交于 2019-12-01 12:28:09
问题 Using this CMAKE-file in Clion on Windows 10 (using MinGW 5.0): cmake_minimum_required(VERSION 3.3) project(ClionProjects) # configure the SDL (cf. "SDL2-2.0.3\i686-w64-mingw32\lib\pkgconfig\sdl2.pc") # C++ flags set(SDL2_Flags "-mwindows -Wl,--no-undefined -static-libgcc") # library paths set(SDL2_ROOT "C:/SDL2/i686-w64-mingw32") set(SDL2_Includes "${SDL2_ROOT}/include") set(SDL2_LibDir "${SDL2_ROOT}/lib") # imported targets for CMake (cf. https://cmake.org/Wiki/CMake/Tutorials/Exporting_and

Get pixel info from SDL2 texture

守給你的承諾、 提交于 2019-12-01 10:49:17
I'm currently writing a simple program using SDL2 where you can drag some shapes (square, circle, triangle, etc) into a canvas and rotate them and move them around. Each shape is represented visually by a SDL texture that is created from a PNG file (using the IMG_LoadTexture function from the SDL_image library). The thing is that I would like to know whether a certain pixel from the texture is transparent, so that when someone clicks on the image I could determine if I have to do some action (because the click is on the non transparent area) or not. Because this is some school assignment I'm

how many pixels is a meter in Box2D?

早过忘川 提交于 2019-12-01 10:34:06
Question is simple so, no codes! If someone knows Box2D and SDL2, then, please tell me how to wrap SDL_Rect with b2body. Ofcourse, it requires to know the conversion of metre to pixel and vice versa. This is because Box2D measures distance in metres. Can you give me a simple expression or function to convert metres(of Box2D) to pixels or pixels to metres(of Box2D)? Can you give me a simple expression or function to convert metres(of Box2D) to pixels or pixels to metres(of Box2D)? Unfortunately, this isn't as simple as it sounds, for us. Because, if your game is on worms, then your game world

SDL_Texture - Incomplete type

你离开我真会死。 提交于 2019-12-01 03:26:58
a day ago I installed an SDL2 library. It is not in Debian Wheezy yet, so I used configure, make, make install commands. After all, when I try to use SDL_Texture, I get this error: error: forward declaration of ‘SDL_Texture {aka struct SDL_Texture}’ invalid use of incomplete type ‘SDL_Texture {aka struct SDL_Texture}’ After looking for declaration, everything I found are these two lines in SDL_render.h: struct SDL_Texture; typedef struct SDL_Texture SDL_Texture; No definition at all. I think my installation is missing file SDL_sysrender.h. It is in source code I downloaded, but not in SDL2

Debugging load time error in C++ SDL2 program compiled with VS2015 on Win10

给你一囗甜甜゛ 提交于 2019-12-01 03:16:39
I'm writing a project in C++ with SDL2 on 64-bit Windows 10 using Visual Studio 2015. I recently purchased a new Windows 10 laptop and cloned my project from github. My project compiles correctly, but I get the following error when I run it: The application was unable to start correctly (0xc000007b). Click OK to close the application. Based on my research so far, this error is usually caused by loading an incompatible DLL, e.g. a 64-bit version instead of 32-bit. Suggestions I've found so far include: Checking that I'm using the 32-bit versions of the SDL2 DLLs Installing/reinstalling the x86

undefined reference to WinMain@16 C++, SDL-2

馋奶兔 提交于 2019-11-30 15:53:01
问题 I've been getting the error undefined reference to WinMain@16 . To save space, here's a link to all the files currently in the project. At present, it shouldn't do much other than create a window, fill it in green and then draw a box in the corner, all the while tracking my mouse's position through the console. However, it won't build and I'm given the aforementioned error. My linker libraries are: glew32s libSDL2main mingw32 libSDL2 opengl32 glew32 I am using Codeblocks 13.12 with g++

undefined reference to WinMain@16 C++, SDL-2

删除回忆录丶 提交于 2019-11-30 15:06:28
I've been getting the error undefined reference to WinMain@16 . To save space, here's a link to all the files currently in the project . At present, it shouldn't do much other than create a window, fill it in green and then draw a box in the corner, all the while tracking my mouse's position through the console. However, it won't build and I'm given the aforementioned error. My linker libraries are: glew32s libSDL2main mingw32 libSDL2 opengl32 glew32 I am using Codeblocks 13.12 with g++ following the C++11 ISO C++ language standard. My PC is using windows 10 in case that's relevant. I've spent