|
From: <dv...@us...> - 2008-05-02 23:41:36
|
Revision: 248
http://dunelegacy.svn.sourceforge.net/dunelegacy/?rev=248&view=rev
Author: dvalin
Date: 2008-05-02 16:41:31 -0700 (Fri, 02 May 2008)
Log Message:
-----------
don't draw text in wsa object, just return a tiny 1x1 image in stead and do the drawing in IntroState class
Modified Paths:
--------------
branches/dunks/include/pakfile/Wsafile.h
branches/dunks/src/pakfile/Wsafile.cpp
Modified: branches/dunks/include/pakfile/Wsafile.h
===================================================================
--- branches/dunks/include/pakfile/Wsafile.h 2008-05-02 18:22:29 UTC (rev 247)
+++ branches/dunks/include/pakfile/Wsafile.h 2008-05-02 23:41:31 UTC (rev 248)
@@ -19,8 +19,8 @@
public:
Wsafile(uint8_t * bufFiledata, int bufsize,
SDL_Surface* lastframe = NULL, float setFps = 0 );
- Wsafile(std::string text, uint8_t textColor);
Wsafile(Cpsfile* cpsFile);
+ Wsafile();
~Wsafile();
Modified: branches/dunks/src/pakfile/Wsafile.cpp
===================================================================
--- branches/dunks/src/pakfile/Wsafile.cpp 2008-05-02 18:22:29 UTC (rev 247)
+++ branches/dunks/src/pakfile/Wsafile.cpp 2008-05-02 23:41:31 UTC (rev 248)
@@ -68,11 +68,11 @@
decodeFrames();
}
-Wsafile::Wsafile(std::string text, uint8_t textColor) : Decode()
+Wsafile::Wsafile(Cpsfile* cpsFile) : Decode()
{
- WsaFilesize = -1;
+ WsaFilesize = -2;
- printf("loading fake wsa...\n");
+ printf("loading cps file as wsa...\n");
NumFrames = 1;
fps = 0.1;
@@ -80,15 +80,14 @@
printf("FramesPer1024ms = %d\n", FramesPer1024ms);
printf("FPS = %.3f\n", fps);
decodedFrames = NULL;
- m_text = text;
- m_textColor = textColor;
+ m_cpsFile = cpsFile;
}
-Wsafile::Wsafile(Cpsfile* cpsFile) : Decode()
+Wsafile::Wsafile() : Decode()
{
- WsaFilesize = -2;
+ WsaFilesize = -1;
- printf("loading cps file as wsa...\n");
+ printf("loading empty image as wsa...\n");
NumFrames = 1;
fps = 0.1;
@@ -96,7 +95,6 @@
printf("FramesPer1024ms = %d\n", FramesPer1024ms);
printf("FPS = %.3f\n", fps);
decodedFrames = NULL;
- m_cpsFile = cpsFile;
}
Wsafile::~Wsafile()
@@ -106,33 +104,9 @@
Image * Wsafile::getPicture(Uint32 FrameNumber, SDL_Palette *palette)
{
+ Image* img;
if(WsaFilesize == -1){
- Image* img = new Image(UPoint(320,240));
-
- std::string text = m_text;
- Font* font = FontManager::Instance()->getFont("INTRO:INTRO.FNT");
-
- Uint16 textw, texth;
-
- img->fillRect(0);
-
- uint8_t numLines = 0;
- int linebreak = text.find("\n",0)+ 1;
- std::string thisLine;
- // This is a bit hairy and needs to be cleaned up a bit..
- while(text.substr(0, linebreak-1).length() > 0){
- thisLine = text.substr(0, linebreak-1);
-
- font->extents(thisLine, textw, texth);
-
- font->render(thisLine, img->getSurface(),
- img->getSurface()->w/2 - textw/2,
- img->getSurface()->h/2+(numLines++*20) - texth/2, m_textColor);
- if(linebreak == -1 || text == text.substr(linebreak, text.length()-linebreak))
- break;
- text = text.substr(linebreak, text.length()-linebreak);
- linebreak = text.find("\n",0);
- }
+ img = new Image(UPoint(1,1));
return img;
}
@@ -174,7 +148,7 @@
SDL_UnlockSurface(pic);
- Image * img = new Image(pic);
+ img = new Image(pic);
return img;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|