PSP程序开发例子解析(六)TrueTypeFont

按照Windows的ttf字体显示文字。。跑不起来 略
#include <stdio.h>

#include <JGE.h>
#include <JRenderer.h>
#include <JLBFont.h>
#include <JGBKFont.h>
#include <JSoundSystem.h>

#include <JTTFont.h>
#include <Encoding.h>

#include "GameApp.h"

GameApp::GameApp()
{

mTTFont1 = NULL;
mTTFont2 = NULL;
mTTFSmall = NULL;

}


GameApp::~GameApp()
{
}


void GameApp::Create()
{

mTTFont1 = new JTTFont();//JTTFont类 包装ttf字体文件 提供对字体的访问
mTTFont1->Load("BorisBlackBloxx.ttf", 64);//加载ttf文件 64号字体

mTTFont2 = new JTTFont();   
mTTFont2->Load(mTTFont1, 20);   // Create the 2nd font using font info and data from the 1st one, but with a different size.

mTTFSmall = new JTTFont(JTTFont::CACHE_IMAGE_512x512);      // We want to cache all the ASCII characters so we specify a large cache image.
mTTFSmall->Load("steelfib.ttf", 32, JTTFont::MODE_PRECACHE_ASCII);   // Load font and cache all the ASCII characters at the same time.
mTTFSmall->Unload();              // Since we have all the characters we need in the cache, we can delete the 
                    // font bitmap to save some memory.

}


void GameApp::Destroy()
{

SAFE_DELETE(mTTFont1);
SAFE_DELETE(mTTFont2);
SAFE_DELETE(mTTFSmall);

}


void GameApp::Update()
{

JGE* engine = JGE::GetInstance();

if (engine->GetButtonClick(PSP_CTRL_TRIANGLE)) // do a screen shot when TRIANGLE is pressed
{
   char s[80];
   sprintf(s, "ms0:/screenshot.png");
   JRenderer::GetInstance()->ScreenShot(s);
}

if (engine->GetButtonClick(PSP_CTRL_CROSS))   // exit when the CROSS is pressed
{
   engine->End();
   return;
}

}


void GameApp::Render()
{

JRenderer* renderer = JRenderer::GetInstance();

renderer->EnableTextureFilter(false);

renderer->ClearScreen(ARGB(0,0,0,0));

mTTFont1->SetColor(ARGB(255,255,255,255));
mTTFont1->RenderString("Hello(Size 64)", 10, 10);

mTTFont2->SetColor(ARGB(255,255,255,255));
mTTFont2->RenderString("G'day ! (Size 20)", 10, 96);

mTTFont2->SetColor(ARGB(255,255,0,0));
mTTFont2->RenderString("I am HOT!", 310, 100);

mTTFSmall->SetColor(ARGB(255,255,64,255));
mTTFSmall->RenderString("She sells sea shells on the seashore. (Size 32)", 10, 200);

mTTFont1->SetColor(ARGB(192,0,0,255));
mTTFont1->RenderString("SO COOL!", 50, 120);

mTTFont1->SetColor(ARGB(96,0,128,0));
mTTFont1->RenderString("SO COOL!", 55, 125);

}


void GameApp::Pause()
{
}


void GameApp::Resume()
{
}

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
PSP(Personal Software Process)是一种个人软件过程,它是一种过程改进方法,适用于个人软件开发者。基于PSP的软件开发过程主要包括以下几个阶段: 1. 计划阶段:确定软件开发的目标和范围,制定开发计划和进度安排。 2. 设计阶段:根据需求分析,设计软件的结构、模块和接口。 3. 编码阶段:按照设计要求,编写程序代码。 4. 编译和测试阶段:对程序进行编译和测试,检查程序的正确性和可靠性。 5. 集成和测试阶段:将程序的各个模块进行集成,对整个系统进行测试。 6. 交付和维护阶段:将程序交付给用户,并进行维护和升级。 在以上的软件开发过程中,PSP强调了个人开发者的自我管理和自我改进,通过引入度量和反思的方法,帮助开发者提高软件开发的效率和质量。PSP包括以下几个主要的步骤: 1. 了解和分析个人的软件开发能力和经验,确定个人的软件开发过程。 2. 制定计划和进度安排,包括工作量估计、进度控制、风险管理等。 3. 进行需求分析和设计,确定软件的功能和结构,编写相关的文档和规格说明。 4. 编写程序代码,并进行代码审查和测试,修正代码中的错误和缺陷。 5. 集成和测试,对整个系统进行测试,确保软件的正确性和可靠性。 6. 交付和维护,将软件交付给用户,并进行维护和升级。 通过使用PSP方法,软件开发者可以对自己的软件开发过程进行度量和改进,提高软件开发的效率和质量,从而达到更好的软件开发目标。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值