⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mmi3dframe.c

📁 是一个手机功能的模拟程序
💻 C
📖 第 1 页 / 共 2 页
字号:
/**********************************************************************************
* 
* file name : mmi3dframe.c
*
* description : 本文件包含推箱子游戏和打气球游戏的中用到的
*             button,messagebox,menu, clarity text
*
***********************************************************************************/

/******************************文件历史记录********************************
*
* creator : tangyan
*
* create : 2002/9/16
* 
* file version                            modified
*
**************************************************************************************/

/*********************************include headfiles***************************************/
#include "mfw_sys.h"
//#include "stddefs.h"
#include "custom.h"
#include "gsm.h"
//#include "vsi.h"
#include "ffs.h"
#include "p_sim.h"
#include "cus_aci.h"
#include "Rtc_Api.h"
#include "mfw_mfw.h"
#include "mfw_win.h"
#include "mfw_kbd.h"
#include "mfw_edt.h"
#include "mfw_tim.h"
#include "mfw_icn.h"
#include "mfw_mnu.h"
#include "mfw_sat.h"
#include "mfw_mnu.h"
#include "mfw_ffs.h"
#include "dspl.h"
//#include "bmieastapi.h"
#include "MmiMmi.h"
#include "MmiDummy.h"
#include "MmiDialogs.h"
#include "MmiSoftkeys.h"
#include "MmiIcons.h"
#include "MmiMenu.h"
#include "gdi.h"
#include "Audio.h"
#include "MmiSounds.h"
#include "MmiBookShared.h"

#include "MmiBlkLangDB.h"
#include "GameDisplay.h"
//#include "mmigameicons.h"
#include "mmi3dframe.h"
#include "wstring.h"

#define textheight  16

#define abs(a)  ((a)>0? (a):-(a))
#define GAMEMNUSHOW  0
#define GAMEMNUDOWN  1
#define GAMEMNUUP     2
#define GAMEMNUANIMI  3

#define GMNUTEXTHIGH  19
#define GMNUTEXTYPOS  83
#define GMNUFOCUSWD  16
#define GMNUFOCUSHG   16

U8 winfocusout;

void draw3drect(MfwRect rect, U32 tlcolor, U32 brcolor);
/*********************************display clarity word************************************/

/*************************************************************************************
  函数名: drawcolrclaritytext
  描述 :  显示有色透明字,假设已经加上了0x80
  *************************************************************************************/
void drawcolorclarity(U16 left, U16 top , char * text, U32 color)
{

U16 oldcolor;

oldcolor=dspl_GetFrgColor();
dspl_SetFrgColor(color);
dspl_TextOut(left, top,DSPL_TXTATTR_TRANSPARENT, (char *)text);
dspl_SetFrgColor(oldcolor);
}


/***************************************************************************************
	$Function:		DrawColorNumber
	$Description:	only for number with new line.
	$Author:		Sunny
	$Date:			2004-04-28
***************************************************************************************/
void DrawColorNumber(U16 left, U16 top, char * text, U32 color)
{
	int i = 0;
	int nTextLen = 0;
	int rows = 0, nCharsLastLine = 0;
	int nCharWidth = 0;
	int nCharsPerLine = 0;
	U16 oldcolor;
	char subText[25];	

	if(!text)
	{
		return;
	}

	nCharWidth = 6;//?
	
	nCharsPerLine = (SCREEN_SIZE_X - left) / nCharWidth;

	nTextLen = strlen(text);
	
	oldcolor=dspl_GetFrgColor();
	dspl_SetFrgColor(color);

	rows = nTextLen / nCharsPerLine;
	nCharsLastLine = nTextLen % nCharsPerLine;

	if(nCharsLastLine != 0)
	{
		rows++;
	}

	for(i = 0; i < rows - 1; i++)
	{
		memcpy(subText,text + i * nCharsPerLine, nCharsPerLine);
		subText[nCharsPerLine] = 0;
		dspl_TextOut(left, top + i * 13,DSPL_TXTATTR_TRANSPARENT, (char *)subText); //13?
	}	

	if(nCharsLastLine > 0)
	{
		memcpy(subText,text + (rows - 1) * nCharsPerLine, nCharsLastLine);
		subText[nCharsLastLine] = 0;
		dspl_TextOut(left, top + (rows - 1) * 13,DSPL_TXTATTR_TRANSPARENT, (char *)subText); //13?
	}
	else
	{
		memcpy(subText,text + (rows - 1) * nCharsPerLine, nCharsPerLine);
		subText[nCharsPerLine] = 0;
		dspl_TextOut(left, top + (rows - 1) * 13,DSPL_TXTATTR_TRANSPARENT, (char *)subText);
	}

	dspl_SetFrgColor(oldcolor);
}


/*************************************************************************************
  函数名: drawcolorclarity_NoNewline
  描述 :  显示有色透明字,假设已经加上了0x80
  xsf  add 2003.03.06
  *************************************************************************************/
void drawcolorclarity_NoNewline(U16 left, U16 top , char * text, U32 color)
{
 U16 oldcolor;

 oldcolor=dspl_GetFrgColor();
 dspl_SetFrgColor(color);
 dspl_TextOut_NoNewline(left, top,DSPL_TXTATTR_TRANSPARENT, (char *)text);
 dspl_SetFrgColor(oldcolor);
}

