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

Pages: 1 ... 3 4 [5] 6
61
General / Debug: Program received signal SIGSEGV, Segmentation fault
« on: July 26, 2008, 10:47:56 am »
Hi,  :(

I get same strange problem with a my program so try to use debug and back-running go to try debug in samples of SFML.

I get error:
Quote
Program received signal SIGSEGV, Segmentation fault

in any programs when go to use debug function of CodeBlocks.

I see that problems begin when start to use graph with
Code: [Select]
sf::RenderWindow App(sf::VideoMode(800, 600, 32), "SFML Pong");
Probably is only a case.. I'm not an expert din debug/codeblocks so..

someone can help me please?
I just spent a lot of time for this.

I work on windows with: SFML1.3 / Code::Blocks / Mingw / gdb.exe.

I don't get any problem with simply programs that don't use library:
Code: [Select]
for ( i=1; i<=3; i=i+1 ) { printf("i=%d ",i); }

I can't found documentation about this online.. only a similar problem:
http://forums.comodo.com/bug_reports/conflict_with_gdb_debugger-t21329.0.html;msg147164


Now I make an simple code: new project with this code:
Code: [Select]
#include <SFML/Graphics.hpp>
int main() {
    sf::RenderWindow AppGr;
    return EXIT_SUCCESS;
}
and
Code: [Select]

#include <SFML/Window.hpp>
int main() {
    sf::Window App(sf::VideoMode(640, 480, 32), "SFML Window");
    return EXIT_SUCCESS;
}


This 2 simple codes have the same problem:
starting debug with initialize variable as sf::RenderWindow or sf::Window
generate SigSegV
if I remove variable init line debug can run property

Now I try other library and found that I haven't any problem
with Sockets sample in debug mode. Any debug function go right.


Thanks for any suggestion.

62
Graphics / Finding true Draw procedure/code for an OOP
« on: July 23, 2008, 12:51:52 pm »
1 000 000 :lol:  Thanks Wizzard for your quick and clear response.

Now I go to study and test all.

63
Graphics / Finding true Draw procedure/code for an OOP
« on: July 23, 2008, 08:08:47 am »
Many thanks Wizzard.  :lol:
This is type of answer that I finding.

Now I have to Study how to implement that
because I'm not a genius of OOP:
strategy with a List of sprites is only an idea
 that I think writing previous post.

Consider that:
- I have some sprite precedence.
- I have to draw some sf:String too (as last layer).
What type of list can I use?
Is better to use 2 separate list for sprites/strings?

What happen if I remove/add a sprite..
..I have to use some type of ordered list with precedence parameter?
Or..
Is true to generate list in every cicle using .draw metod
 as posted above to get ordered list?

Is better implement List and helper Functions for that
 in other class or as pure global?

Can you give me a 2line of "sprite list" code
to see if I have to use pointers or other?

PS:
How can I menage my 10 text of
 to put all of them with same Font setup?
At the moment I use only one sf:String, setup it
 and then modify many times text,x,y and draw it.

1000 Thanks

64
Graphics / Finding true Draw procedure/code for an OOP
« on: July 22, 2008, 01:35:35 pm »
Thanks,

but I have a more complex scenario.
I have 4 "impianto class(sprite)"..
..each class have:
16 "stazione class(sprite)"
x "telaio class(sprite)"
2 "carro class(sprite)"

I try to make a good OOP application.


I ask if, for OOP, is better to

a) draw all from main application finding and drawing all that have to be draw

b) simply call from main: impianto1.draw that go to call in transparent mode:
  stazioni.draw -> stazione1.draw.. stazione2.draw.. stazione3.draw..
  telai.draw      -> telaio1.draw.. telaio2.draw.. telaio3.draw..
  carro1.draw
  carro2.draw

Is more right to have objects capable of draw
or is better a separated object that scan all, get sprite data and draw?

Other option is to create a list of pointers to sprites of objects and pass that to main.draw

I find any strategic idea for that.. for my application and in general OOP.

Thanks

65
Graphics / Finding true Draw procedure/code for an OOP
« on: July 21, 2008, 04:49:02 pm »
Sure.. but my project is more complex and use many files and classes.
I don't put in forum only because I need a example guide for OOP.


globals.h:
Code: [Select]
static sf::RenderWindow rwin;
static sf::String sfs;



Trasporter.cpp:
Code: [Select]
#include <SFML/Graphics.hpp>
#include <cmath>
#include <sstream>
#include "globals.h"
#include "impianto.h"

