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 - prchakal

Pages: 1 ... 7 8 [9] 10
121
General discussions / GUI - Whats the best os most used GUI
« on: November 28, 2010, 06:06:28 am »
I want a gui that is easy to use, and is easy to change the theme/skin/template.

Like the GUI of game M.A.R.S., made with sfml.

I want a GUI that do all of that game do, or all that a game need. GUI based on images.

122
Window / SFML 2 - Bug when exit
« on: November 28, 2010, 06:04:46 am »
The code of my basic test is:

Code: [Select]

#include <stdlib.h>
#include <iostream>
#include <SFML/Graphics.hpp>
#include <SFML/System.hpp>
#include <SFML/Window.hpp>


int main(int argc, char** argv)
{
sf::RenderWindow Game(sf::VideoMode(800, 600, 32), "Teste");
   
while (Game.IsOpened())
{

sf::Event event;
        while (Game.GetEvent(event)) {

            if (event.Type == sf::Event::Closed)
                Game.Close();
            if ((event.Type == sf::Event::KeyPressed) && (event.Key.Code == sf::Key::Escape))
                Game.Close();
        }

Game.Display();
        Game.Clear();

}

    return EXIT_SUCCESS;
}



Is only you create a new project with VS 2008 and SFML 2.

Project type: Console

Put this code on main.cpp.

Compile and run.

Press ESC or close the window.

You will get the error on IDE:



You will get the error executing out of IDE:



Its all details.

123
General discussions / GUI - Whats the best os most used GUI
« on: November 27, 2010, 10:35:51 pm »
Hi,

Whats the best os most used GUI library?

Im using sfml2

124
Window / SFML 2 - Bug when exit
« on: November 27, 2010, 10:30:16 pm »
Hi,

I get an error when i click CLOSE button of window of my game.

Line of code that get error (WglContext):

Code: [Select]
   
// Destroy the window if we own it
    if (myWindow && myOwnsWindow)
        DestroyWindow(myWindow);


Main file:

Code: [Select]

#include <SFML/System.hpp>
#include <iostream>

#include "Planet.h"
#include "GameObjects.h"

int main()
{
    sf::RenderWindow App(sf::VideoMode(800, 600, 32), "Solo Defender");

sf::Clock Clock;
   
Planet *planet = new Planet();

while (App.IsOpened())
{
        sf::Event Event;
        while (App.GetEvent(Event))
        {
            // Close window : exit
            if (Event.Type == sf::Event::Closed)
                App.Close();
        }

App.Clear();

App.Draw(planet->sprite);

        App.Display();
    }

    return EXIT_SUCCESS;
}




What can be?

125
General / Problems building "Using CEGUI In SFML" tutorial c
« on: December 18, 2008, 09:20:02 pm »
Now need only the tutorial to compile with mingw
ahaha

126
General / Problems building "Using CEGUI In SFML" tutorial c
« on: December 16, 2008, 02:32:57 pm »
Can you post a tutorial to compile with mingw too ?

127
Graphics / Problem with tiles and performance
« on: December 14, 2008, 02:48:36 pm »
I have the same performance problem here:

http://www.sfml-dev.org/forum/viewtopic.php?t=816&highlight=performance

In my game in SDL i do it easy , with the same logic and with floors, and this problem dont exists.

The problem is on DRAW method, too many DRAW call cause it.

Where is the problem? SFML ? Me and the author of this post? The creator?

I try the same with on a new pc, on SVN release, and the problem is the same.

128
General / Several performance problem!!!
« on: December 14, 2008, 02:21:55 pm »
Im creating a gui lib for my game with sfml:

So, i have created the button and textbox, and if fully perfect.

So, im creating now the window class, that will create a window on screen.

But when i will draw the parts of the window, the problem occurr, too many memory is used and the game is so slowly...too slowly...

But, if i comment the lines that draw the sprite(sprite->draw), the game run normals, with good performance, with no problem.

The code is:

Code: [Select]

#include "Janela.h"

/**
 * Construtor
 */
