Questions tagged [sdl-2]

For questions and issues regarding Simple DirectMedia Layer 2 (SDL2). If you're using SDL 1.2, use tag [sdl-1.2]. If you're questioning the library in general, use tag [sdl].

Simple DirectMedia Layer 2.0 (SDL2) is the second generation of a popular open source cross-platform library that provides a simple interface to graphics, sound, and input devices. The new version comes with lots of new features such as full 3D hardware acceleration and the less restrictive zlib license.

Resources:

2910 questions
0
votes
0 answers

Why are my SDL2 textures taking up so much space?

Wrote a program in OpenCV, however it doesn't have comfortable canvas, so working with it is a pain in the neck for my purpose, decided to migrate to SDL2. Noticed the RAM usage is 3 times as high. For the dataset of 37 images OpenCV takes up 440mb,…
Elmontov
  • 11
  • 4
0
votes
0 answers

Create a Sprite struct to hold an SDL surface and texture

New to rust, I'm trying my hand at a simple sdl project. I want to create a Sprite struct to hold the surface & texture to display a simple image. My attempt so far: pub struct Sprite<'a> { //surface : sdl2::surface::Surface<'a>, texture :…
Jaffa
  • 12,442
  • 4
  • 49
  • 101
0
votes
2 answers

How does SDL_SetTextureColorMod formula work?

I found that formula of SDL_SetTextureColorMod is srcC = srcC * (color / 255). But what happens when (color / 255) is not a int. I do not understand how it wokrs. PLease help me.
0
votes
1 answer

How to check if two rectangles overlap in SDL2?

I am creating a game using SDL2 which creates 200 objects of a class Star and prints onto the screen all 200 as 2px x 2px rects in random locations. I created a player class which creates a 10px x 10px rect that can be moved using WASD. I created a…
0
votes
1 answer

OCR : why are my results worse when i apply a median filter?

I am currently developing an OCR for a sudoku and i am trying to first get a clean black and white image. I first apply a grayscale then a median filter then an otsu algorithm. My problem is that my results are better when i dont apply my median…
0
votes
1 answer

Why there is no SDLK_COLON equivalent scancode in SDL2?

I'm trying to check if the colon key is pressed, I'm using a English keyboard which means colon is shift + ;, my though was to read the keyboard state and then check the status of the scancode: SDL_PumpEvents(); const uint8 *keyState =…
Hugo
  • 2,139
  • 4
  • 22
  • 30
0
votes
2 answers

MSYS2 and SDL2, distributing binary?

I just compiled a SDL2 program in MSYS2 and would like to distribute a binary copy of the program in a ZIP file. But to run the program in "Normal" Windows I have to copy a long list of DLLs from /mingw64/bin. Is there a better way of doing this?…
Dacobi
  • 417
  • 4
  • 14
0
votes
0 answers

SDL2 opens no window without giving any errors

I'm trying to test a simple SDL2 application. The app runs without any errors. However, no window shows up. I'm using Ubuntu18.04 on a VMWare machine. I also tried to compile SDL from the source but got the same result. I am unsure if the cause of…
Masoud Rahimi
  • 5,785
  • 15
  • 39
  • 67
0
votes
0 answers

how to freeze and unfreeze the game loop?

i have a game loop, i want to be able to make it temporary stop and then make it run again. I TRIED to freeze and unfreeze the game by passing a boolean variable by reference to void functions, which their job is to set the variables value to true…
no_hope
  • 39
  • 5
0
votes
1 answer

SDL_BlitSurface() blackscreen

I'm trying to put an imagine on surface. So it's showed a black screen when I'm load BMP and display bmp here's my code: #define SDL_MAIN_HANDLED #include #include "SDL/include/SDL2/SDL.h" const int screenWidth=640; const int…
Solirous
  • 3
  • 2
0
votes
0 answers

I can't access my main when I include the SDL_image.h

This is my code: #include #include #include #include const int WIDTH = 800, HEIGHT = 600; int main( int argc, char *argv[] ) { std::cout << "can't access main\n"; if…
0
votes
1 answer

How to include font file / assets folder to rust binary

I am trying to build a rust game that requires text rendering. The way that I found is: let font:&Font = &ttf_context.load_font(FONT_PATH, 128)?; My issue is that this requires the built binary to need to have the font file. What I want is for the…
Henhen1227
  • 392
  • 1
  • 3
  • 12
0
votes
0 answers

SDL.h: No such file or directory, SDL_image.h: No such file or directory VS Code

I am struggling with compiling my program using SDL and SDL_image libraries with MinGW. When I try to build my program I always get these errors. I've already tried two methods: manually install (this one showed me same errors but I was able to…
kurkurindd
  • 23
  • 4
0
votes
1 answer

Render Text in SDL using C#

I am using SDL to render graphics like lines and pixels using C#. I have to display some text on screen as well. I haven't found any resource on this topic on the internet. Most of the code that I wrote is translated from C++. Now I need to render…
Farid-ur-Rahman
  • 1,809
  • 9
  • 31
  • 47
0
votes
0 answers

Using CLion to develop SDL2 programs, worked well in the IDE but got 0xc000007b error when opening it in the cmd/file explorer

I'm following Lazy Foo's tutorials, using CLion to develop SDL2 programs. When I build executable files in CLion, it worked well and ran correctly. But when I tried to run the exe file in the cmd, it showed me an 0xc000007b error. The same error…
CrazyAuF3
  • 1
  • 1
1 2 3
99
100