int main() {
    rwin.Create( sf::VideoMode( 1024, 768, 32 ), "Trasporter" ); //globalVar
    sfs.SetSize( 24.f );  //globalVar with font setup
    sfs.SetColor( sf::Color( 0, 0, 200) );

    Impianto impianto;


    sf::Image BackgroundIm, ImpiantoIm, CarroIm, PinzaIm, VascaIm, FornoIm, TelaioSpIm, TelaioUsIm, TelaioPlIm, LineaIm;

    if (
        !ImpiantoIm.LoadFromFile("datas/trasporter/Impianto.png") ||
.............................................
        return EXIT_FAILURE;
    }

    sprBackground.SetImage(BackgroundIm);
    sprImpianto.SetImage(ImpiantoIm);
............................................
    // Ciclo programma
    bool IsRunning = true;
    while (IsRunning) { // Programma simulazione in funzione
        sf::Event Event;
        while (rwin.GetEvent(Event)) { // Controllo eventi finestra applicazione compresi tasti premuti
            if (Event.Type == sf::Event::Closed) IsRunning = false;
            if (Event.Type == sf::Event::KeyPressed) {
                switch (Event.Key.Code) {
                case sf::Key::Escape:
                    IsRunning = false;
                    break;
                default:
                    break;
                }
            }
        }

            dtFrame = rwin.GetFrameTime() * dtFrameVel/100.f;
            Stazioni_Gest();

        // Draw all ///////////////

        rwin.Draw(sprImpianto);  // OK

        impianto.draw(rwin);       // Fail: no error / not drawed

        rwin.Display(); // Display things on screen
    } // while IsRunning

    return EXIT_SUCCESS;
}




impianto.h
Code: [Select]
#ifndef IMPIANTO_H_INCLUDED
#define IMPIANTO_H_INCLUDED
#include <SFML/Graphics.hpp>
#include "stazione.h"
#include "carro.h"
using namespace std;

class Impianto {
public:
    Impianto();
    ~Impianto();
    float get_nstazioni() { return stazioni.size(); }
    void set_aut(int m);
    void set_ciclo(int m);
    void gest(float dt);

    void draw(sf::RenderWindow &);  // <<<<<<<

    void drawInfo();
    bool    aut;        // man / aut(Semia|Ciclo)
    bool    ciclo;      // Ciclo Automatico in esecuzione
    bool    VaCoppie;   // Vasche operanti a coppie
    int     dxEngage;   // dx Aggancio: se 0 usa metodo a Pinzatura Verticale
    int     iProgr;     // Programma Ciclo Aut
    int     tSgocc;     // Tempo di sgocciolamento sulle vasche
    Telai   telai;
    Stazioni stazioni;
    Carro   carroSx, carroDx;
};



impianto.cpp:
Code: [Select]
#include <cmath>
#include <string>
#include <SFML/Graphics.hpp>
#include "impianto.h"
#include "globals.h"
#include "futy.h"
using namespace std;

Impianto::Impianto() //Impianto crea lui Telai e Stazioni e Carri
:telai()
,stazioni()
,carroSx( telai, stazioni )
,carroDx( telai, stazioni ) {
    aut      = true;
    ciclo    = true;
    iProgr   = 1;
    VaCoppie = false;
    tSgocc   = 2;
    dxEngage = 6; // dxAggancio Telaio
    int i;
    std::stringstream ss, ssLog, ssKey;
    // Define the stations
    float dxst = stazioni.dxStazioni;
    int ist = 0;
    //Stazione& st = stazioni[0];
    //st = stazioni[ist];
    Stazione st;
    st.set_tipo( Stazione::CARICO );
    st.set_tOn( 1 );
    st.set_termoSet( 0 );
    for ( i=0; i<stazioni.nCarScar; i++ ) { // Carico
        st.set_name( "St" + tostring(i) + "\n" + "Ca" );
        st.set_pos( rifx + ((i-7)*dxst)-27 );
        stazioni.push_back(st);
    }
    st.set_tipo( Stazione::VASCA );
    st.set_tOn( 60 );
    for ( i=0; i<stazioni.nVasche; i++ ) { // Vasche
        st.set_name( "St" + tostring(i) + "\n" + "V" + tostring(i+1) );
        st.set_pos( rifx + ((i-7)*dxst)-27 );
        st.set_termoSet( 90-i*6 );
        stazioni.push_back(st);
    }
    st.set_tipo( Stazione::FORNO );
    st.set_tOn( 120 );
    st.set_termoSet( 120 );
    for ( i=0; i<stazioni.nCarScar; i++ ) { // Forno
        st.set_name( "St" + tostring(i) + "\n" + "F" + tostring(i+1) );
        st.set_pos( rifx + ((i-7)*dxst)-27 );
        stazioni.push_back(st);
    }
    st.set_tipo( Stazione::SCARICO );
    st.set_tOn( 1 );
    st.set_termoSet( 0 );
    for ( i=0; i<stazioni.nCarScar; i++ ) { // Scarico
        st.set_name( "St" + tostring(i) + "\n" + "Sc" );
        st.set_pos( rifx + ((i-7)*dxst)-27 );
        stazioni.push_back(st);
    }
// Define Carri properties
//    for (i=0;i<mCarri;i++) Carro_Init( carro[i], i );
    return;
};
Impianto::~Impianto() {
    return;
};

