SDL2 source code analysis 8: video display summary, sdl2 source codeThis article briefly summarizes the source code of the SDL video.The structure of the SDL display video involves the following structure:
SDL_Window: indicates the window
SDL_Renderer: indicates the Renderer.
SDL_Texture: represents the texture
SDL_Rect: a rectangular box used to determine the position of the texture display.
Shows th
This document records the Audio Playback Technology of SDL. The version used here is sdl2. In fact, SDL does not provide the video/audio playback function. It only encapsulates the underlying API for video/audio playback. On Windows, SDL encapsulates direct3d APIs for video playback and directsound APIs for audio playback. Because SDL is designed to simplify the development of video and audio playback, it is very easy to Use SDL to play video (YUV/RGB
This is a creation in
Article, where the information may have evolved or changed.
Learning Golang for a period of time, from no clue to everywhere, and then to the rest of the peace of mind to study SDL2 also have a small six months.
Tonight refactoring before the study code, found that if you do not write the article, may later review this time to write the code to spend time, so this article to do a bit of code on the mark, and for Will learn Golang
This stage completes the ffplay transplant to SDL2, the basic test on the PC: Picture, video OK.API 1.2Sdl_surface *screen;Screen = Sdl_setvideomode (w, h, 0, flags);Sdl_wm_setcaptionSdl_fillrectScreen->format, W, hSdl_updaterectSdl_overlay *bmp;Sdl_createyuvoverlay (screen);Sdl_lockyuvoverlayBmp->pixels[i],pitches[i]//video_thread-->queue_picture; Video_image_display-->blend_subrectVideo_refresh-->video_display-->video_image_displaySdl_displayyuvover
Promotion Ffplay + SDL2 + vs2010
SDL2 modified and added a part of the interface, and increased the support of the opponent's system platform (IOS,ANDRIOD), the display part of the change is larger, and not backward-compatible, specific reference to the official http://wiki.libsdl.org/MigrationGuide# Other_renderer_api_notes
Here is a demo using SDL2 to display
Ubuntu14.04 C ++ to develop SDL2 applications, ubuntu14.04sdl2
1. Download and install
Go to http://www.libsdl.org/download http://www.libsdl.org/release/sdl2-2.0.3.zipsource code
Decompress the package
./Configure
Make
Sudo make install
Check
Header file:/usr/local/include/SDL2
Library location:/usr/local/lib
2. Create a test program:
# Include
3. Compile the
1 Download and installTo http://www.libsdl.org/download Http://www.libsdl.org/release/SDL2-2.0.3.zip source codeAfter decompression./configureMakesudo make installCheckHeader file:/USR/LOCAL/INCLUDE/SDL2Library Location:/usr/local/lib2 Establishing the test procedure:#include 3 Write the compiled command build file, as follows:g++ Sdl_app1.cpp-i/usr/local/include/sdl2-l/usr/local/lib-lsdl2-lpthreadTo set ex
Environment: SDL2 + vc++2015The following code will open Background.bmp and image.bmp, tile the background background, and render the image as a foreground1#include 2#include"SDL.h"3 4 //Screen Width5 Const intScreen_width =640;6 Const intScreen_height =480;7 8 //Global window and renderer9Sdl_window *window =nullptr;TenSdl_renderer *renderer =nullptr; One A //Loading Pictures -sdl_texture* LoadImage (std::stringfile) - { theSdl_surface *loadedimage
In fact, there is no need to say too complicated ... is to read user input.Follow the previous code to join the event polling.Environment: SDL2 + vc++2015The following code will open Background.png and event.png and will background tile the background and render the event as a foreground.1#include 2#include string>3#include 4#include"SDL.h"5#include"sdl_image.h"6 7 //Screen Width8 Const intScreen_width = the;9 Const intScreen_height = the;Ten One //G
Date: 2016.10.4Author: issheGithub:github.com/issheE-mail: i.sshe@outlook.comPlatform: ubuntu16.04 64bit 1. Preface
So far, we have learned and recorded the contents of the FFMPEG+SDL2 display video and events (event).This record FFMPEG+SDL2 play audio, did not join the event processing.Next add the event processing and continue to learn the audio and video synchronization, and then added a pause or the lik
Label: SDL direct3d OpenGL texture The previous article analyzed the sdl_createrenderer () function used to create a Renderer in SDL (). This article continues to analyze the source code of SDL. This document analyzes the SDL texture (sdl_texture ).
The code process for playing a video by using SDL is as follows.
Initialization:
Sdl_init (): Initialize SDL.
Sdl_createwindow (): create a window ).
Sdl_createrenderer (): Creates a Renderer (render) based on the window ).
Sdl
SDL2 source code analysis 4: texture (SDL_Texture), sdl2sdl_textureThe previous article analyzed the SDL_CreateRenderer () function used to create a Renderer in SDL (). This article continues to analyze the source code of SDL. This document analyzes the SDL texture (SDL_Texture ).The code process for playing a video by using SDL is as follows.Initialization:
SDL_Init (): Initialize SDL.
SDL_CreateWindow (): create a Window ).
SDL_CreateRenderer (
After printing the picture, it's time to print the text. This refers to the SDL Font extension library, sdl2_ttf.lib, which needs to include the corresponding header file.Environment: SDL2 + vc++2015The following code prints a paragraph of text in the window and responds to the corresponding action.This time, the error has been streamlined and the code looks fresher.1#include 2#include"SDL.h"3#include"sdl_ttf.h"4 5 intMainintargcChar**argv)6 {7 //
These days in the use of SDL2, has not been wrong, until the morning to move the project a place. The result always appears "error LNK2019: unresolved external symbol _sdl_main, which is referenced in function _main."Look at the online method is said to have not correctly defined the main function, which is the SDL2main.lib to specify the required function. As a result, I defined him in a header file like "Xx.h".I never understood the important differ
This article introduces an example of Android with SDL2 to achieve a simple gobang game, to share with you for your reference, the specific contents are as follows
1. five.c
FIVE.C//SDL2 Gobang//gcc-mwindows-o Five five.c fivedata.c Fivedata.h-lsdl2-lsdl2main-lsdl2_image-lsdl2_ttf #define _DEBUG_ #include
2.fivedata.c
FIVEDATA.C//Gobang: Data processing module #include "FiveData.h"//pu
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.