98 lines
		
	
	
		
			2.7 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			98 lines
		
	
	
		
			2.7 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
#ifndef MYWIN_LIB_H__
 | 
						||
#define MYWIN_LIB_H__
 | 
						||
#include "mywin_cfg.h"
 | 
						||
#include "mywin_type.h"
 | 
						||
#include "stdio.h"
 | 
						||
#include "string.h"
 | 
						||
 | 
						||
// 初始化已实例化的队列
 | 
						||
void QUEUE_Init(QUEUE_Struct *q, int blocksize, int blocknum);
 | 
						||
 | 
						||
// 销毁队列
 | 
						||
void QUEUE_Delete(QUEUE_Struct *q);
 | 
						||
 | 
						||
// 出队,如果队列为空,返回0,否则返回1
 | 
						||
int QUEUE_Out(QUEUE_Struct *q, void *buff);
 | 
						||
 | 
						||
// 入队,如果队列已满,返回1并且本次入队失败
 | 
						||
int QUEUE_In(QUEUE_Struct *q, void *block);
 | 
						||
 | 
						||
// 查看初始化
 | 
						||
int QUEUE_CheckStart(QUEUE_Struct *q);
 | 
						||
 | 
						||
// 查看数据,还有数据返回,没有数据返回0
 | 
						||
void *QUEUE_Check(QUEUE_Struct *q);
 | 
						||
 | 
						||
// 判断两个点的距离是否超过了半径,没超过返回0,超过了返回非0
 | 
						||
int POS_RoundPix(int r, int x1, int y1, int x2, int y2);
 | 
						||
 | 
						||
// 判断指定点是否在矩形内,1,在,0,不在
 | 
						||
int POS_InRect(int rect_x, int rect_y, int rect_x_size, int rect_y_size, int x,
 | 
						||
               int y);
 | 
						||
 | 
						||
// 两个矩形求交集
 | 
						||
int POS_RectIntersection(RECT_Struct *out, RECT_Struct *r1, RECT_Struct *r2);
 | 
						||
 | 
						||
// 求一个大矩形,包含两个小矩形
 | 
						||
int POS_RectContain(RECT_Struct *out, RECT_Struct *r1, RECT_Struct *r2);
 | 
						||
 | 
						||
// 两个矩形相减,减去后不为空返回1
 | 
						||
int POS_RectSub(RECT_Struct *out, RECT_Struct *r1, RECT_Struct *r2);
 | 
						||
 | 
						||
// 判断两个矩形相等,是返回1,不是返回0
 | 
						||
int POS_RectEqual(RECT_Struct *r1, RECT_Struct *r2);
 | 
						||
 | 
						||
/**************************由于以下函数实现是平台相关的*****************************/
 | 
						||
/***************************需要依赖其他库或者操作系统******************************/
 | 
						||
/*************************如果在界面中需要使用到以下函数****************************/
 | 
						||
/**************************需要在mywin_cfg.c文件中实现*****************************/
 | 
						||
 | 
						||
/* 多线程 */
 | 
						||
 | 
						||
// 供MYWIN调用的创建线程函数,创建成功返回工作空间结构体
 | 
						||
// fun是工作函数,ptr是传送给工作函数的参数,ret是工作函数的返回值
 | 
						||
WIN_WorkFunStruct *WIN_CreatThread(int (*fun)(void *), void *ptr, int *ret);
 | 
						||
 | 
						||
// 供MYWIN调用的创建线程函数,创建成功返回工作空间结构体
 | 
						||
// fun是工作函数,ptr是传送给工作函数的参数,ret是工作函数的返回值
 | 
						||
WIN_WorkFunStruct *WIN_CreatThreadPro(int (*fun)(void *), void *ptr, int *ret,
 | 
						||
                                      u8 pro);
 | 
						||
 | 
						||
// 获取工作线程运行状态,1,运行结束
 | 
						||
int WIN_GetExWorkFunStat(WIN_WorkFunStruct *w);
 | 
						||
 | 
						||
// 线程所用资源回收函数,由发起线程调用
 | 
						||
void WIN_ExWorkFunClear(WIN_WorkFunStruct *w);
 | 
						||
 | 
						||
/* 多线程End */
 | 
						||
 | 
						||
/* 获取字模 */
 | 
						||
 | 
						||
// 根据字体类型获取字模数据,返回0,成功,非0,失败
 | 
						||
int WIN_GetWordData(u8 size, u8 type, unsigned char *buff, int word,
 | 
						||
                    int buff_size);
 | 
						||
 | 
						||
/* 获取字模End */
 | 
						||
 | 
						||
/* 获取图片 */
 | 
						||
 | 
						||
// 解码图片0,成功,1,失败
 | 
						||
int WIN_DecodeImg(WIN_PicStruct *pic, const char *name);
 | 
						||
 | 
						||
/* 获取图片End */
 | 
						||
 | 
						||
/* 基础配置 */
 | 
						||
 | 
						||
// 初始化配置
 | 
						||
void WIN_InitCfg(void);
 | 
						||
 | 
						||
// 获取从上次获取时间算起过去了多少毫秒
 | 
						||
unsigned int WIN_GetTimePast(void);
 | 
						||
 | 
						||
// 供MYWIN调用的延时函数
 | 
						||
void WIN_Delay_ms(u32 ms);
 | 
						||
 | 
						||
/* 基础配置End */
 | 
						||
 | 
						||
#endif
 |