最美情侣中文字幕电影,在线麻豆精品传媒,在线网站高清黄,久久黄色视频

歡迎光臨散文網(wǎng) 會員登陸 & 注冊

游戲微小更新,油庫里可以“左顧右盼”了

2023-07-13 22:20 作者:childlizr  | 我要投稿

以下是相關代碼,有問題隨便問,有bug隨便提。

雖然是咱自己想出來的,但是肯定有雷同,咱懶得去找,反正能達到目的就行。

測試方法在注釋里。


#include <easyx.h>

#include <conio.h>

//運行后隨便按一個字母鍵后,圖片水平翻轉。

//圖片需要自己準備,為png格式,名稱改為test.png,和這個源文件放在同一文件夾

class youkuli

{

protected:

IMAGE* body;

public:

youkuli()

{

this->body = new IMAGE;

loadimage(this->body, L"./test.png");

}

~youkuli()

{

delete this->body;

this->body = nullptr;

}

void flip_horizontal()//將圖片水平翻轉(水平鏡像)

{

DWORD* tem_picture = GetImageBuffer(this->body);//身體原圖片(將要被修改的)

IMAGE base = *(this->body);//備用(不變的)

DWORD* base_picture = GetImageBuffer(&base);//備用(不變的)

int R = 0, G = 0, B = 0;

int max = this->body->getheight() * this->body->getwidth();

int i_for_tem = 0;//被改寫的點的下角標

int where_x = 0, where_y = 0;//不變的那個圖的點的對應坐標

while (i_for_tem < max)

{

if (where_x == this->body->getwidth())//換行

{

where_x = 0;

where_y++;

}

auto get_order = [&i_for_tem, this, &where_y]()//得到翻轉后的下角標

{

return ((this->body->getwidth() - (i_for_tem % this->body->getwidth())) + where_y * this->body->getwidth());

};

R = GetRValue(base_picture[get_order()]);

G = GetGValue(base_picture[get_order()]);

B = GetBValue(base_picture[get_order()]);

tem_picture[i_for_tem] = RGB(R, G, B);

where_x++;

i_for_tem++;

}

}

void draw(int x, int y)

{

putimage(x, y, this->body);

}

};

int main()

{

initgraph(1000, 600);

youkuli* test = new youkuli();

setbkcolor(BLACK);

BeginBatchDraw();


while (1)

{

test->draw(10,10);

FlushBatchDraw();

//_getch();

test->flip_horizontal();

test->draw(10,10);

FlushBatchDraw();

_getch();

}

return 0;

}

游戲微小更新,油庫里可以“左顧右盼”了的評論 (共 條)

分享到微博請遵守國家法律
龙州县| 贵州省| 农安县| 蓝田县| 德安县| 石首市| 武定县| 石河子市| 宿松县| 鄂托克前旗| 新兴县| 襄樊市| 思茅市| 上林县| 襄垣县| 耒阳市| 高雄市| 同德县| 新宾| 高尔夫| 滦平县| 锡林浩特市| 永修县| 宁陕县| 碌曲县| 富民县| 两当县| 永仁县| 宜宾县| 冕宁县| 永兴县| 青冈县| 神木县| 平果县| 房山区| 河曲县| 驻马店市| 呼和浩特市| 子洲县| 衡水市| 黎川县|