Welcome! Log In Create A New Profile

Advanced

FreeTypeGX and libwiisprite test program -- weird results

Posted by Arikado 
FreeTypeGX and libwiisprite test program -- weird results
December 03, 2008 11:44PM
I've been trying to get font implementation in my libwiisprite programs for months, so I was overjoyed when freetypegx came out today. I compiled and ran the following program:

#include *stdio.h>
#include *stdlib.h>
#include *gccore.h>
#include *wiiuse/wpad.h>
#include *fat.h>
#include *wiisprite.h> // The main libwiisprite header.
#include "FreeTypeGX.h"


// libwiisprite uses wsp as it's namespace
using namespace wsp;

void SetUp();
void MainProgram();

// Create the game window
	GameWindow gwd;

void SetUp(){

//Initialise SD Slot for loading images
	fatInitDefault();
	
// Initialise Wiimote
	WPAD_Init();
	
//Initalise the Video SubSystem	
	gwd.InitVideo();

}




void MainProgram()
{
	
	Image *image1 = new Image();
    image1->LoadImage("data/background.png");
	
	Sprite *background = new Sprite();
	background->SetImage(image1);
	background->SetPosition(0, 0);
	
	FreeTypeGX *freeTypeGX = new FreeTypeGX(32);

    
	
	for(;;)
	{
		WPAD_ScanPads();
		
		background->Draw();
		
		freeTypeGX->drawText(10, 25, _TEXT("FreeTypeGX Rocks!"));
		
		if(WPAD_ButtonsDown(WPAD_CHAN_0)&WPAD_BUTTON_HOME)
		break;
		
		gwd.Flush();
	}
	
}

  int main(int argc, char **argv){
  
  SetUp();
  
  MainProgram();
  
  return 0;
  
  }

Upon, running the program via the homebrew channel, everything worked except that there was a different backgound than the one in my data folder. Here is a compiled version of the program set up to run in the HBC: click here. To use freetypegx in any of my apps, this problem desperately needs to be corrected. Unfortunately, I do not know what to do. Maybe I'm overlooking something obvious, but any ideas? I appreciate any and all help offered.

EDIT: FreetypeGX is found here. The font I used was the one included in the .zip file.
EDIT 2: Forum software does not allow me to properly show my #include directives above. So "<" has been replaced with "*". Thanks to IcyVeins for the fix.



Edited 7 time(s). Last edit at 12/04/2008 09:16PM by Arikado.
Re: FreeTypeGX and libwiisprite test program -- weird results
December 04, 2008 10:38AM
You seem to have some badly damaged include directives there.
Re: FreeTypeGX and libwiisprite test program -- weird results
December 04, 2008 10:42AM
Quote
henke37
You seem to have some badly damaged include directives there.

That's the forum software screwing up his post, not a problem with his code. It chops out anything between the < >, thinking it's html of some sort.
Re: FreeTypeGX and libwiisprite test program -- weird results
December 04, 2008 05:41PM
Quote
Arikado
#include *stdio.h>
#include *stdlib.h>
#include *gccore.h>
#include *wiiuse/wpad.h>
#include *fat.h>
#include *wiisprite.h> // The main libwiisprite header.
#include "FreeTypeGX.h"

replaced ,,<" with ,,*" :)



Edited 1 time(s). Last edit at 12/04/2008 05:41PM by IcyVeins.
Re: FreeTypeGX and libwiisprite test program -- weird results
December 04, 2008 07:13PM
We need new forum software then.
Re: FreeTypeGX and libwiisprite test program -- weird results
December 04, 2008 09:10PM
I've edited the first post according to IcyVeins suggestion.



Edited 1 time(s). Last edit at 12/04/2008 09:11PM by Arikado.
Re: FreeTypeGX and libwiisprite test program -- weird results
December 05, 2008 11:38PM
I tried a different truetype font, and once again, I was given a different background. I changed the color of the background I wanted to use to dark blue, and I noticed a blotch of red in the different background?!? I put the line background->Draw() after freeTypeGX->drawText(10, 25, _TEXT("FreeTypeGX Rocks!"));
freeTypeGX->drawText(10, 25, _TEXT("FreeTypeGX Rocks!"));
background->Draw();
and I was still presented with the same results as before. That totally doesn't make any sense, since drawing my background should cover the screen with my background and not with the freeTypeGX background and text.

All I want this program to do is to print black text across a white background (640x480, created on paint by yours truly) using a font.



Edited 2 time(s). Last edit at 12/05/2008 11:42PM by Arikado.
Sorry, only registered users may post in this forum.

Click here to login