void Impianto::set_aut(int a) {
    aut = a;
};

void Impianto::set_ciclo(int c) {
    ciclo = c;
};

//--

void Impianto::gest(float dt) {
};


void Impianto::draw(sf::RenderWindow & prwin) { //<<<<<<<<<<<<<<
sf::Color cBackground( 0,255,0 );
rwin.SetBackgroundColor( cBackground ); // GlobalVar dont run
prwin.SetBackgroundColor( cBackground ); // Par.Var run ok
sfs.SetX(110);
sfs.SetY(110);
sfs.SetText("******************************************\n");
rwin.Draw(sfs);   // GlobalVar dont run
prwin.Draw(sfs); // Par.Var run Ok
};




I can pass "sf::RenderWindow & prwin"
to all objects but I find a clear OOP code.

I need other different classes that need to Draw..
..some of this is collected in Vector class..
I prefer to not pass "sf::RenderWindow & prwin"
through many and many classes if possible:
Vector class is only a collector class.

I simply ask for OOP tutorial similar to "Missile" class.
I need to mantain separate class functions and graph?

If you want to see my project, objects (classes now)
 I have the complete exe of version 1 without any class. (1MB)

Thanks in advance for any help.

66
Graphics / Finding true Draw procedure/code for an OOP
« on: July 21, 2008, 12:25:07 pm »
Hi.
I have just done a nice demo with SFML. :D
Now I want to convert all in OOP using classes..

I have some problem with function Draw of my
 20 sprites of 4 types in this application.

I used example in SFML Tutorial: "class Missile"

Now I have to Draw it but Class don't know
 static sf::RenderWindow.

I try to start using a Global variable in Global.h:
static sf::RenderWindow rwin;

but go right only in main application file..
 used in class Missile for ex is compiled
 but don't make anything.

No errors reported.

If I pass rwin (sf::RenderWindow) by reference of metod
all go right and I have my sprites.

But I have many classes of sprites (7)
and so I try to find a better metod.

At last I have a class Missili
derived from Vector to store many Missile class
and I have to draw all.

:?:
Is right to use a draw metod in classes or I have other to do.
How to pass rwin (sf::RenderWindow) in many classes of sprites (/Vector)

1000thanks.

67
Graphics / PNG loader might be broken in 1.2
« on: June 14, 2008, 11:48:50 am »
OK, Laurent.

I appreciate your SFML strategy :lol:

and your help in forum :P

Good work! Thanks.  :wink:

68
Graphics / PNG loader might be broken in 1.2
« on: June 13, 2008, 05:41:03 pm »
Hi, my test code is only an example.
I don't know GPU very well but
I don't understand why I can't load a simple image
 if others soft don't have this problem.

Now it's not a problem for me.. no urgency.. I only want to learn.

Thx Laurent

PS: There is a place to put my SFML program as picture or exe.
I love to share source but in this I put a firm reserved code.

69
Graphics / PNG loader might be broken in 1.2
« on: June 12, 2008, 09:32:52 pm »
Hi Laurent.
My dev friend said me that he try on ATI and IBM GPU of Laptop because now he use only Linux on the big PC.
Because now I have need to use it on laptop with a max graph of 1024..
I catted all big images and compress all texts.
I'm give that program to all my friends to test. ..
.. if you want to see what I do with your kindly SFML..


Now....
I made and tested new minimal test program
Can I send you .zip with im.png & .cpp & .cbp that I make for it?
Do you want to see my first application on SFML?

im.png is an image 1026x32 of 27kb

Program:
Code: [Select]
#include <SFML/Graphics.hpp>