gui::Janela::Janela(unsigned int posX, unsigned int posY, std::string titulo, float largura, float altura, bool modal, bool movel, std::string imagem)
{
    //inicializa atributos
    this->posX    = posX;
    this->posY    = posY;
    this->titulo  = titulo;
    this->largura = largura;
    this->altura  = altura;
    this->modal   = modal;
    this->movel   = movel;

    if (!this->img.LoadFromFile(imagem))
    {
        //não foi possível carregar a imagem
    }

    //inicializa SPRITEs
    this->sprtSuperiorEsquerdo.SetImage(this->img);
    this->sprtSuperiorMeio.SetImage(this->img);
    this->sprtSuperiorDireito.SetImage(this->img);
    this->sprtEsquerdo.SetImage(this->img);
    this->sprtDireito.SetImage(this->img);
    this->sprtFundo.SetImage(this->img);
    this->sprtInferiorEsquerdo.SetImage(this->img);
    this->sprtInferiorMeio.SetImage(this->img);
    this->sprtInferiorDireito.SetImage(this->img);

    //inicializa RECTs
    this->rectSuperiorEsquerdo = sf::IntRect(0,0,11,24);
    this->rectSuperiorMeio     = sf::IntRect(58,0,81,24);
    this->rectSuperiorDireito  = sf::IntRect(224,0,235,24);
    this->rectEsquerdo         = sf::IntRect(0,79,11,85);
    this->rectDireito          = sf::IntRect(224,79,235,85);
    this->rectFundo            = sf::IntRect(10,143,37,170);
    this->rectInferiorEsquerdo = sf::IntRect(0,171,6,177);
    this->rectInferiorMeio     = sf::IntRect(91,171,97,177);
    this->rectInferiorDireito  = sf::IntRect(229,171,235,177);

    //define RECTs
    this->sprtSuperiorEsquerdo.SetSubRect(this->rectSuperiorEsquerdo);
    this->sprtSuperiorMeio.SetSubRect(this->rectSuperiorMeio);
    this->sprtSuperiorDireito.SetSubRect(this->rectSuperiorDireito);
    this->sprtEsquerdo.SetSubRect(this->rectEsquerdo);
    this->sprtDireito.SetSubRect(this->rectDireito);
    this->sprtFundo.SetSubRect(this->rectFundo);
    this->sprtInferiorEsquerdo.SetSubRect(this->rectInferiorEsquerdo);
    this->sprtInferiorMeio.SetSubRect(this->rectInferiorMeio);
    this->sprtInferiorDireito.SetSubRect(this->rectInferiorDireito);

}

/**
 * Destrutor
 */
gui::Janela::~Janela()
{
    //dtor
}

/**
 * Método que desenha o objeto
 */
void gui::Janela::desenhar()
{
    if ( this->visivel == true )
    {
        //inicializa variáveis de uso
        float x, y, xFinal, yFinal;

        //desenha o fundo primeiro
        x = 0;
        y = 0;

        xFinal = (this->posX + this->largura);
        yFinal = (this->posY + this->altura);

        while( (x + this->posX) < xFinal)
        {

            while( (y + this->posY) < yFinal)
            {
                //valida pra ver se não vai estourar
                if ((x + this->posX + this->sprtFundo.GetSize().x) > xFinal)
                {
                    x = (x + this->posX + this->sprtFundo.GetSize().x) - xFinal;
                }

                if ((y + this->posY + this->sprtFundo.GetSize().y) > yFinal)
                {
                    y = (y + this->posY + this->sprtFundo.GetSize().y) - yFinal;
                }

                //desenha
                this->sprtFundo.SetPosition(x + this->posX, y + this->posY);
                gui::Core::app->Draw( this->sprtFundo );

                y += this->sprtFundo.GetSize().y;
            }

            x += this->sprtFundo.GetSize().x;
            y = 0;

        }

        //desenha bordas repetitivas

            //borda superior
            x = 0;
            y = 0;

            while( (x + this->posX) < xFinal)
            {
                if ((x + this->posX + this->sprtSuperiorMeio.GetSize().x) > xFinal)
                {
                    x = (x + this->posX + this->sprtSuperiorMeio.GetSize().x) - xFinal;
                }

                this->sprtSuperiorMeio.SetPosition(x + this->posX, this->posY);

                gui::Core::app->Draw( this->sprtSuperiorMeio );

                x += this->sprtSuperiorMeio.GetSize().x;
            }

        //desenha as bordas dos cantos
        this->sprtSuperiorEsquerdo.SetPosition( this->posX, this->posY );
        this->sprtSuperiorDireito.SetPosition( this->posX + this->largura - this->sprtSuperiorDireito.GetSize().x, this->posY );

        this->sprtInferiorEsquerdo.SetPosition( this->posX, this->posY + this->altura - this->sprtInferiorEsquerdo.GetSize().y );
        this->sprtInferiorDireito.SetPosition( this->posX + this->largura - this->sprtInferiorDireito.GetSize().x, this->posY + this->altura - this->sprtInferiorDireito.GetSize().y );

        gui::Core::app->Draw( this->sprtSuperiorEsquerdo );
        gui::Core::app->Draw( this->sprtSuperiorDireito );
        gui::Core::app->Draw( this->sprtInferiorEsquerdo );
        gui::Core::app->Draw( this->sprtInferiorDireito );


    }
}

