Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - dbest

Pages: [1]
1
Graphics / The new font class
« on: March 17, 2008, 07:09:29 pm »
Got it thanks...
fixed it with
Code: [Select]
TextString.SetFont(Font); in the constructor.


Thanks a lot.. :)

2
Graphics / The new font class
« on: March 17, 2008, 04:27:54 pm »
The code is all over the place.. i hope thats not a problem..

main.cpp

Code: [Select]
int main()
{
      /// Create the main window
    sf::RenderWindow App;

    App.Create(sf::VideoMode(SCREENWIDTH, SCREENHEIGHT, 32), "SFML Window", sf::Style::Fullscreen);

    CText Text;
....
....
Text.Plot(App,"UITILE", 200,0,128,200,10,15);



text.h

Code: [Select]
class CText {
    private:
    sf::String TextString;
    sf::Font Font;

    public:
    CText();
    ~CText();

    ///Create text string with size and color
    void Plot(sf::RenderWindow& App, char text[10], int r, int g, int b, int x, int y, int size=20);
};


text.cpp

Code: [Select]
#include "Text.h"

CText::CText()
{
  Font.LoadFromFile("cheeseburger.ttf");
  sf::String TextString(L"",Font);
}

CText::~CText()
{
}


void CText::Plot(sf::RenderWindow& App, char text[10], int r, int g, int b, int x, int y, int size)
{
     //sf::String TextString(L"",Font);
    TextString.SetText(text);
    TextString.SetSize(size);
    TextString.SetColor(sf::Color(r,g,b));
    TextString.SetPosition(x,y);

    App.Draw(TextString);
}


If i uncomment the sf::String TextString(L"",Font); line in the Plot function, then the cheeseburger.ttf font is used, else the default font is used.

3
Graphics / The new font class
« on: March 17, 2008, 03:44:39 pm »
It worked once I initialed Text after the RenderWindow is constructed.
But i still need to set the Font to the string in the Plot function. It does not work if the Font is assigned to the string in the constructor. Its not a big deal, as the FPS is still the same. :)

Thanks for your help..

4
Graphics / The new font class
« on: March 17, 2008, 10:59:00 am »
Yups, i think i didnt :(

Okies, i dont have the system with me, rite now, as I am in the office... but this is as best as I can remember..

in CText.h
Code: [Select]

class CText {

private:
sf::Font Font;
sf::String TextString;

public:
CText();
~CText();

Plot(sf::RenderWindow& App, char text[10], int r, int g, int b, int x, int y, int size);
};


The code i posted in ma previous mail is CText.cpp.

The summarized main.cpp is like this:

Code: [Select]
#include "CText.h"

CText Text;

int main()
{
..........
..........

Text.Plot(App,"text here", 255,255,200, 200, 20, 22); --> This is where i call the function
App.Draw();
}



I hope i have answered your question... so help me please... :)

5
Graphics / The new font class
« on: March 17, 2008, 05:56:51 am »
Using the code from the SVN, i have added only the FONT object and intialized the STRING object with the "cheeseburger.ttf" font.

When I used the same code without the modifications mentioned above and compiled it with SFML release 1.2, it worked fine.

The code as posted above, should now by default use arial.ttf and plot fine. But it does not.. :(

6
Graphics / The new font class
« on: March 16, 2008, 09:34:10 pm »
Didnt want to start a new thread, so i hope its ok if i hijack this one..

Am working on the code from the SVN, i have compiled the libs.

Am having an issue with the String class.

I have have the following functions.
Code: [Select]

//constructor to load the string with the required font
CText::CText()
{
 //  Font.LoadFromFile("cheeseburger.ttf");
 //  sf::String TextString(L"",Font);
}
//to plot the text on the screen
void CText::Plot(sf::RenderWindow& App, char text[10], int r, int g, int b, int x, int y, int size)
{
  //  Font.LoadFromFile("cheeseburger.ttf");
  //  sf::String TextString(L"",Font);
    TextString.SetText(text);
    TextString.SetSize(size);
    TextString.SetColor(sf::Color(r,g,b));
    TextString.SetPosition(x,y);

    App.Draw(TextString);
}




When the font is loaded in the constructor, the text is not plotted clearly on the screen. The output is all blobby, looks like square.
The text is plotted clearly when i load the font into the string in the Plot function.


Does anyone else face this issue?

7
General / wxWidget and SFML
« on: March 15, 2008, 07:25:42 am »
Thanks Laurent..
Missed something real stupid there.. lol...

I explicitly stated which class should be used there, and the code compiles. Will keep adding the SFML functions to the code now.

8
General / wxWidget and SFML
« on: March 14, 2008, 10:18:44 pm »
Have been trying to compile some code that would allow me to integrate xWidgets and SFML.

I first tried the sample wxwidget code in the SFML SDK, and added the compiler, linker parameters for wxwidget, and the the sample widget was built. But the application does not execute and an error message comes up: "The application failed to initialize properly. (0xc000005)"

I also tried to work from the sample wxWidget code from their library. I just added sf::RenderWindow to the code
Code: [Select]
class wxtestFrame: public wxFrame, public sf::RenderWindow
to the code and this is the error the compiler threw up:
In member function `virtual bool wxtestApp::OnInit()':
request for member `Show' is ambiguous
candidates are: virtual bool wxWindowBase::Show(bool)
virtual bool wxWindow::Show(bool)
virtual bool wxTopLevelWindowMSW::Show(bool)
void sf::Window::Show(bool)

I am using Code::Blocks with mingw
Any tips guys..

9
SFML projects / War for Water - RTS Game
« on: March 12, 2008, 01:05:19 pm »
Thanks for the wishes guys

Quote from: "Lord Delvin"
Looks nice, but i think, as widescreens are more and more popular, a layout like

+--+-----------------+
| M |                      |
| E |                      |
| N |     Content      |
| U |                      |
+--+-----------------+

would be nicer and easier to use.
Is the GUI hardcoded?


Have spoken to the team about the menu not being on horizontal, but vertical. I think its a good idea.

We have hardcoded the UI for now. We are open to using GUI libs as well.

Thanks once again.

10
SFML projects / War for Water - RTS Game
« on: March 10, 2008, 09:35:43 pm »
Heya...

Just got myself introduced to SFML about a month ago, and when my friends and me got together to make an isometric RTS game, we decided to use SFML.

This is where you will find more information regarding our project with a few screenshots:

http://wow.origo.ethz.ch/wiki/screenshots

Currently we are working on the map editor. We completed v0.1 of the map editor today and are pretty pleased with it. There will be more features added to the map editor soon.

More to follow.... 8)

11
SFML website / SFML website has moved
« on: February 28, 2008, 10:13:59 pm »
Hey Laurent...


Great work..

12
SFML projects / Demon's Eye
« on: February 18, 2008, 09:05:26 am »
Looking forward to this game...

I think i would also try something similar using SFML....

Pages: [1]