sdl

Why does valgrind say basic SDL program is leaking memory?

假装没事ソ 提交于 2019-11-27 13:58:56
Here is the SDL program: #include <SDL/SDL.h> int main(int argc, char** argv){ SDL_Init(SDL_INIT_VIDEO); SDL_Surface* screen = SDL_SetVideoMode(640, 480, 16, SDL_HWSURFACE); SDL_Quit(); return 0; } Compiled with the command: g++ -o test test.cpp -lSDL And here is the output of valgrind: christian@christian-laptop:~/cpp/tetris$ valgrind --leak-check=full ./test ==3271== Memcheck, a memory error detector ==3271== Copyright (C) 2002-2009, and GNU GPL'd, by Julian Seward et al. ==3271== Using Valgrind-3.5.0-Debian and LibVEX; rerun with -h for copyright info ==3271== Command: ./test ==3271== =

Forcing Machine to Use Dedicated Graphics Card?

烈酒焚心 提交于 2019-11-27 13:42:01
I am part of a team developing an application using C++ with SDL and OpenGL. On laptops when the application is ran the dedicated graphics card is not used and the GL context fails to create because the integrated graphics card does not support the version of GL we want. I have a feeling that this problem is specific to the laptop in question and not something we can solve through code. But, if anyone knows if there is a solution that'd be great. Does it use NVidia dedicated graphics? AFAIK, the process of automatically switching from integrated to dedicated is based on application profiles.

_Block_Type_Is_Valid (pHead->nBlockUse) Error

回眸只為那壹抹淺笑 提交于 2019-11-27 12:58:25
问题 I been working in a new project but I encounter with a problem which I can't see why fail. When I perfom this line delete textY give me the error _Block_Type_Is_Valid (pHead->nBlockUse). So what am I doing wrong? This is the source code: Text.h #ifndef TEXT_H #define TEXT_H typedef boost::shared_ptr<Font> FontPtr; class Text { public: Text(FontPtr font, char *text) { str = new char[35]; this->font = font; str = text; } Text(const Text& cSource); Text& operator=(const Text& cSource); ~Text();

error LNK2019: unresolved external symbol _main referenced in function ___tmainCRTStartup, but this time it's NOT a Windows/Console problem!

☆樱花仙子☆ 提交于 2019-11-27 11:28:18
问题 So, the infamous error is back. The project is complaining that it can't find the main() method (that's what the error means, right). However I do have a main, and my project is a Console project, as it should be. It worked before, so I know it's not that. Also, the project has too many classes and files for me to post them all, so I will post any classes you need by request. It's a C++, OpenGL and SDL game on Visual Studio 2010. It's not a problem of any of the libraries, as it was working

Difference between surface and texture (SDL / general)

ⅰ亾dé卋堺 提交于 2019-11-27 10:54:46
Can anyone explain to me in simple words what is the difference between texture and surface? I saw it used in SDL2 as SDL_Surface and SDL_Texture . SDL_Texture is created from SDL_Surface which in turn is created from image/bitmap. Both are collection of pixels. But I do not see the main difference between them (has to do something with GPU?) I tried to google it but all explanations I found were too complex to understand them without digging deeper into computer graphics stuff. Petr Abdulin Basically your assumption "has to do something with GPU?" is right. SDL_Surface is used in software

mingw32环境上静态编译 dav1d 0.4.0

喜欢而已 提交于 2019-11-27 10:01:11
2019-08-05 发布 dav1d 0.4.0 dav1d 0.4.0 'Cheetah', the fast and small AV1 decoder This is the fourth major release of dav1d, the fast and small AV1 decoder, codename 'Cheetah'. It supports all the AV1 features and all bitdepths. 0.4.0 brings large improvements in speed on ARM64 (up to 25% speedup) and minor improvements on SSE and ARM. It also improves the RAM usage quite significantly, sometimes more than halving the RAM used. mingw32环境上静态编译 dav1d 0.4.0 export CC=/mingw/bin/gcc export CXX=/mingw/bin/g++ meson --prefix "/usr/local" build --buildtype release --default-library static ninja -C

How to suppress console output in Python?

杀马特。学长 韩版系。学妹 提交于 2019-11-27 08:01:37
I'm using Pygame/SDL's joystick module to get input from a gamepad. Every time I call its get_hat() method it prints to the console. This is problematic since I use the console to help me debug and now it gets flooded with SDL_JoystickGetHat value:0: 60 times every second. Is there a way I can disable this? Either through an option in Pygame/SDL or suppress console output while the function calls? I saw no mention of this in the Pygame documentation. edit: This turns out to be due to debugging being turned on when the SDL library was compiled. Here's the relevant block of code from joystick.c

SDL2: Fast Pixel Manipulation

怎甘沉沦 提交于 2019-11-27 07:54:01
I want to draw pixels on the monitor which change frequently after certain parameters. E.G. if a Red and Green Pixel collide, they would both vanish, etc. In every frame I have to manipulate about 100 - 1000 pixels. I have a multi-threaded approach here, which wont give me 30FPS (what I want). Currently I store a Pixel array in the RAM which contains all Pixels and have a SDL_Surface . When a pixel in the array changes, it gets changed in the Surface too and is then after all manipulation is done gets blitted to the screen. My current approach is too slow and I did a bit of thinking on how I

Undefined reference to 'SDL_main'

删除回忆录丶 提交于 2019-11-27 06:58:30
问题 I've recently decided to try working with SDL with CodeBlocks 10.05. I started with the tutorial on http://www.sdltutorials.com/sdl-tutorial-basics and did my best to follow it. Unfortunately, I'm encountering: ..\..\..\..\..\..\SDL\SDL-1.2.15\lib\libSDLmain.a(SDL_win32_main.o):SDL_win32_main.c|| undefined reference to `SDL_main'| when I try to compile it. I've searched through many of the questions on this website and other tutorials (mainly the tutorial on LazyFoo and the CodeBlocks wiki)

How do you get a minimal SDL program to compile and link in visual studio 2008 express?

我们两清 提交于 2019-11-27 06:53:52
问题 I'm trying to use SDL in C++ with Visual Studio 2008 Express. The following program compiles but does not link: #include <SDL.h> int main(int argc, char *argv[]) { return 0; } The link error is: LINK : fatal error LNK1561: entry point must be defined I get this regardless of how or if I link with SDL.lib and SDLmain.lib. Defining main as main() or SDL_main() gives the same error, with or without extern "C" . Edit: I solved this by not including SDL.h in main.cpp - a refactoring I did