int main() {
    sf::RenderWindow App;
    sf::String sfs;
    sf::Image im;
    App.Create(sf::VideoMode(1200, 900, 32), "Trasporter"); //1024x768
    if (!im.LoadFromFile("./im.png")) return EXIT_FAILURE;
    bool IsRunning = true;
    while (IsRunning) { // Programma simulazione in funzione
        sf::Event Event;
        while (App.GetEvent(Event)) { // Controllo eventi finestra applicazione compresi tasti premuti
            if (Event.Type == sf::Event::Closed) IsRunning = false;
            if (Event.Type == sf::Event::KeyPressed) {
                switch (Event.Key.Code) {
                case sf::Key::Escape:
                    IsRunning = false;
                    break;
                default:
                    break;
                }
            }
        }
        sfs.SetLeft(0);
        sfs.SetTop (0);
        sfs.SetText("OK, loaded! Press Esc to exit");
        App.Draw(sfs);
        App.Display();
    } // while IsRunning
    return EXIT_SUCCESS;
}




Thanks, Fixus

70
Graphics / PNG loader might be broken in 1.2
« on: June 12, 2008, 01:44:02 pm »
Hi Laurent.
I think at GPU issue but
 VideoMode(1200, 900, 32) go nicely if I resize background image.
On Win2000 PC I have a good radeon 9800
My friend (developer) have a good one and newer.

It seem a loading problem, not sprite problem.

emm.. can be a problem regarded to the windowed mode?

71
Graphics / PNG loader might be broken in 1.2
« on: June 12, 2008, 12:55:19 pm »
Hi.

I make a nice program with SFML but
I can't run it on some others PC:
go on: WinXP(old=full of applications) and other WinXP(office)
don't go: WinXP(of my developer friend), WinXP(new in office), WinXP(old), win2000.


 :!: I found the problem  in the x dimensions of image:
if I use images of any type greater than 1024 (pixel x)
I'm don't get any error but simply see that
win start and exit after 0.13secs.

I try to move files and put *.dll on many PC.

So.. witch file of SO can I check to work on others PC? :?:


Thanks Laurent

72
Feature requests / Gui package
« on: May 17, 2008, 12:39:19 pm »
:lol: Hi

I need to know how to implement a GUI (CEGUI or Guichan) with SFML

I see many forum and:
http://www.sfml-dev.org/forum/viewtopic.php?t=31&highlight=gui
http://www.cegui.org.uk/wiki/index.php/The_Beginner_Guide_to_Getting_CEGUI_Rendering

After a first response on SFML forum about CeGui, I can't found other.

Now, I'm an old developer (Spectrum and all others)
but I'm not expert of C++, SFML and other library mixing at the moment.

I continuously find code examples because I don't understand very well English but understand well source code of program.
but don't found good examples.. only pieces.  :cry:

I don't ask help usually if not need.. I don't want to stress you.

Can you help me with some code example or web pages so start use GUI in SFML, please?? :?:

Many-Thanks, Fixus   8)

73
Feature requests / Gui package
« on: May 16, 2008, 01:34:34 am »
Hi.
I hard study many forum/sites/..
but after a month my game (like Monopoly with.. and..) is waiting for a GUI solution.
I found SFML at the last and I see it's good and want to left Allegro and start with SFML but I need more examples.
I see Pong and others but I need a GUI.
I read that someone implemented Guichan / IMGUI on top of SFML
but I can't found 3 row of example code or post about this.
IMGUI attract me but now I don't see activity.

Can you suggest me something please?  :roll:

74
General discussions / Hi, I'm user n.500 ^_^ What I win?
« on: May 13, 2008, 12:52:46 am »
Hi, thanks
 and excuse
  but I need a small example to start use use CEGUI in SFML?

Now, can I make a new post in
 General, Feature requests, Window or Graphics :oops:
   for this 2D game request?

I lose hope sometime because I see a lot of post/work on 3D games, 2D big RPG games and very less on 2D as board games.

Here you made a good job! Please stay on! :lol:

Thanks. ^_^

75
Feature requests / Some features
« on: May 12, 2008, 10:18:00 pm »
Hi, thanks :P  and excuse but I cant found on web an example to implement CEGUI in SFML.
I only found someone that try with some problem: :oops:
http://www.cegui.org.uk/phpBB2/viewtopic.php?p=14435&sid=7cc8ae19a806c6bbf225840188920d4a

I see pictures..

I'm only need some point to start but I haven't time to hardcode too much.  
:roll: Where can found a minimal implementation of CEGUI in SFML?

Thanks.  :D

Pages: 1 ... 3 4 [5] 6