/**
 * Método que verifica os status do teclado/mouse
 */
void gui::Janela::verificarInput()
{
    if ( this->visivel == true )
    {
        //
    }
}




What can be happen?

129
General / Problems building "Using CEGUI In SFML" tutorial c
« on: December 14, 2008, 11:52:25 am »
You compile and its function OK ?

Can you test with mingw? I need it too much.

130
General / Problems building "Using CEGUI In SFML" tutorial c
« on: December 13, 2008, 07:24:50 pm »
But you compile cegui with sfml on mingw ?

131
General / How to draw a part of sf::String
« on: December 12, 2008, 02:40:23 pm »
Solved:

Code: [Select]

void gui::CaixaTexto::desenhar()
{
    //desenhar texto
    if (this->senha == false)
    {
        this->caixaTexto.SetText(this->texto);
    }
    else
    {
        this->caixaTexto.SetText( gui::Util::strpad(this->texto, '*', this->texto.size()) );
    }

    sf::String caixaTextoTemp(this->texto);
    caixaTextoTemp.SetStyle( this->caixaTexto.GetStyle() );
    caixaTextoTemp.SetSize( this->caixaTexto.GetSize() );
    caixaTextoTemp.SetPosition( this->caixaTexto.GetPosition().x, this->caixaTexto.GetPosition().y );
    caixaTextoTemp.SetText( this->caixaTexto.GetText() );

    string tempStr = this->texto;

    if (this->senha == true)
    {
        tempStr = gui::Util::strpad(tempStr, '*', tempStr.size());
    }

    while ( caixaTextoTemp.GetRect().GetWidth() > this->largura )
    {
        tempStr.erase(0,1);
        caixaTextoTemp.SetText(tempStr);
    }

    gui::Core::app->Draw(caixaTextoTemp);

    //desenhar marcador
    if ( this->piscarMarcador == true && gui::Core::foco == this )
    {
        sf::Shape sh=sf::Shape::Line(caixaTextoTemp.GetPosition().x + caixaTextoTemp.GetRect().GetWidth() + 2, caixaTextoTemp.GetPosition().y + 3, caixaTextoTemp.GetPosition().x + caixaTextoTemp.GetRect().GetWidth() + 2, caixaTextoTemp.GetPosition().y + this->altura, 2, sf::Color(255, 255, 255));
        gui::Core::app->Draw(sh);
    }

}

132
General / How to draw a part of sf::String
« on: December 12, 2008, 01:24:45 pm »
Clip strings:
Code: [Select]

sf::String teste(this->texto);
teste.SetStyle( this->caixaTexto.GetStyle() );
teste.SetSize( this->caixaTexto.GetSize() );

teste.SetPosition( this->caixaTexto.GetPosition().x, this->caixaTexto.GetPosition().y );

teste.SetText( this->caixaTexto.GetText() );

string tempStr = this->texto;

while ( teste.GetRect().GetWidth() > this->largura )
{
        tempStr = this->texto.substr(1, tempStr.size()-1);
        this->caixaTexto.SetText(tempStr);
        teste.SetText( this->caixaTexto.GetText() );
}


gui::Core::app->Draw(teste);


Im doing it, but dont is perfect.

133
General / How to draw a part of sf::String
« on: December 12, 2008, 12:38:47 pm »
Im creating a little gui lib, and i dont know how i can draw a part of my sf::String.

For example:

My textBox(sf::String) will have the text: 1234567890ABC, but i want show only a part of it, only the last 5 digits: 90ABC.

How i do it?

134
General / Problems building "Using CEGUI In SFML" tutorial c
« on: December 12, 2008, 12:32:48 pm »
I want it too :)

But i want compile on mingw, but no success.

135
General / Portugues Keyboard - Support
« on: December 12, 2008, 11:46:50 am »
Dont need more, i have solved.

But u can try it:

Code: [Select]


wstring test;
test = L"coração";  //  <-error

sf::String textBox;
sf::Font font;

if (!font.LoadFromFile("dados\\fontes\\tahoma.ttf"))
{
     //failed
}

textBox.SetText(test);
textBox.SetSize(12);
textBox.SetFont(font);



Conclusion, you can put in WSTRING some portuguese letters, or if you force with cast, occur the same problem.

Solution: use only STRING on SetText.

Pages: 1 ... 7 8 [9] 10