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

📄 ppu_effect.c

📁 凌阳32位单片机开发的小游戏
💻 C
字号:
/******************************************************************************
 *
 *     The information contained herein is the exclusive property of
 *   Sunplus Technology Co. And shall not be distributed, reproduced,
 *   or disclosed in whole in part without prior written permission.
 *
 *         (C) COPYRIGHT 2005   SUNPLUS TECHNOLOGY CO.
 *                        ALL RIGHTS RESERVED
 *
 * The entire notice above must be reproduced on all authorized copies.
 *
 *****************************************************************************/

/******************************************************************************
 *  Filename:   	PPU_Effect.c
 *  Author:     	 xydeng  (eMail:  xydeng@sunplus.com)
 *  Tel:        	00885-028-87848688-5884
 *  Date:       	2005-11-14
 *  Description:	
 *  Reference:
 *  Version history:
 *-----------------------------------------------------------------------------
 *	Version   YYYY-MM-DD-INDEX   Modified By         Description
 *	1.0.0     2005-11-14          xydeng               Create
 *
 *****************************************************************************/
 
#include "Include/PPU_Effect.h"
#include "Include/PPU_Texture.h"
#include "Include/PPU_Palette.h"

//===============================================================================================================
// Text layer every scanline	Horizontal Movement
// void TX_HMovement(U8 nText,S16 nMode, S32 nStartScanline,S32 nEndScanline,S32 nCompValue,const S32 *pScanline)
// Input parameters: 
//              U8 nText:which TEXT 	                        
//				S32 StartScanline:	from which Scanline to begin
//				S32 EndScanline:	from which Scanline to end
//			    S32 *pScanline:	    Scanline Movement data table	
// Return:     none
//Note:        When used this function ,pScanline must have 2times more numbers than if
//             you use only once at least 
//===============================================================================================================
U16 nHMovementCnt = 0;
bool g_bHMovementFlag;

void TX_HMovement(S16 nMode, S32 nStartScanline,S32 nEndScanline,S32 nCompValue,const S8 *pScanline,U16 nNumberData)
{
	S32 i;
	U32 *port;
    U32 nScanLine;
    
/*  if(nText==TEXT1)	
	(*P_PPU_TX1_Control)|=1<<4;       //add by xydeng 12/14/2005
  if(nText==TEXT2)
	(*P_PPU_TX2_Control)|=1<<4;       //add by xydeng 12/14/2005
  if(nText==TEXT3)
	(*P_PPU_TX3_Control)|=1<<4;       //add by xydeng 12/14/2005*/
	
	port = P_PPU_Tx_HOffset_ADR; 
	nScanLine=nEndScanline-nStartScanline;
	
	if(nMode == 0)
	{
		for(i = 0; i<nScanLine; i ++)	
		{
			*(port + nStartScanline + i) =nCompValue;		// write Scanline table data to I/O
		}		
	}
	else
	{
		for(i = 0; i<nScanLine; i ++)	
		{
			*(port + nStartScanline + i) =pScanline[nHMovementCnt+1];		// write Scanline table data to I/O
			nHMovementCnt++;
			if(nHMovementCnt>=nNumberData-1)
			nHMovementCnt=0;
//			*(port + nStartScanline + i) =pScanline[nHMovementCnt++];		// write Scanline table data to I/O
//			if(nHMovementCnt == nNumberData)
//				nHMovementCnt=0;
		}
	}
} 

//====================================================================================================
// Text Horizontal Scroll
// TX_HScroll(U16 eText,U16 Scroll_Left_to_Right, S32 Scroll_TXStep);
// Input parameters:  	                        
//				U16 eText:	TEXT1/TEXT2/TEXT3
//				U16 Scroll_Left_to_Right: 1:Scroll from Left to Right 0:Scroll from Right to Left
//				S32 Scroll_TXStep:	Scroll TEXT Step	
// Return:     none
//====================================================================================================
/*
void TX_HScroll(U16 eText,U16 Scroll_Left_to_Right, S32 Scroll_TXStep)
{
	g_bTextScrollFlag=1;
	if(eText==TEXT1)
	{
		if(Scroll_Left_to_Right)
			text1_x-=Scroll_TXStep;
		else 
            text1_x+=Scroll_TXStep;
		     
	}
	
	if(eText==TEXT2)
	{
		if(Scroll_Left_to_Right)
			text2_x-=Scroll_TXStep;
		else 
            text2_x+=Scroll_TXStep;
		     
	}
	
	if(eText==TEXT3)
	{
		if(Scroll_Left_to_Right)
			text3_x-=Scroll_TXStep;
		else 
            text3_x+=Scroll_TXStep;
	}
}
*/
//====================================================================================================
// Text Vertical Scroll
// TX_HScroll(U16 eText,U16 Scroll_Up_to_Down, S32 Scroll_TXStep);
// Input parameters:  	                        
//				U16 eText:	TEXT1/TEXT2/TEXT3
//				U16 Scroll_Up_to_Down: 1:Scroll from Up to Down   0: Scroll from Down to Up 
//				S32 Scroll_TXStep:	Scroll TEXT Step	
// Return:     none
//====================================================================================================
/*
void TX_VScroll(U16 eText,U16 Scroll_Up_to_Down, S32 Scroll_TXStep)
{
	g_bTextScrollFlag=1;
	if(eText==TEXT1)
	{
		if(Scroll_Up_to_Down)
			text1_y-=Scroll_TXStep;
		else 
            text1_y+=Scroll_TXStep;
		     
	}
	
	if(eText==TEXT2)
	{
		if(Scroll_Up_to_Down)
			text2_y-=Scroll_TXStep;
		else 
            text2_y+=Scroll_TXStep;
		     
	}
	
	if(eText==TEXT3)
	{
		if(Scroll_Up_to_Down)
			text3_y-=Scroll_TXStep;
		else 
            text3_y+=Scroll_TXStep;
	}
}*/

⌨️ 快捷键说明

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