sdl

Memory leak SDL while using SDL_CreateTextureFromSurface

懵懂的女人 提交于 2019-12-02 12:53:19
问题 I'm learning SDL and I've noticed that I have memory leak when I have this line in my code: m_TextureMap["napis"]= SDL_CreateTextureFromSurface( getRenderer(), textSurface ); I have SDL_FreeSurface(textSurface); right after the first one. When I comment out only this line, there's no memory leak. What am I doing wrong? Is there anything else I need to clean except for SDL_FreeSurface(textSurface) ? P.S. getRenderer is function that returns global SDL renderer, I use this function a lot in

Disable the Pygame console Output [duplicate]

本小妞迷上赌 提交于 2019-12-02 11:19:27
问题 This question already has answers here : Closed 7 years ago . Possible Duplicate: How to suppress console output in Python? Currently I am using pygame to read joystick input and I have the following issue that I need to solve. When calling functions in the joystick module such as get_axis() or get_button() the function prints out lines such as SDL_JoystickGetButton value:0: I need to disable the output of these lines to the console. I have found the following question/answer on stackoverflow

SDL_KEYDOWN and key recognition not working properly

懵懂的女人 提交于 2019-12-02 08:15:16
In my project I am having trouble getting a simple switch statement to work for SDL input. Here is the example: SDL_Event event; SDL_PollEvent(&event); if (event.type == SDL_KEYDOWN) { switch (event.key.keysym.sym) { case SDLK_a: m_x -= 30; break; case SDLK_d: m_x += 30; break; case SDLK_w: m_y -= 30; break; case SDLK_s: m_y += 30; break; } } When I run this, first off it seems SDL_KEYDOWN isn't being recognized. Nor are my cases. So I switched the code to: SDL_Event event; SDL_PollEvent(&event); if (event.type == 771) { switch (event.key.keysym.sym) { case SDLK_a: m_x -= 30; break; case SDLK

Strange Sound produced by ffmpeg and SDL

穿精又带淫゛_ 提交于 2019-12-02 08:00:42
问题 I'm following the updated version of the original dranger.com/ffmpeg tutorial at https://github.com/mpenkov/ffmpeg-tutorial The third step(Source code: https://github.com/mpenkov/ffmpeg-tutorial/blob/master/tutorial03.c) adds sound, but the sound produced is strange. When the audio stream is AAC I only hear static. When the audio stream is MP3 I hear a very high pitched version of the sound. What's wrong? 回答1: I've had the same exact issue. After days of trying, I figured out it was something

How to fix 'The procedure entry point SDL_RWclose could not be located in the dynamic link library'

让人想犯罪 __ 提交于 2019-12-02 07:06:10
问题 I'm trying to draw a png image to a window using the SDL_image extension, but it gives me an "Entry Point Not Found" error I'm using SDL (2.0.9) and SDL_Image (2.0.5) I've copied the following bin files to the executable directory libjpeg-9.dll libpng16-16.dll libtiff-5.dll libwebp-7.dll SDL2.dll SDL2_image.dll zlib1.dll main.cpp extract #include <iostream> #include <SDL.h> #include <SDL_image.h> int main( int argc, char* args[] ) { SDL_Texture* test_tex; SDL_Window* window = NULL; SDL

Strange Sound produced by ffmpeg and SDL

拜拜、爱过 提交于 2019-12-02 06:52:56
I'm following the updated version of the original dranger.com/ffmpeg tutorial at https://github.com/mpenkov/ffmpeg-tutorial The third step(Source code: https://github.com/mpenkov/ffmpeg-tutorial/blob/master/tutorial03.c ) adds sound, but the sound produced is strange. When the audio stream is AAC I only hear static. When the audio stream is MP3 I hear a very high pitched version of the sound. What's wrong? I've had the same exact issue. After days of trying, I figured out it was something wrong with the latest build that I was using from Zeranoe. If you are using Zeranoe builds as well, try

Disable the Pygame console Output [duplicate]

与世无争的帅哥 提交于 2019-12-02 06:36:44
Possible Duplicate: How to suppress console output in Python? Currently I am using pygame to read joystick input and I have the following issue that I need to solve. When calling functions in the joystick module such as get_axis() or get_button() the function prints out lines such as SDL_JoystickGetButton value:0: I need to disable the output of these lines to the console. I have found the following question/answer on stackoverflow which is what I'm looking for... How to suppress console output in Python? But this post does not supply enough information. Because if I have to turn off DEBUG, I

SDL

穿精又带淫゛_ 提交于 2019-12-02 05:42:16
SDL介绍 SDL(Simple DirectMedia Layer)是一套开放源代码的跨平台多媒体开发库,使用C语言写成。SDL提供了数种控制图像、声音、输出入的函数,让开发者只要用相同或是相似的代码就可以开发出跨多个平台(Linux、Windows、Mac OS X等)的应用软件。目前 SDL 多用于开发游戏、模拟器、媒体播放器等多媒体应用领域。 SDL(第一版)使用 GNU 宽通用公共许可证为授权方式,意指动态链接(dynamic link)其库并不需要开放本身的源代码。因此诸如《雷神之锤4》等商业游戏也使用SDL来开发。而第二版的SDL则改用Zlib授权来授权。 虽然 SDL 时常被比较为‘跨平台的 DirectX ’,然而事实上 SDL 是定位成以精简的方式来完成基础的功能,它大幅度简化了控制图像、声音、输出入等工作所需撰写的代码。但更高级的绘图功能或是音效功能则需搭配 OpenGL 和 OpenAL 等 API 来达成。另外它本身也没有方便创建图形用户界面的函数。 SDL 在结构上是将不同操作系统的库再包装成相同的函数,例如 SDL 在 Windows 平台上其实是 DirectX 的再包装,旧版本包装的是 DirectX 5,SDL 1.2 则是 DirectX 7 。而在使用 X11 的平台上(包括 Linux ),SDL 则是与 Xlib 库沟通来输出图像。 虽然

Memory leak SDL while using SDL_CreateTextureFromSurface

試著忘記壹切 提交于 2019-12-02 05:35:13
I'm learning SDL and I've noticed that I have memory leak when I have this line in my code: m_TextureMap["napis"]= SDL_CreateTextureFromSurface( getRenderer(), textSurface ); I have SDL_FreeSurface(textSurface); right after the first one. When I comment out only this line, there's no memory leak. What am I doing wrong? Is there anything else I need to clean except for SDL_FreeSurface(textSurface) ? P.S. getRenderer is function that returns global SDL renderer, I use this function a lot in other places and I'm sure it doesn't cause leak. m_TextureMap is just a map where I store textures

ffmpeg结合SDL编写播放器(三)

假如想象 提交于 2019-12-02 05:03:01
接下来是解析影片的帧 /*** project.c ***/ #include<stdio.h> #include<libavcodec/avcodec.h> #include<libavformat/avformat.h> #include<libswscale/swscale.h> void SaveFrame(AVFrame *pFrame, int width, int height, int iFrame) { FILE *pFile; char szFilename[32]; int y; //open file sprintf(szFilename,"frame%d.ppm",iFrame); pFile = fopen(szFilename, "wb"); if (NULL == pFile) return; //write header fprintf(pFile, "P6\n%d %d\n255\n",width,height); //write pixel data for (y = 0; y < height; y++) { fwrite(pFrame->data[0] + y * pFrame->linesize[0], 1, width * 3, pFile); } //close file fclose(pFile); } int main(int