当前位置:网站首页>Graphics learned from jigsaw puzzles h
Graphics learned from jigsaw puzzles h
2022-06-29 10:29:00 【X.IO】
Recently, with C Language to do a puzzle game to use graohic.h Graphics library , Then I summarized some functions involved in my program .( I'm cute , No joy, no spray. )
One .Graphics.h
First , Now let me remind you .( According to my recent experience of stepping on the pit )
1. stay vc And vs Use in the environment graphics.h The function of Can download EasyX Graphics library
( Be careful : This is a C++ The graphics library of If you have to C Language environment graphics.h You can use windows gdi))
2. I believe some friends use Dev-C++ Compiler , But after downloading EasyX The graphics library is still useless ( I'm crazy, too , Found many blogs )
The final reason is :easyx Currently not supported dev-c++. because dev-c Use gcc, Some precompiled instructions are missing , So every time you create a project, you must reference the library , More trouble , Not friendly enough for many beginners , Therefore, we do not support .
Next is the text ( Mainly to understand some functions )
The first is the basic construction :
initgraph(int x,int y,);
// Initialize the graphics system ( It can be understood as re creating a new window ) Among them x、y Represents the width and height of the window respectively .
closegraph();
// close window
rectangle(x1,y1,x2,y2);
// Building a hollow rectangle ,x1,y1 Top left coordinates ,x2,y2 Lower right coordinates
line(x1,y1,x2,y2);
// Build a line . The parameters are the coordinates of both ends
The second is the basic settings
setbkcolor(): Set the background color , Parameter color .
setfillcolor(): Set the color used to fill the drawing form
setlinecolor(): Set the line color
settextcolor(): Set text color ( My understanding is to set the font color )
set( Set up )、color( Color )、bk( background )、fill( fill )、line( line )、text( Text ) After understanding , These functions are actually easy to remember .
The above is mainly about setting some colors , Available when setting colors RGB(a,b,c) Express , You can also use color directly in brackets Capital letters Express , Color macro .
setfillstyle();
// Set the fill pattern , Such as vertical line , Horizontal line , Square filling .
setlinestyle();
// Set the fill pattern of the line
setbkmode();
// pattern , Or text filled background mode ( Background color , transparent ).
Then there is the output
outtextxy(x,y,str);
// stay x,y Position output string str
The plot
IMAGE img;
loadimage(&img,path[, width, height]);
// Image reading .IMAGE Object address , route . Extension parameters , Width and height have been set , Stretch read .
putimage(x,y,&img);
// Display images . The display starts at the coordinates of the upper left corner of the graphics window img graphics .
putimage(int x,int y,int width,int height,&img,int posx,int posy);
// Display images . Compared with the above ,w,h For how many pixels of graphics to display ,x,y by img The object is displayed from this position ( That is, to which position in the window , The width of the graph taken , The height taken , From where in the picture )
Finally, the mouse operation
1. Define mouse messages (MOUSEMSG m;)
2. Get mouse message (m=GETMouseMsg();)
3. Sort and process mouse messages
(switch(m.uMsg)
{
case WM_LBUTTONDOWN:
break;
}
)
边栏推荐
- Weight recursion of complete binary tree -- the last programming challenge
- I would like to know how to open an account for free online stock registration? In addition, is it safe to open a mobile account?
- 这个开源项目超哇塞,手写照片在线生成
- 1099 Build A Binary Search Tree (30 分)
- To 3 --- 最后的编程挑战
- Win32exception (0x80004005): This program is blocked by group policy. For more information, contact your system administrator.
- Codeforces Round #645 (Div. 2)
- C language library function --strstr()
- 2019.11.20 training summary
- 两个栈的模拟题
猜你喜欢

Related problems of pointer array, array pointer and parameter passing

這個開源項目超哇塞,手寫照片在線生成

CLR via C reading notes - single instance application

Arc view and arc viewpager

Codeforces Round #645 (Div. 2)

Basic operations during dev use

Sixteen system counter and flow lamp

Beautiful ruins around Kiev -- a safe guide to Chernobyl!

Download control 1 of custom control (downloadview1)

云主机端口扫描
随机推荐
Talk about threads and concurrency
解决zxing的QR码包含中文时乱码的问题
《CLR via C#》读书笔记-单实例应用程序
winform使用zxing生成二维码
Oracle重置序列发生器(非重建)
HDU 4578 transformation (segment tree + skillful lazy tag placement)
If I were in Beijing, where would it be better to open an account? In addition, is it safe to open an account online now?
Ce projet Open source est super wow, des photos manuscrites sont générées en ligne
《CLR via C#》读书笔记-CLR寄宿与AppDomain
C#中Linq常用用法
任务调度器之Azkaban的使用
1021 deep root (25 points)
MySQL InnoDB data length limit per row
MySQL中innodb_page_cleaners详解
L2-3 这是二叉搜索树吗?-题解超精彩哦
2019.11.17 training summary
Solve the problem that zxing's QR code contains Chinese garbled code
Analysis of liferayportal jsonws deserialization vulnerability (cve-2020-7961)
std::unique_ptr<T>与boost::scoped_ptr<T>的特殊性
1147 Heaps (30 分)