sdl-2

How to fix unresolved externals of SDL 2.0.3 on Visual Studio 2015 Preview?

北战南征 提交于 2019-12-08 15:24:33
问题 so i'm getting the following errors: 1>SDL2main.lib(SDL_windows_main.obj) : error LNK2019: unresolved external symbol __imp__fprintf referenced in function _ShowError 1>SDL2main.lib(SDL_windows_main.obj) : error LNK2019: unresolved external symbol __imp____iob_func referenced in function _ShowError my code is simply: #include <iostream> #include "SDL2\SDL.h" int main(int argc, char* argv[]) { std::cout << "Hello World!" << std::endl; return 0; } i've linked the libraries correctly, and this

Problems installing Common Lisp Sketch into Windows 10

戏子无情 提交于 2019-12-08 08:28:42
问题 I had trouble getting through errors for missing SDL DLL's and an FFI.H file while installing sketch with quicklisp. Posting my solution for this Windows 10 specific trouble, maybe there are other solutions too. I ended up using Chocolatey and Cmder for my mingw64 environment. 回答1: This is what I had to do in order to get through several errors for missing SDL DLL's and FFI.H header. 1. Install Cmder using Chocolatey: https://chocolatey.org/packages/Cmder 2. Download and copy all the SDL, SDL

Set Logitech Steering Wheel position/angle from SDL?

馋奶兔 提交于 2019-12-08 00:44:37
问题 I'm writing C code that controls a Logitech gaming wheel using SDL. So far I have successfully implemented the code that sets the steering wheel in autocenter mode with: SDL_HapticSetAutocenter(haptic, STRENGTH); //set autocenter I would like to be able to use the motor of the steering wheel to rotate it as desired to particular angle positions. After checking in the documentation of the API, I did not find a simple way to do it. I wonder if anyone has some advice on this. 来源: https:/

C++ SDL2 Error when trying to render SDL_Texture: Invalid texture

佐手、 提交于 2019-12-08 00:23:31
问题 I'm trying to make a simple game and when I try rendering my SDL_Texture , I get an inexplicable error. I've set up everything right, I'm able to successfully clear the screen with SDL_RenderClear , and my texture isn't null, so it should have been created properly. But when I try calling the render() function I get an error, and SDL_GetError() returns "Invalid texture". Edit: I have now created an MCVE as requested, and I tested it to verify that it reproduces the error. It should display

Big memory leak in SDL_Init

依然范特西╮ 提交于 2019-12-07 17:58:29
问题 EDIT: updated with some new info (Bold'ed). Also, the code and Valgrinds output is updated. I recently started using SDL2 as my graphics library. After developing some stuff, I decided to run Valgrind and found out that I am leaking memory... a lot of memory. After narrowing it down I compiled this code (In C) : #include <SDL2/SDL.h> int main(int argc, char** argv) { SDL_Init(SDL_INIT_EVERYTHING); SDL_QuitSubSystem(SDL_INIT_EVERYTHING); SDL_Quit(); return 0; } This is the make file: CC = gcc

How to load file font into RAM using C/C++ and SDL2?

旧巷老猫 提交于 2019-12-07 14:43:57
问题 Accordingly to the ''best practices'' I have learned, we should load the resources we need to our programs into RAM, avoiding unnecessary requests to user's hard drive. Using SDL2, I always free image files after loading them into RAM. (File -> Surface -> Texture -> Free File/Surface). So, if I other application changes the file, my program ignores it, as the file is not in use by it anymore. Now in lesson 16 I am learning to use the Add-on SDL_ttf . However, using SDL_ttf addon I could not

Render TTF SDL2.0 opengl 3.1

回眸只為那壹抹淺笑 提交于 2019-12-07 13:59:58
问题 I'm working with SDL2.0, and using a (semi modern) opengl (3.1). I'm looking to add a text overlay to my application, and to render TTF in the application. How would I go about this using modern OpenGL? EDIT: As per the suggestion of genpfault, I've tried using the SDL_TTF library, but All I'm getting is garbage on screen http://i.stack.imgur.com/FqyCT.png I've attached a gist of my shaders, which are very simple for this program, and also the snipped I'm using to load the text into surface,

How to draw a rectangle outline in SDL 2.0

别来无恙 提交于 2019-12-07 10:58:39
问题 I'm trying to draw a rectangle outline in SDL 2.0 in order to use as a selection box. Does anyone know how to make one in SDL 2.0? 回答1: You are looking for the SDL_RenderDrawRect: int SDL_RenderDrawRect(SDL_Renderer* renderer, const SDL_Rect* rect); Typical usage would be: SDL_Rect rectToDraw = {100,100,100,100} // Just some random rect //Set Color of Rect with SDL_SetRenderDrawColor if needed SDL_RenderDrawRect(renderer, &rectToDraw); To draw a filled rect it would then be with SDL

Problems installing Common Lisp Sketch into Windows 10

感情迁移 提交于 2019-12-07 09:15:30
I had trouble getting through errors for missing SDL DLL's and an FFI.H file while installing sketch with quicklisp. Posting my solution for this Windows 10 specific trouble, maybe there are other solutions too. I ended up using Chocolatey and Cmder for my mingw64 environment. This is what I had to do in order to get through several errors for missing SDL DLL's and FFI.H header. 1. Install Cmder using Chocolatey: https://chocolatey.org/packages/Cmder 2. Download and copy all the SDL, SDL_image and SDL_ttf DLL's to SBCL's .exe folder: a. https://www.libsdl.org/download-2.0.php b. https://www

SDL_Image IMG_Load fails on png with: “Failed loading libpng16-16.dll:”

落爺英雄遲暮 提交于 2019-12-07 03:32:01
问题 Whenever I try to load a PNG using SDL_Image's IMG_Load function it gives the error Failed loading libpng16-16.dll: . I have all the right dll's in the right path and I can use other parts of SDL_Image, but for some reason it can't load the libpng dll. How can I fix this? Any help is appreciated. 回答1: See my article "SDL2: Loading Images with SDL_image": If you're going to run from Visual Studio, make sure the image is in the same folder as your main.cpp file; otherwise if you're running