Author Topic: StringManager::DrawString(?)  (Read 3287 times)

jxv (OP)

  • *
  • Posts: 38
StringManager::DrawString(?)
« on: December 25, 2009, 05:11:14 pm »
I'm trying to print out "Hello World!" with StringManager. I able to compile this, but nothing prints. Does anyone know how to work this?


Code: [Select]
using namespace s2d;

...
...
...

StringManager* string = new StringManager();
Char *text = "Hello World!";
VisString* str = string->NewString(text);
string->Init(English,text);
string->SetVRAMPtr(m_pDraw2D->GetVRAMPtr(),320,240);
Rect rect;
rect.bottom = 240;
rect.top = 0;
rect.left= 0;
rect.right = 320;
Pixel pixel = Pixel(255,255,255);
string->DrawString(string->GetString(0),pixel,(Rect&)rect);


You might be wondering why I am using the first provided Dingoo SDK. Well, I am because I can test compiled programs on my computer before I put it on my dingoo for faster dev'ing.

darfgarf

  • Guest
Re: StringManager::DrawString(?)
« Reply #1 on: December 25, 2009, 05:14:45 pm »
hmm, make sure you're doing the rect right is all i can think of, different systems use different co-ordinate systems etc.

and it's probably just as fast to do code one window, terminals for compiling/telnet to dingoo, and an ftp client to do things to the dingoo

...but that's personal preference really :D


madcat1990

  • Guest
Re: StringManager::DrawString(?)
« Reply #2 on: December 25, 2009, 08:03:25 pm »
do you have a function to clean the display?

jxv (OP)

  • *
  • Posts: 38
Re: StringManager::DrawString(?)
« Reply #3 on: December 26, 2009, 12:08:24 am »
I would clear it with filling black or white pixels on the screen.

darfgarf

  • Guest
Re: StringManager::DrawString(?)
« Reply #4 on: December 26, 2009, 12:38:30 pm »
does the native system use some sort of screen buffer before actually displaying it, else you'd see it write lines of pixels to the screen

the equivalent of SDL_Flip(screen) for example, if it's just writing the pixels to the screenbuffer, but never flipping the buffer/updating the screen, then nothing will show, as nothing's actually being copied to the screen, jsut the buffer behind it...make some sorta sense?

jxv (OP)

  • *
  • Posts: 38
Re: StringManager::DrawString(?)
« Reply #5 on: December 27, 2009, 06:15:30 am »
This is my current one:

Code: [Select]

m_pImgS2d->CreateFromMemory(TF_TRUECOLOR,SPEX_WIDTH,SPEX_HEIGHT,v_buffer,sizeof(unsigned short),NULL);
m_pDraw2D->SetTexture( m_pImgS2d );
m_pDraw2D->DrawStretchOverlay(rcTest,NULL);
m_pImgS2d->Free();


It works when I put pixels into the buffer myself, but it doesn't work with the string manger?

joyrider

  • *
  • Posts: 220
    • Willems Soft
Re: StringManager::DrawString(?)
« Reply #6 on: December 28, 2009, 11:24:24 pm »
i used stringmanager in rubido :

as far as i can remember you needed to do the following :

1) goto the directory where stringmanager.exe file is located there should be a font.xml file
2) drag font.xml onto stringmanager.exe
3) select the font you want to use and it's size
4) copy the generated basefont.sbn file to your res folder (the res folder in your project dir, where build.bat etc is)
5) build the executable and make sure dlmake dlmake.ini is called as well so that the contents of the res folder is added your executable (if you use the original build files this should be no problem)

in code do the following :

Pixel *Color = new Pixel(50,50,250);
InitDLRes(); <-- will init the res folder so you can access files that you added using the res folder at build time
Sm = new StringManager();
Sm->Init(English,_LS(""));
Sm->SetVRAMPtr(g_pEng->m_pDraw2D->GetVRAMPtr(),320,240);
VisString *String = new VisString();
String->Append("hello world");
DstRect.left = 10;
DstRect.top = 10
DstRect.bottom =320;
DstRect.right = 240;
SM->DrawString(String,Color,DstRect);

it was something along those lines, also look at the doc files, you can probably create multiple font files if you repeat and rename the basefont.sbn file and use the InitBaseFont function. By default if you use init i thought it looked just at basefont.sbn, but i never tried using multiple generated font files, i just used a single sized font in rubido


it should work i used it in rubido like that. Also i noticed on my 64bit vista system that the stringmanager.exe program is death slow !! this can be fixed by editing the "compatibility options" of stringmanager.exe and set it to 256 display depth or something, experiment a little.
« Last Edit: December 28, 2009, 11:26:43 pm by joyrider »

jxv (OP)

  • *
  • Posts: 38
Re: StringManager::DrawString(?)
« Reply #7 on: December 29, 2009, 03:49:55 pm »
Thanks! It worked.

 

Post a new topic
Post a new topic