参照国内最容易搜到的中文教程,一些讲解就在注释里了
#include "SDL.h" #include <iostream> #include <Windows.h> int main(int argc,char**argv) { // 初始化SDL的“一切”,不成功main返回-1,本例均如此 if (SDL_Init(SDL_INIT_EVERYTHING) == -1) { std::cout << SDL_GetError() << std::endl; return 1; } // 创建窗口指针 SDL_Window *win = nullptr; win = SDL_CreateWindow("First SDL Program!!",100,100,800,600,SDL_WINDOW_SHOWN); if (win == nullptr) { std::cout << SDL_GetError() << std::endl; return 1; } // 创建SDL Renderer(渲染器)指针 SDL_Renderer *ren = nullptr; // 参数分别为:指定窗口,自动选择显卡驱动,使用图形加速|以显示器频率同步 ren = SDL_CreateRenderer(win,-1,SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC); if (ren == nullptr) { std::cout << SDL_GetError() << std::endl; return 1; } // 创建SDL_Surface,用于载入图像 SDL_Surface *bmp = nullptr; bmp = SDL_LoadBMP("image.bmp"); if (bmp == nullptr) { std::cout << SDL_GetError() << std::endl; return -1; } // 创建SDL_Texture(材质) SDL_Texture *tex = nullptr; tex = SDL_CreateTextureFromSurface(ren,bmp); SDL_FreeSurface(bmp); // 清空屏幕,绘图,刷新屏幕 SDL_RenderClear(ren); SDL_RenderCopy(ren,tex,NULL,NULL); SDL_RenderPresent(ren); // 延迟4秒后关闭窗口 SDL_Delay(4000); // 释放内存 SDL_DestroyTexture(tex); SDL_DestroyRenderer(ren); SDL_DestroyWindow(win); // 退出 SDL_Quit(); return 0; }
补充:
窗口标题无法显示中文。
2018年11月29日 11:39
A free quantum of the products is launched for the goodness and all apparent roles for the humans. The right use of the term and ukessays is vital for the humans. The reflection is inquired for the flow of the terms for the humans in various offers for the partners in the field.
2019年10月12日 20:00
We offer best cleansing services within abu dhabi, we now have professional cleansing staff within our company, we usually give much more importance as well as preference to the customers, we now have thousands associated with happy clients in abu dhabi, we always play the role of best cleansing services organization in abu dhabi and throughout UAE.
2021年9月13日 17:34
We have now a workforce of professionals who definitely are well trained in the field of housekeeping. There're experienced in addition to efficient in each and every house drag. You can certainly hire some sort of part-time housemaid with Dubai or based on the daily chores decide on full-time maids in Dubai. As a result of us, you're free to unlock many cleaning products and services.
2021年9月27日 17:21
Supplying your washing services to be able to high targeted traffic stores which usually require everyday cleaning can cause an also higher amount, consistent earnings stream. Going door-to-door inside the shopping district can cause clients, but will probably be time-intensive. In the event you hire any commissioned salesperson to be effective on developing this business it can easily limit the immediate expenditure because of this legwork and be extremely profitable inside the long-run.
2023年8月26日 17:07
Top quality is relative to the value. If the consumer believes the painting appraisal is also low chances are they might believe the color contractor will be either lower balling, inexperienced or perhaps cutting charges by cheapening the work for some reason or one more. The customer will likely then believe they are not getting the best value from in which paint estimate and definately will not yet from in which contractor even when the price is leaner.
2025年2月26日 18:26
Please let me know if you’re looking for a article writer for your site. You have some really great posts and I feel I would be a good asset. If you ever want to take some of the load off, I’d absolutely love to write some material for your blog in exchan
2025年2月26日 19:30
Great post i must say and thanks for the information. Education is definitely a sticky subject. However, is still among the leading topics of our time. I appreciate your post and look forward to more. i am for
2025年2月26日 19:30
Hey there! I could have sworn I’ve been to this website before but after reading through some of the post I realized it’s new to me. Nonetheless, I’m definitely happy I found it and I’ll be book-marking and checking back frequently
2025年2月26日 19:31
Best work you have done, this online website is cool with great facts and looks. I have stopped at this blog after viewing the excellent content. I will be back for more qualitative work.Whenever I have some free time, I visit blogs to get some useful info. Today, I found your blog with the help of Google. Believe me; I found it one of the most informative blog.
2025年2月26日 19:32
I really enjoyed reading this post, big fan. Keep up the good work andplease tell me when can you publish more articles or where can I read more on the subject? I really appreciate this wonderful post that you have provided for us. I assure this would be beneficial for most of the people. Great info! I recently came across your blog and have been reading along. I thought I would leave my first comment. I don’t know what to say except that I have.
2025年2月26日 19:32
Thanks for a very interesting blog. What else may I get that kind of info written in such a perfect approach? I’ve a undertaking that I am simply now operating on, and I have been at the look out for such info. Good This is truly a great read for me. I have bookmarked it and I am looking forward to reading new articles. Keep up the good work!.
2025年2月26日 19:32
I admire this article for the well-researched content and excellent wording. I got so involved in this material that I couldn’t stop reading. I am impressed with your work and skill. Thank you so much. I haven’t any word to appreciate this post.....Really i am impressed from this post....the person who create this post it was a great human..thanks for shared this with us.
2025年2月26日 19:33
Hey there! I could have sworn I’ve been to this website before but after reading through some of the post I realized it’s new to me. Nonetheless, I’m definitely happy I found it and I’ll be book-marking and checking back frequently
2025年2月26日 19:33
It is perfect time to make some plans for the future and it is time to be happy. I've read this post and if I could I desire to suggest you some interesting things or suggestions. Perhaps you could write next articles referring to this article. I want to read more things about it!
2025年2月26日 19:34
Hey there! I could have sworn I’ve been to this website before but after reading through some of the post I realized it’s new to me. Nonetheless, I’m definitely happy I found it and I’ll be book-marking and checking back frequently
2025年2月26日 19:37
Excellent post. I was always checking this blog, and I’m impressed! Extremely useful info specially the last part, I care for such information a lot.
2025年2月26日 19:44
Every one of the substance you said in post is too great and can be extremely helpful. I will remember it, much obliged for sharing the data continue upgrading, looking forward for more posts.Thanks . Decent to be going to your web journal once more, it has been months for me. Well this article i’ve been sat tight for so long. I require this article to finish my task in the school, and it has same theme with your article. Much obliged, awesome offer. This is such an extraordinary asset, to the point that you are giving and you give it away for nothing. I cherish seeing sites that comprehend the benefit of giving a quality asset to free. It is the old what circumvents comes around schedule
2025年2月26日 19:45
stunning, great, I was wondering how to cure skin break out ordinarily. likewise, found your site by google, took in an extraordinary arrangement, now i'm fairly clear. I've bookmark your site and moreover incorporate rss. keep us invigorated.Terrific review, among the list of much better articles Truly go through these days on the net, I recommend to all or any.
2025年2月26日 19:45
I’m excited to uncover this page. I need to to thank you for ones time for this particularly fantastic read!! I definitely really liked every part of it and i also have you saved to fav to look at new information in your site. I’ve read some good stuff here. Definitely worth bookmarking for revisiting. I surprise how much effort you put to create such a great informative website. Thumbs up guys your doing a really good job.
2025年2月26日 19:45
It is perfect time to make some plans for the future and it is time to be happy. I've read this post and if I could I desire to suggest you some interesting things or suggestions. Perhaps you could write next articles referring to this article. I want to read more things about it!
2025年2月26日 19:46
Our headquarter is in Philadelphia, PA. We have a global existence, operating in the USA, UK, Asia, and Australia. We are serving our clients all over the globe. Regardless of different time zones, our team manages to facilitate and collaborate with them to deliver high-quality services.
2025年2月26日 19:46
I can see that you are an expert at your field! I am launching a website soon, and your information will be very useful for me.. Thanks for all your help and wishing you all the success in your business. I am happy to find your distinguished way of writing the post. Now you make it easy for me to understand and implement the concept. Thank you for the post.
2025年2月26日 19:46
It is perfect time to make some plans for the future and it is time to be happy. I've read this post and if I could I desire to suggest you some interesting things or suggestions. Perhaps you could write next articles referring to this article. I want to read more things about it!
2025年2月26日 19:48
A fascinating dialog is value remark. I feel that it is best to compose more on this matter, it may not be an unthinkable theme however generally people are insufficient to chat on such subjects. To the following.
2025年2月26日 20:09
I am wondering how I might be notified whenever a new post has been made. I have subscribed to your RSS which may do the trick? Have a great day!
2025年2月26日 20:24
I could have sworn I’ve been to this website before but after reading through some of the post. I feel that it is best to compose more on this matter, it may not be an unthinkable theme however generally people are
2025年2月26日 20:29
"Excellent post. I was always checking this blog, and I’m impressed! Extremely useful info specially the last part, I care for such information a lot. I was exploring this particular info for a long time. Thanks to this blog my exploration has ended.The problem we struggled with was how to provide more assistance
to those in need without the resources to create more bed space."
2025年2月26日 20:37
I could have sworn I’ve been to this website before but after reading through some of the post. I feel that it is best to compose more on this matter, it may not be an unthinkable theme however generally people are insufficient to chat on such subjects.
2025年2月26日 20:39
you will come to the right place, Feel free to contact me I see some amazingly important and kept up to length of your strength searching for in your on the site