sdl-2

How do you create SDL2 Visual Studio 2015 or 2017 Solution For Windows and Android?

空扰寡人 提交于 2019-12-23 21:44:17
问题 Visual Studio 2015 has integrated Android Emulator support. They even have a pre-made template to set up Windows Phone, Android, and iOS targets. It seems like there should be some way of setting up SDL 2.0 in the same solution to easily toggle between Android and Windows targets. A valid answer to this question will simply be a set of steps to set up the targets for an example SDL2 program that compiles and creates a simple OpenGL/ES context rotating cube or similar which will either create

C++/SDL2 — Rendering A Circle [closed]

a 夏天 提交于 2019-12-23 02:39:09
问题 Closed . This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed last year . Am I on the right track here, drawing a filled circle with SDL2? I figured using parametric equations and a radius tending to zero would work, but it seems really inefficient in terms of processor use. Any other ideas are much appreciated Thanks in advance. //Circle test int

How to show interstitial ads?

你离开我真会死。 提交于 2019-12-23 02:28:29
问题 How to show interstitial ads? @Override protected void onCreate(Bundle savedInstanceState) { //Log.v("SDL", "onCreate()"); super.onCreate(savedInstanceState); setContentView(R.layout.main); interstitial = new InterstitialAd(this); interstitial.setAdUnitId("ca-app-pub-2188258702xxxxxxxxxxx"); AdRequest adRequest = new AdRequest.Builder() .addTestDevice(AdRequest.DEVICE_ID_EMULATOR) .addTestDevice("XXXXXXXXXXXXX") .build(); interstitial.loadAd(adRequest); // So we can call stuff from static

SDL2: two displays, two windows and fullscreen mode

大憨熊 提交于 2019-12-22 14:57:11
问题 I'm trying to create two windows on two displays. But I have a problem: the second window is displayed in full screen mode, but the first window is minimized, and I need to click on it on the taskbar to expand to full screen. I create windows in loop with code: windows_data.window = SDL_CreateWindow("Title", SDL_WINDOWPOS_CENTERED_DISPLAY(i), SDL_WINDOWPOS_CENTERED_DISPLAY(i), width, height, SDL_WINDOW_FULLSCREEN_DESKTOP | SDL_WINDOW_SHOWN); Adding the flag SDL_WINDOW_MAXIMIZED does not solve

Is it safe/acceptable to call SDL_SetTextureColorMod every frame multiple times?

安稳与你 提交于 2019-12-21 20:54:40
问题 As a simple way to render multiple textures that are the same other than color I load a plain white circle in to an SDL_Texture then just call SDL_SetTextureColorMod() giving it the color I want to make the circle. This all works fine if the textures are individual (Example 1) but if I am sharing the SDL_Texture so that mutiple objects all reference it, it means that SDL_SetTextureColorMod() must be called every render frame before the object renders the texture since the color it gave last

How to use SDL_CreateTexture

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-21 18:34:30
问题 I would like to know ho to use SDL_CreateTexture function. I just want to create texture, give it a color and draw it somewhere on the screen. I dont wanna load any picture into it. I thought I can use SDL_CreateTexture, SDL_SetTextureColorMod, SDL_RenderCopy, SDL_RenderPresent in that order, but I always get just a black rectangle instead of red one . #include <SDL.h> int main(int argc, char* argv[]) { SDL_Init(SDL_INIT_EVERYTHING); SDL_Window *MainWindow = SDL_CreateWindow("My Game Window",

How to use SDL_CreateTexture

社会主义新天地 提交于 2019-12-21 18:34:06
问题 I would like to know ho to use SDL_CreateTexture function. I just want to create texture, give it a color and draw it somewhere on the screen. I dont wanna load any picture into it. I thought I can use SDL_CreateTexture, SDL_SetTextureColorMod, SDL_RenderCopy, SDL_RenderPresent in that order, but I always get just a black rectangle instead of red one . #include <SDL.h> int main(int argc, char* argv[]) { SDL_Init(SDL_INIT_EVERYTHING); SDL_Window *MainWindow = SDL_CreateWindow("My Game Window",

SDL2 strange behaviour of hardware rendering

不羁的心 提交于 2019-12-21 06:05:04
问题 I want to create my first game. Nothing special, just blue rectangle moving when WSAD keys are pressed. The problem is that when I run my game, there are bugs with rectangle(See image below). Bugs appears only during horizontal movement, and not vertical. Which is interesting, when I changed line: renderer = SDL_CreateRenderer(display, -1, SDL_RENDERER_ACCELERATED) to: renderer = SDL_CreateRenderer(display, -1, SDL_RENDERER_SOFTWARE) everything is OK I am using Windows 10, MinGw with CMake(C+

SDL2 Can't create window since it couldn't find matching GLX visual

感情迁移 提交于 2019-12-21 04:08:08
问题 I have a problem as i am currently running Ubuntu Terminal on Windows 10. I also have XMing installed as my X-server(I use XMing for qemu,etc...). And i am trying to run this SDL2 Program. So i have this for main.cpp: #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <SDL2/SDL.h> #include <GL/gl.h> int main(int argc, char *argv[]) { int final_status = 1; SDL_Window *window; SDL_GLContext openGL_context; if (SDL_Init(SDL_INIT_VIDEO)) { fprintf(stderr, "Unable to initialize

HOWTO draw circles, arcs and vector graphics in SDL?

只愿长相守 提交于 2019-12-20 20:46:29
问题 (I'm using SDL2) SDL is a relatively small library for "low level access to audio, keyboard, mouse, joystick, and graphics hardware via OpenGL and Direct3D" It's used for game development and, in my case, as simple audio visual output and mouse+keyboard input. It's not a "toolkit" like GTK, Qt, wxWindows, etc. But it is cross-platform. But the only way I can find to draw a shape is with the line, rect and pixel functions. Apart from using trig or the "equation of a circle", how could I draw a