/*************************************************************************************
  函数名: drawmidtext
  描述 :   在指定的矩形的中间显示有色透明字
  *************************************************************************************/
void drawmiddle(U16 left, U16 top, U16 width,U16 height, char * text, U32 color)
{
U16 ileft,itop,length;


 MmiTrace("drawmiddle");
length=wstrlen(text)*8;

if(height<14)
	return;
if(length>=width)
	return;

ileft=left+ (width-length)/2;
itop=top + (height- textheight)/2;
drawcolorclarity( ileft , itop , text, color);

}

/*********************************draw 3dbutton*****************************************/

/*************************************************************************************
  函数名: draw3dbutton
  描述 :  画出具有3d效果的button
  *************************************************************************************/
void draw3dbutton(U16 left,U16 top,U16 right,U16 bottom ,char *pcaption ,U32 color,U8 select)
{
MfwRect  rect;
U32 oldcolor,width,height;

rect.px=left;
rect.py=top;
rect.sx=abs(right-left);
rect.sy=abs(bottom-top);

    //MmiTrace("draw3dbutton");
	//zgzTraceDataFunc("draw3dbuttoncolor", (U16)color);
    oldcolor = dspl_SetBkgColor(color); 
    dspl_fill_rectangle(left, top, right, bottom);
    dspl_SetBkgColor(oldcolor);

    
	if(select)
		draw3drect(rect, color|0x3c3c3c, color&0x3c3c3c);
	else
    	draw3drect(rect, color&0x3c3c3c, color|0x3c3c3c);

	width=abs(right-left);
	height=abs(bottom-top);
	oldcolor=(~color)&0xffffff;
	drawmiddle(left, top, width, height, pcaption, oldcolor );
}

/*********************************draw messagebox*****************************************/

/*************************************************************************************
  函数名: messagebox
  描述 :  画出具有3d效果的button
  *************************************************************************************/
//extern const unsigned char backgroundBit[];
//extern const unsigned char iconRequire[];

//void Draw_Dialog(char * sztext)
//{
//U16 xPosition_i,txtSize_i;
/*
oldcolor = dspl_SetBkgColor(color); 
dspl_fill_rectangle(, , , );
dspl_SetBkgColor(oldcolor);  
*/
//draw_popup_background();
/*
dspl_BitBlt(9,41, 102, 72, 0, (void *)&backgroundBit, 0);  
dspl_BitBlt(49, 61, 22, 19, 0, (void *)&iconRequire, 0);  
txtSize_i=wstrlen(sztext)*8;
xPosition_i=9+(102-txtSize_i)/2;

dspl_TextOut(xPosition_i, 49+38,DSPL_TXTATTR_TRANSPARENT, (char *)sztext);*//*2003/12/16, wangyan modify*/
//dspl_TextOut(37, 30,DSPL_TXTATTR_TRANSPARENT, (char *)sztext);
//}


/*************************************************************************************
  函数名: Bmp_Copy
  描述 :  bmp copy
  *************************************************************************************/
void Bmp_Copy(U16* destbmp , U16* scrbmp,
                                   U16 destheight,U16 destwidth,
                                   U16 scrheight, U16 scrwidth,
                                   U16 destxpos, U16 destypos )
{
	UINT16 *p ,*ptr ,*ptrbmp,lcdy ;

	p= (UINT16 *)(scrbmp+destypos*scrwidth);
    
    for(lcdy=0;(lcdy<destheight)&&((lcdy+destypos)<scrheight);lcdy++){ 
	       ptr = p + (destypos + lcdy) * scrwidth+destxpos;
	       ptrbmp = destbmp + destwidth*lcdy;
	
	if((destxpos+destwidth)<scrwidth)
		memcpy(ptr ,ptrbmp ,destwidth*2);
	else
		if(destxpos<scrwidth)
			memcpy(ptr,ptrbmp,(scrwidth-destxpos)*2);
     }
     
}
/*************************************************************************************
  函数名: messagebox
  描述 :  画出具有3d效果的button
  *************************************************************************************/
/*void drawmessagebbox(char * szcaption,char * sztext ,U8 type ,U32 color,U8 focus)
{
MfwRect  rect;
U32 oldcolor,width,height,tempcolor;

MmiTrace("drawmessagebbox");
rect.px=10;
rect.py=30;
rect.sx=MESSAGEBOX_WIDTH;
rect.sy=MESSAGEBOX_HEIGHT;

if(messageboxtype & MESSAGEBOX_CREATE)
{
    oldcolor = dspl_SetBkgColor(color); 
    dspl_fill_rectangle(rect.px, rect.py+20, rect.px+rect.sx, rect.py+rect.sy);
    dspl_SetBkgColor(oldcolor);   
    
    oldcolor = dspl_SetBkgColor(color&0x3c3c3c); 
    dspl_fill_rectangle(rect.px, rect.py, rect.px+rect.sx, rect.py+21);
    dspl_SetBkgColor(oldcolor);   
    
	draw3drect(rect, color|0x3c3c3c, color&0x3c3c3c);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -