欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

C語言利用EasyX繪制小企鵝表情包

 更新時間:2022年12月21日 09:20:00   作者:編程小魚六六六  
這篇文章主要為大家詳細(xì)介紹了C語言如何利用EasyX繪圖庫實現(xiàn)繪制可愛的小企鵝表情包,文中的示例代碼講解詳細(xì),感興趣的小伙伴可以了解一下

使用 C 語言調(diào)用 EasyX 繪圖庫繪制小企鵝表情包,簡直太可愛了!

簡單分析一下,這個小企鵝的構(gòu)成,主要是由黑白顏色和簡單的圓與橢圓構(gòu)成,也不是很復(fù)雜,如果能夠通過平移它的位置和上下位置,就可以實現(xiàn)一個動態(tài)效果,如下是實現(xiàn)的效果。

源碼如下:

///
// 程序名稱:動態(tài)企鵝表情包
// 編譯環(huán)境:Mictosoft Visual Studio 2013, EasyX_20200315
//
 
#include<graphics.h>
#include<conio.h>
void QinE(int x,int y,int N);
 
int main()
{
  initgraph(640,480);
  setbkcolor(WHITE);
  cleardevice();
  int y = 0;
  BeginBatchDraw();
  int i = 0;
  int N = 0;
  int P = 1;
  while (true)
  {
    if (i > 400)
    {
      P = P*(-1);
      N = 1;
    }
    if (i < 0)
    {
      P = P*(-1);
      N = 0;
    }
    i = i + P * 3;
    if (i % 4 == 0)
    {
      y = 8;
    }
    else
    {
      y = 0;
    }
    QinE(i, y,N);
    FlushBatchDraw();
    Sleep(10);
    cleardevice();
    
  }
  EndBatchDraw();
  _getch();
  return 0;
}
 
void QinE(int x, int y,int N)
{
  // 繪制頭
  setlinecolor(BLACK);
  setlinestyle(PS_SOLID,2);
  ellipse(43+x,279+y,229+x,436+y);
  arc(77+x, 310+y, 139+x, 430+y,0,4.654);
  arc(150+x, 310+y, 210+x, 426+y, 5.0, 3.12);
  setfillcolor(BLACK);
  solidellipse(124+x,351+y,161+x,374+y);
  floodfill(145+x,312+y,BLACK);
  solidcircle(106+x,360+y,5);  // 左眼
  solidcircle(184+x,366+y,5);  // 右眼
  if (N)
  {
    // 搖擺的手
    arc(4+x,292+y,146+x,586+y,1.442,4.73);
    arc(197+x, 336+y, 328+x, 526+y, 1.53, 2.11);
    arc(240+x,285+y,403+x,661+y,2.32,4.41);
  }
  // 對稱一下
  else
  {
    arc(110 + 15 + x, 292 + y, 252 + 15 + x, 586 + y, 4.73, 1.72);
    arc(-46 + x, 336 + y, 75 + x, 526 + y, 1.03, 1.68);
    arc(-131 + x, 285 + y, 32 + x, 661 + y, 4.84, 0.79);
  }
  setfillcolor(RGB(213, 206, 201));
  floodfill(130+x, 460+y, BLACK);
}

到此這篇關(guān)于C語言利用EasyX繪制小企鵝表情包的文章就介紹到這了,更多相關(guān)C語言EasyX繪制表情包內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

相關(guān)文章

最新評論