sdl

SDL fake fullscreen mode on dual monitor setup under linux

送分小仙女□ 提交于 2020-01-02 02:19:45
问题 Using SDL 1.3 I want to create fake fullscreen SDL_Window under linux. It is easy if i have only one display. I just got current display mode and created a window. SDL_GetDesktopDisplayMode(0, &mode); SDL_Window *win = SDL_CreateWindow("my window", 0,0,mode.w, mode.h, SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN | SDL_WINDOW_BORDERLESS ); But when i have two displays, things get complicated. The window spreads across multiple monitors. SDL sees only one, double sized virtual display. I tested it with

error LNK2001 __imp_fprintf Visual Studio 2015 RC

牧云@^-^@ 提交于 2020-01-02 01:32:09
问题 I recently was forced to upgrade from Visual Studio 2015 Pre-Release to Visual Studio 2015 Release Candidate as a result of an expired license. My project was previously building fine, however, now it is not. I am getting only two link errors and I've spent the last two days attempting to address them: 1>SDL2main.lib(SDL_windows_main.obj) : error LNK2001: unresolved external symbol __imp_fprintf 1>SDL2main.lib(SDL_windows_main.obj) : error LNK2001: unresolved external symbol __imp___iob_func

Why shouldn't you use a handle during component creation or streaming?

别等时光非礼了梦想. 提交于 2020-01-01 12:08:30
问题 I want to make a custom VCL control that wraps a SDL rendering surface via the SDL_CreateWindowFrom function. SDL_CreateWindowFrom takes an existing HWND handle and puts a high-performance rendering context (it has several backends available, including DirectX and OpenGL) onto it. The helpfile says "Do not refer to the Handle property during component creation or streaming." But it doesn't say why. It says that the first time you try to access the Handle property, it'll call HandleNeeded to

What is a Blit in SDL?

心不动则不痛 提交于 2020-01-01 07:34:08
问题 In the SDL wiki it says Use this function to perform a fast blit from the source surface to the destination surface. However that doesn't help me much. What does the term surface blitting mean in this context? 回答1: Basically it means copying the image from one surface to another -- possibly cropped and shifted. 回答2: Blitting means bit-boundary block transfer as defined by Wikipedia or Block Information Transfer , well known among the Pygame developers. Assume you have a Surface(your screen).

How do I take and save a BMP screenshot in SDL 2?

ぃ、小莉子 提交于 2020-01-01 01:53:11
问题 Using just a given SDL_Window* and SDL_Renderer*, how can I create and save a screenshot in SDL 2.0? 回答1: Below is a function for saving a screenshot in SDL 2 taken from a library I'm currently writing. bool saveScreenshotBMP(std::string filepath, SDL_Window* SDLWindow, SDL_Renderer* SDLRenderer) { SDL_Surface* saveSurface = NULL; SDL_Surface* infoSurface = NULL; infoSurface = SDL_GetWindowSurface(SDLWindow); if (infoSurface == NULL) { std::cerr << "Failed to create info surface from window

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

故事扮演 提交于 2019-12-31 01:47:09
问题 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

Passing pointer-to-member-function as pointer-to-function

空扰寡人 提交于 2019-12-30 19:00:09
问题 So here's the situation: I'm using C++, SDL and GLConsole in conjunction. I have a class, SDLGame , which has the Init() , Loop() , Render() etc - essentially, it holds the logic for my game class. GLConsole is a nice library so far - it lets me define CVars and such, even inside my SDL class. However, when defining commands, I have to specify a ConsoleFunc , which is typedef'd as typedef bool (*ConsoleFunc)( std::vector<std::string> *args); Simple enough. However, like I said, my functions

SDL: Render Texture on top of another texture

℡╲_俬逩灬. 提交于 2019-12-30 18:29:15
问题 i am having trouble with the following: I need to render a texture on top of another texture and then render that main texture. For example I have the blue rectangle texture, and I want to draw red rectangles on top of this blue rect. However i want them to restrict the render only on this rectangle. Like the following image: I read something about texture blit between them or something like that but im not sure if this is posible. My code looks like this: SDL_RenderCopy(ren,bluetexture,NULL

SDL_SaveBMP saves images upside down

空扰寡人 提交于 2019-12-30 14:48:49
问题 I have used SDL to save the window image via SDL_SaveBMP . The problem is that the saved image is upside down. The saved image is while it has to be How should I fix the code? screen_shot function: void screen_shot(std::string filename) { int width = glutGet(GLUT_WINDOW_WIDTH); int height = glutGet(GLUT_WINDOW_HEIGHT); SDL_Surface * image = SDL_CreateRGBSurface(SDL_SWSURFACE, width, height, 24, 0x000000FF, 0x0000FF00, 0x00FF0000, 0); glReadBuffer(GL_FRONT); glReadPixels(0, 0, width, height,

Embedding SDL into GTK+

我的未来我决定 提交于 2019-12-30 06:57:19
问题 I have an application that uses GTK+ to display some nice GUI, but I am using SDL to display a small RGB frame buffer inside GTK+ I have used the following code to get SDL into GTK+: char SDL_windowhack[32]; sprintf(SDL_windowhack, "SDL_WINDOWID=%ld", GDK_WINDOW_XWINDOW(deviceWindow->window)); putenv(SDL_windowhack); Unfortunately, I also use SDL for keyboard and mouse event. The main thread that uses SDL to update the image spawns the following thread: void *SDLEvent(void *arg) { SDL_Event