锘??xml version="1.0" encoding="utf-8" standalone="yes"?>国产亚洲成av人在线观看导航,在线不卡a资源高清,在线精品福利 http://www.shnenglu.com/qxtianlong/archive/2015/09/03/211750.html鏂潌鐮存灙澶?/dc:creator>鏂潌鐮存灙澶?/author>Thu, 03 Sep 2015 13:04:00 GMT http://www.shnenglu.com/qxtianlong/archive/2015/09/03/211750.html http://www.shnenglu.com/qxtianlong/comments/211750.html http://www.shnenglu.com/qxtianlong/archive/2015/09/03/211750.html#Feedback 0 http://www.shnenglu.com/qxtianlong/comments/commentRss/211750.html http://www.shnenglu.com/qxtianlong/services/trackbacks/211750.html 闃呰鍏ㄦ枃 ]]> TextureManager綆$悊 http://www.shnenglu.com/qxtianlong/archive/2014/12/13/209178.html鏂潌鐮存灙澶?/dc:creator>鏂潌鐮存灙澶?/author>Sat, 13 Dec 2014 10:56:00 GMT http://www.shnenglu.com/qxtianlong/archive/2014/12/13/209178.html http://www.shnenglu.com/qxtianlong/comments/209178.html http://www.shnenglu.com/qxtianlong/archive/2014/12/13/209178.html#Feedback 0 http://www.shnenglu.com/qxtianlong/comments/commentRss/209178.html http://www.shnenglu.com/qxtianlong/services/trackbacks/209178.html
1 /*
2 * TextureManager.h
3 *
4 * Created on: 2014騫?2鏈?3鏃?br />
5 * Author: wgzll
6 */
7
8 #ifndef SRC_TEXTUREMANAGER_H_
9 #define SRC_TEXTUREMANAGER_H_
10
11 #include <iostream>
12 #include <string >
13 #include <map>
14 #include <sdl2/sdl.h>
15
16 using namespace std;
17
18 class TextureManager
19 {
20 public :
21 static TextureManager* Instance()
22 {
23 if (s_pInstance == 0)
24 {
25 s_pInstance = new TextureManager();
26 return s_pInstance;
27 }
28
29 return s_pInstance;
30 }
31
32 bool load(string fileName,string id,SDL_Renderer* pRenderer);
33 void draw(string id,int x,int y,int width,int height,SDL_Renderer* pRenderer,SDL_RendererFlip flip=SDL_FLIP_NONE);
34 void drawFrame(string id,int x,int y,int width,int height,int currentRow,int currentFrame,SDL_Renderer* pRenderer,double angle,int alpha,SDL_RendererFlip flip=SDL_FLIP_NONE);
35
36 map<string ,SDL_Texture*> getTextureMap(){return m_textureMap;}
37
38 public :
39 TextureManager(){}
40 ~TextureManager(){}
41 private :
42 map<string ,SDL_Texture*> m_textureMap;
43 static TextureManager* s_pInstance;
44
45 };
46
47 typedef TextureManager TheTextureManager;
48
49
50 #endif /* SRC_TEXTUREMANAGER_H_ */
51
1 /*
2 * TextureManager.cpp
3 *
4 * Created on: 2014騫?2鏈?3鏃?br />
5 * Author: wgzll
6 */
7
8 #include "TextureManager.h"
9 #include <sdl2/sdl.h>
10 #include <sdl2/sdl_image.h>
11
12 TextureManager* TextureManager::s_pInstance = 0;
13
14 bool TextureManager::load(string fileName,string id,SDL_Renderer* pRenderer)
15 {
16 SDL_Surface* pTempSurface = IMG_Load(fileName.c_str());
17
18
19 if (pTempSurface == 0)
20 {
21 cout<<IMG_GetError();
22 return false ;
23 }
24
25 SDL_Texture* pTexture = SDL_CreateTextureFromSurface(pRenderer,pTempSurface);
26
27 SDL_FreeSurface(pTempSurface);
28
29 if (pTexture != 0)
30 {
31 m_textureMap[id] = pTexture;
32 return true ;
33 }
34 return false ;
35 }
36
37 void TextureManager::draw(string id, int x, int y, int width, int height, SDL_Renderer* pRenderer, SDL_RendererFlip flip)
38 {
39 SDL_Rect srcRect;
40 SDL_Rect destRect;
41
42 srcRect.x = 0;
43 srcRect.y = 0;
44 srcRect.w = destRect.w = width;
45 srcRect.h = destRect.h = height;
46 destRect.x = x;
47 destRect.y = y;
48
49 SDL_RenderCopyEx(pRenderer, m_textureMap[id], &srcRect, &destRect, 0, 0, flip);
50 }
51
52 void TextureManager::drawFrame(string id, int x, int y, int width, int height, int currentRow, int currentFrame, SDL_Renderer *pRenderer, double angle, int alpha, SDL_RendererFlip flip)
53 {
54 SDL_Rect srcRect;
55 SDL_Rect destRect;
56 srcRect.x = width * currentFrame;
57 srcRect.y = height * currentRow;
58 srcRect.w = destRect.w = width;
59 srcRect.h = destRect.h = height;
60 destRect.x = x;
61 destRect.y = y;
62
63 SDL_SetTextureAlphaMod(m_textureMap[id], alpha);
64 SDL_RenderCopyEx(pRenderer, m_textureMap[id], &srcRect, &destRect, angle, 0, flip);
65 }
66
]]> SDL2綺劇伒鍔ㄧ敾 http://www.shnenglu.com/qxtianlong/archive/2014/12/13/209177.html鏂潌鐮存灙澶?/dc:creator>鏂潌鐮存灙澶?/author>Sat, 13 Dec 2014 08:11:00 GMT http://www.shnenglu.com/qxtianlong/archive/2014/12/13/209177.html http://www.shnenglu.com/qxtianlong/comments/209177.html http://www.shnenglu.com/qxtianlong/archive/2014/12/13/209177.html#Feedback 0 http://www.shnenglu.com/qxtianlong/comments/commentRss/209177.html http://www.shnenglu.com/qxtianlong/services/trackbacks/209177.html
SDL_Surface* pTempSurface = SDL_LoadBMP("image/animate.bmp");
// SDL_Surface* pTempSurface = IMG_Load("image/animate.png");
// SDL_Surface* pTempSurface = IMG_Load("image/animate-alpha.png");
SDL_SetRenderDrawColor(m_pRenderer,255,0,0,255);
m_pTexture = SDL_CreateTextureFromSurface(m_pRenderer,pTempSurface);
SDL_FreeSurface(pTempSurface);
SDL_QueryTexture(m_pTexture,NULL,NULL,&m_sourceRectangle.w,&m_sourceRectangle.h);
m_sourceRectangle.w=128;
m_sourceRectangle.h=82;
void Game::update()
{
m_sourceRectangle.x = 128 * int (((SDL_GetTicks()/100)%6));
}
鎴浘濡備笅: 濡備綍鍋氬埌鍥劇墖緲昏漿鐨勫憿1 void Game::render()2 {3 SDL_RenderClear(m_pRenderer);4 // SDL_RenderCopy(m_pRenderer,m_pTexture,&m_sourceRectangle,&m_destinationRectangle); 5 // SDL_RenderCopy(m_pRenderer,m_pTexture,NULL,NULL); 6 SDL_RenderCopyEx(m_pRenderer,m_pTexture,&m_sourceRectangle,&m_destinationRectangle,0,NULL,SDL_FLIP_HORIZONTAL);//姝ゅ彞璧風殑浣滅敤7 SDL_RenderPresent(m_pRenderer);8 }
]]> SDL2璐村浘鍒濇帰1 http://www.shnenglu.com/qxtianlong/archive/2014/12/13/209174.html鏂潌鐮存灙澶?/dc:creator>鏂潌鐮存灙澶?/author>Sat, 13 Dec 2014 04:35:00 GMT http://www.shnenglu.com/qxtianlong/archive/2014/12/13/209174.html http://www.shnenglu.com/qxtianlong/comments/209174.html http://www.shnenglu.com/qxtianlong/archive/2014/12/13/209174.html#Feedback 0 http://www.shnenglu.com/qxtianlong/comments/commentRss/209174.html http://www.shnenglu.com/qxtianlong/services/trackbacks/209174.html
鍦板潃:http://wiki.libsdl.org/SDL_CreateRenderer
#include "SDL.h"
int main(int argc, char *argv[]) {
SDL_Window *win = NULL;
SDL_Renderer *renderer = NULL;
SDL_Texture *bitmapTex = NULL;
SDL_Surface *bitmapSurface = NULL;
int posX = 100, posY = 100, width = 320, height = 240;
SDL_Init(SDL_INIT_VIDEO);
win = SDL_CreateWindow("Hello World", posX, posY, width, height, 0);
renderer = SDL_CreateRenderer(win, -1, SDL_RENDERER_ACCELERATED);
bitmapSurface = SDL_LoadBMP("img/hello.bmp");
bitmapTex = SDL_CreateTextureFromSurface(renderer, bitmapSurface);
SDL_FreeSurface(bitmapSurface);
while (1) {
SDL_Event e;
if (SDL_PollEvent(&e)) {
if (e.type == SDL_QUIT) {
break ;
}
}
SDL_RenderClear(renderer);
SDL_RenderCopy(renderer, bitmapTex, NULL, NULL);
SDL_RenderPresent(renderer);
}
SDL_DestroyTexture(bitmapTex);
SDL_DestroyRenderer(renderer);
SDL_DestroyWindow(win);
SDL_Quit();
return 0;
}
涓嬮潰鐪嬬湅SDL Game Development緇欏嚭鐨勪唬鐮侊紝鎴戞憳褰曚簡涓灝忔
if (m_pRenderer != 0)
{
cout<<"renderer creation success\n";
SDL_SetRenderDrawColor(m_pRenderer,0,0,0,255);
m_pTexture = SDL_CreateTextureFromSurface(m_pRenderer,pTempSurface);
SDL_FreeSurface(pTempSurface);
SDL_QueryTexture(m_pTexture,NULL,NULL,&m_sourceRectangle.w,&m_sourceRectangle.h);
m_sourceRectangle.w=50;
m_sourceRectangle.h=50;
m_destinationRectangle.x=m_sourceRectangle.x=0;
m_destinationRectangle.y=m_sourceRectangle.y=0;
m_destinationRectangle.x=100;
m_destinationRectangle.y=100;
m_sourceRectangle.x=50;
m_sourceRectangle.y=50;
m_destinationRectangle.w=m_sourceRectangle.w;
m_destinationRectangle.h=m_sourceRectangle.h;
}
1 void Game::render()
2 {
3 SDL_RenderClear(m_pRenderer);
4 // SDL_RenderCopy(m_pRenderer,m_pTexture,&m_sourceRectangle,&m_destinationRectangle);
5 SDL_RenderCopy(m_pRenderer,m_pTexture,NULL,NULL);
6 SDL_RenderPresent(m_pRenderer);
7 }
鎴浘濡備笅: ]]> Eclipse+sdl2.0鐜閰嶇疆 http://www.shnenglu.com/qxtianlong/archive/2014/12/10/209149.html鏂潌鐮存灙澶?/dc:creator>鏂潌鐮存灙澶?/author>Wed, 10 Dec 2014 12:47:00 GMT http://www.shnenglu.com/qxtianlong/archive/2014/12/10/209149.html http://www.shnenglu.com/qxtianlong/comments/209149.html http://www.shnenglu.com/qxtianlong/archive/2014/12/10/209149.html#Feedback 0 http://www.shnenglu.com/qxtianlong/comments/commentRss/209149.html http://www.shnenglu.com/qxtianlong/services/trackbacks/209149.html 濂戒箙娌℃湁鍐欎唬鐮佷簡錛孷S澶ぇ涓嶆兂鍘昏垂鏃朵笅杞斤紝灝變笅杞戒簡eclipse-cpp-luna-SR1-win32-x86_64,緋葷粺win7 64bit鍏蜂綋涓嬭澆鍦板潃濡備笅: http://www.eclipse.org/downloads/ 涓嬭澆鎵闇瑕佺殑鐗堟湰 鎺ヤ笅鏉ュ氨鏄疢ingW 涓嬭澆鍦板潃 http://www.mingw.org/ 璇█鐜鎼緩濂戒簡銆?br />涓嬭澆sdl,鍦板潃http://www.libsdl.org 娉ㄦ剰鐗堟湰 OK鍟︼紒錛侊紒 1 /* 2 * main.cpp 3 * 4 * Created on: 2014騫?2鏈?0鏃?br /> 5 * Author: wgzll 6 */ 7 #include <iostream> 8 #include <sdl2/sdl.h> 9 using namespace std;10 11 SDL_Window* g_pWindow = 0;12 SDL_Renderer* g_pRenderer = 0;13 14 int main(int argc,char *args[])15 {16 if (SDL_Init(SDL_INIT_EVERYTHING)>=0)17 {18 g_pWindow = SDL_CreateWindow("Chapter 1: Setting up SDL",19 SDL_WINDOWPOS_CENTERED,SDL_WINDOWPOS_CENTERED,20 640,480,21 SDL_WINDOW_SHOWN);22 if (g_pWindow !=0)23 {24 cout<<"鍒濆鍖栨垚鍔?<<endl;25 g_pRenderer = SDL_CreateRenderer(g_pWindow,-1,0);26 }27 }28 else 29 {30 cout<<"鍒濆鍖栧け璐?<<endl;31 return 1;32 }33 34 SDL_SetRenderDrawColor(g_pRenderer,0,0,0,255);35 36 SDL_RenderClear(g_pRenderer);37 38 SDL_RenderPresent(g_pRenderer);39 40 SDL_Delay(500);41 42 SDL_Quit();43 44 return 0;45 }
#define SDL_INIT_EVERYTHING ( \ SDL_INIT_TIMER | SDL_INIT_AUDIO | SDL_INIT_VIDEO | SDL_INIT_EVENTS | \ SDL_INIT_JOYSTICK | SDL_INIT_HAPTIC | SDL_INIT_GAMECONTROLLER \ ) Uint32 subsystem_init; subsystem_init = SDL_WasInit(SDL_INIT_EVERYTHING); if (subsystem_init & SDL_INIT_VIDEO) { printf("Video is initialized.\n");} else { printf("Video is not initialized.\n"); }if (SDL_WasInit(SDL_INIT_VIDEO) != 0) { printf("Video is initialized.\n");} else { printf("Video is not initialized.\n");} Uint32 subsystem_mask = SDL_INIT_VIDEO | SDL_INIT_AUDIO; if (SDL_WasInit(subsystem_mask) == subsystem_mask) { printf("Video and Audio initialized.\n");} else { printf("Video and Audio not initialized.\n");} SDL_INIT_TIMER timer subsystem SDL_INIT_AUDIO audio subsystem SDL_INIT_VIDEO video subsystem SDL_INIT_JOYSTICK joystick subsystem SDL_INIT_HAPTIC haptic (force feedback) subsystem SDL_INIT_GAMECONTROLLER controller subsystem SDL_INIT_EVENTS events subsystem SDL_INIT_EVERYTHING all of the above subsystems SDL_INIT_NOPARACHUTE compatibility; this flag is ignored
]]> 青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品
亚洲香蕉在线观看 |
在线一区视频 |
欧美a级大片 |
亚洲人体影院 |
一本一本久久a久久精品牛牛影视 |
久久青草福利网站 |
亚洲精选在线 |
在线亚洲观看 |
国产综合色产在线精品 |
免费日韩av |
欧美四级伦理在线 |
久久手机免费观看 |
欧美成人午夜激情 |
午夜一级在线看亚洲 |
久久久久久黄 |
av成人国产 |
欧美在线一区二区 |
亚洲精品久久在线 |
亚洲欧美国产日韩天堂区 |
91久久久亚洲精品 |
在线观看欧美精品 |
99热这里只有成人精品国产 |
国产精品手机在线 |
亚洲第一精品福利 |
国产日韩欧美三级 |
亚洲欧洲综合 |
伊人婷婷久久 |
亚洲欧美日韩高清 |
亚洲线精品一区二区三区八戒 |
欧美怡红院视频 |
一区二区三区视频在线 |
久久精品视频播放 |
午夜宅男欧美 |
欧美精品一区二区三 |
久久精品最新地址 |
欧美日韩伊人 |
亚洲电影专区 |
在线成人激情视频 |
欧美在线欧美在线 |
午夜精品电影 |
欧美视频三区在线播放 |
亚洲第一黄网 |
亚洲高清不卡av |
久久精品国产精品亚洲精品 |
午夜激情综合网 |
国产精品va在线 |
亚洲美女中出 |
99热免费精品在线观看 |
久久一区欧美 |
美女尤物久久精品 |
精品成人一区二区三区 |
亚洲欧美中文日韩v在线观看 |
亚洲性线免费观看视频成熟 |
欧美成年网站 |
亚洲国产专区 |
日韩视频免费看 |
女女同性精品视频 |
欧美激情亚洲另类 |
亚洲黄色在线视频 |
欧美成人第一页 |
亚洲国产一区二区三区a毛片 |
亚洲精品国久久99热 |
蜜桃视频一区 |
91久久精品美女高潮 |
亚洲精品偷拍 |
欧美色一级片 |
亚洲欧美另类在线 |
久久国产精品高清 |
黑丝一区二区 |
欧美成在线观看 |
亚洲激情欧美激情 |
99在线精品视频在线观看 |
99视频精品免费观看 |
欧美精品在线一区二区三区 |
亚洲激情啪啪 |
亚洲综合大片69999 |
国产精品影视天天线 |
性亚洲最疯狂xxxx高清 |
免费看精品久久片 |
亚洲精品资源 |
国产精品久久久久影院亚瑟 |
欧美一区二区三区日韩 |
免费成人黄色av |
在线亚洲电影 |
国产视频精品网 |
久久久在线视频 |
日韩午夜高潮 |
久久精品在这里 |
亚洲伦伦在线 |
国产视频在线一区二区 |
久热精品在线视频 |
日韩亚洲一区在线播放 |
久久精品动漫 |
国产精品99久久久久久久久 |
国产区欧美区日韩区 |
卡通动漫国产精品 |
亚洲女人天堂av |
欧美国产日本 |
久久av一区二区三区漫画 |
亚洲激情午夜 |
国产日本欧美在线观看 |
欧美电影免费 |
久久久青草婷婷精品综合日韩 |
日韩视频一区二区 |
欧美本精品男人aⅴ天堂 |
亚洲视频一区 |
亚洲美女淫视频 |
国内精品久久久久久久影视蜜臀
|
欧美成人自拍视频 |
亚洲欧美国产毛片在线 |
亚洲精品美女在线观看播放 |
久久精品视频va |
亚洲一本视频 |
日韩午夜在线电影 |
亚洲大片免费看 |
国产三级欧美三级 |
国产精品亚洲一区 |
欧美日韩国产在线播放网站 |
久热精品视频在线免费观看 |
午夜精品美女久久久久av福利 |
亚洲精品久久久久中文字幕欢迎你
|
亚洲精品国精品久久99热 |
国内精品视频久久 |
国产精品夜夜夜一区二区三区尤 |
久久这里只有精品视频首页 |
欧美与欧洲交xxxx免费观看 |
一区二区三区四区五区精品视频 |
亚洲风情亚aⅴ在线发布 |
久久天天躁狠狠躁夜夜av |
午夜精品久久久久久久久久久久
|
亚洲国产精品成人精品 |
久热精品视频在线 |
欧美日韩国产一区二区三区 |
美女网站久久 |
99精品热6080yy久久
|
亚洲欧美国内爽妇网 |
欧美黄色aa电影 |
国产精品v欧美精品v日韩精品 |
在线亚洲欧美视频 |
午夜精品久久久久久99热软件 |
亚洲精品久久7777 |
在线天堂一区av电影 |
亚洲欧美精品伊人久久 |
亚洲精品一区在线观看 |
亚洲国产另类久久精品 |
亚洲大片av |
亚洲免费av电影 |
亚洲另类自拍 |
亚洲欧美国产精品专区久久 |
亚洲在线中文字幕 |
午夜影院日韩 |
久久婷婷国产麻豆91天堂 |
久久亚洲风情 |
91久久久久久久久久久久久 |
欧美激情一区在线观看 |
91久久中文 |
亚洲少妇最新在线视频 |
性久久久久久 |
久久综合亚州 |
国产精品mm |
一区二区三区在线看 |
亚洲国产精品国自产拍av秋霞 |
亚洲精品影院 |
性色av香蕉一区二区 |
免费成人毛片 |
日韩视频一区二区在线观看 |
亚洲综合色视频 |
久久频这里精品99香蕉 |
欧美区在线播放 |
国产午夜精品在线观看 |
亚洲黄一区二区 |
午夜精品一区二区三区电影天堂
|
女人香蕉久久**毛片精品 |
日韩视频一区二区三区 |
欧美一区三区二区在线观看 |
欧美成人免费视频 |
国产九九精品 |
99视频+国产日韩欧美 |
久久国产免费看 |
亚洲人成在线观看网站高清 |
亚洲欧美日韩在线 |
欧美成人亚洲 |
精品999网站 |
亚洲一区在线免费 |
欧美成人免费va影院高清 |
亚洲小说春色综合另类电影 |
免费日韩av电影 |
国产亚洲一区在线 |
亚洲视频观看 |
欧美寡妇偷汉性猛交 |
欧美一区二区三区的 |
欧美日韩色一区 |
亚洲激情社区 |
久久人人爽人人爽爽久久 |
99热免费精品在线观看 |
欧美国产精品久久 |
影音先锋在线一区 |
欧美一区影院 |
亚洲天堂av图片 |
欧美日韩国产在线观看 |