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

Pages: [1]
1
General / Problems building SFML-2.0
« on: February 22, 2010, 06:41:17 am »
Tried to build SFML2.0 on GNU/Linux Debian 64bit:

Code: [Select]
phraze@phraze-laptop:~/downloads/branches/sfml2$ make
make[1]: Entering directory `/home/phraze/downloads/branches/sfml2/src/SFML'
make[2]: Entering directory `/home/phraze/downloads/branches/sfml2/src/SFML/System'
g++ -shared -Wl,-soname,libsfml-system.so.2.0 -o ../../../lib/libsfml-system.so.2.0 Clock.o Lock.o Mutex.o Randomizer.o Sleep.o String.o Thread.o ThreadLocal.o Utf.o ./Unix/Initializer.o ./Unix/MutexImpl.o ./Unix/Platform.o ./Unix/ThreadImpl.o ./Unix/ThreadLocalImpl.o -lpthread
make[2]: Leaving directory `/home/phraze/downloads/branches/sfml2/src/SFML/System'
make[2]: Entering directory `/home/phraze/downloads/branches/sfml2/src/SFML/Window'
g++ -o Linux/ContextGLX.o -c Linux/ContextGLX.cpp -W -Wall -pedantic -g -O2 -DNDEBUG -I../../../include -I../../ -fPIC
Linux/ContextGLX.cpp: In member function 'void sf::priv::ContextGLX::CreateContext(sf::priv::ContextGLX*, unsigned int, const sf::ContextSettings&)':
Linux/ContextGLX.cpp:229: error: 'PFNGLXCREATECONTEXTATTRIBSARBPROC' was not declared in this scope
Linux/ContextGLX.cpp:229: error: expected `;' before 'glXCreateContextAttribsARB'
Linux/ContextGLX.cpp:230: error: 'glXCreateContextAttribsARB' was not declared in this scope
Linux/ContextGLX.cpp:239: error: 'GLX_CONTEXT_MAJOR_VERSION_ARB' was not declared in this scope
Linux/ContextGLX.cpp:240: error: 'GLX_CONTEXT_MINOR_VERSION_ARB' was not declared in this scope
Linux/ContextGLX.cpp:228: warning: unused variable 'name'
make[2]: *** [Linux/ContextGLX.o] Error 1
make[2]: Leaving directory `/home/phraze/downloads/branches/sfml2/src/SFML/Window'
make[1]: *** [sfml-window] Error 2
make[1]: Leaving directory `/home/phraze/downloads/branches/sfml2/src/SFML'
make: *** [sfml] Error 2


Help anyone?

2
Graphics / Drawing EXTREMLY Slow !
« on: February 22, 2010, 06:01:58 am »
Quote
Whenever i use sf::RenderWindow::Draw or sf::RenderWindow::Clear its like its raping my computer in the ass..

My code really does nothing except initializing a window.
Clear makes it uberslow, so i attempted to draw(sf::shape::rectangle(rectofscreen, blackcolor)) and it froze my computer completely !

I am running GNU/Linux Debian 64bit.
Tried with versions 1.3, 1.5 and 1.6, same results in 1.5 and 1.6, and it doesnt even work in 1.3.

(My ATI Drivers should work just fine, HD3200, Regnum gets 40~ fps at lowest, glxgears works just fine, lspci lists correct gpu-name)

I will attempt to install 2.0 instead, and return with more info.

EDIT: My attempted install of version 2.0 Failed, will post a thread about this for help.


Lol nvrmnd my code was bad, i didnt renderwindow->display every frame.
Would want to check out sfml2.0's features though so please answer my post in the General-section of the forum :)

3
Graphics / Software/Hardware-rendering?
« on: July 03, 2009, 08:17:39 am »
Im using a Radeon x1050 with ati's drivers, no problems in most games.

The game im writing on is a topdown shooter.
Doesnt use any graphics that SHOULD be heavy to render, only thing i can come to think about is a png image, 800x600, thats rendered every frame.. But that shouldnt be so bad?

The FPS in this game is dropping from 75(1000fps without vsync) to 37 fps :S

Here is the sourcecode to the whole game, i know its not that optimally coded, but i started writing on this just a few hours ago.
Code: [Select]

#include <SFML/System.hpp>
#include <SFML/Graphics.hpp>
#include <iostream>
#include <string>
#include <sstream>

template <class T>
inline std::string to_string (const T& t)
{
std::stringstream ss;
ss << t;
return ss.str();
}

sf::Image img_rocket;
sf::Image img_jet;
sf::Image img_fighter;
sf::Image img_bullet;
sf::Image img_sky;

sf::Image gui_wepstats_bg;
sf::Image gui_wepstats_nomiss;
sf::Image gui_wepstats_miss;

sf::Sprite sgui_wepstats_bg;
sf::Sprite sgui_wepstats_missile1;
sf::Sprite sgui_wepstats_missile2;
sf::Sprite sgui_wepstats_missile3;
sf::Sprite sgui_wepstats_missile4;
sf::Sprite simg_sky;

sf::Font fnt_debug;
sf::String str_debug;

float ElapsedTime;
int fps = 0;

int currpyl;
int pylonlimiter;
int pylonlimit = 10;

int currcan;
int cannonlimiter;
int cannonlimit = 4;
int currbull = 0;

typedef class rocket{
public:
bool active;
int speed;
sf::Sprite sprite;
};

typedef class pylon{
public:
float x;
float y;
rocket rcket;
};

typedef class jet{
public:
sf::Sprite sprite;
};

typedef class bullet{
public:
sf::Sprite sprite;
bool active;
};

struct fighter{
public:
sf::Sprite sprite;
pylon pylons[4];
jet jets[2];
bullet bullets[128];
void load();
void update();
};

void fighter::load(){
img_fighter.LoadFromFile("data/f22.png");
img_jet.LoadFromFile("data/f22jet.png");
img_rocket.LoadFromFile("data/missile.png");
img_bullet.LoadFromFile("data/bullet.png");

for(int i = 0;i < 128;i++){
this->bullets[i].sprite.SetImage(img_bullet);
}

this->sprite.SetImage(img_fighter);
this->sprite.SetPosition( (800/2) - this->sprite.GetCenter().x, 480 );


this->jets[0].sprite.SetImage(img_jet);
this->jets[1].sprite.SetImage(img_jet);

this->pylons[0].rcket.sprite.SetImage(img_rocket);
this->pylons[1].rcket.sprite.SetImage(img_rocket);
this->pylons[2].rcket.sprite.SetImage(img_rocket);
this->pylons[3].rcket.sprite.SetImage(img_rocket);
}

void fighter::update(){

if(currbull == 129){
currbull = 0;
}

this->pylons[0].x = this->sprite.GetPosition().x + 11;
this->pylons[0].y = this->sprite.GetPosition().y + 84;

this->pylons[1].x = this->sprite.GetPosition().x + 21;
this->pylons[1].y = this->sprite.GetPosition().y + 75;

this->pylons[2].x = this->sprite.GetPosition().x + 76;
this->pylons[2].y = this->sprite.GetPosition().y + 75;

this->pylons[3].x = this->sprite.GetPosition().x + 86;
this->pylons[3].y = this->sprite.GetPosition().y + 84;

for(int i = 0;i < 4;i++){
if(this->pylons[i].rcket.active == true){
//continue path for rocket
this->pylons[i].rcket.speed += 1200*ElapsedTime;
this->pylons[i].rcket.sprite.Move(0, -this->pylons[i].rcket.speed*ElapsedTime);
if(this->pylons[i].rcket.sprite.GetPosition().y < 0){
this->pylons[i].rcket.active = false;
switch(i){
case 0:
sgui_wepstats_missile1.SetImage(gui_wepstats_miss);
break;
case 1:
sgui_wepstats_missile2.SetImage(gui_wepstats_miss);
break;
case 2:
sgui_wepstats_missile3.SetImage(gui_wepstats_miss);
break;
case 3:
sgui_wepstats_missile4.SetImage(gui_wepstats_miss);
break;
}
}
}else{
this->pylons[i].rcket.speed = 0;
this->pylons[i].rcket.sprite.SetPosition(this->pylons[i].x, this->pylons[i].y);
}
}

for(int i = 0;i < 128;i++){
if(this->bullets[i].active){
this->bullets[i].sprite.Move(0, -1000*ElapsedTime);
if(this->bullets[i].sprite.GetPosition().y < 0){
this->bullets[i].active = false;
}
}else{
if(currcan == 0){
this->bullets[i].sprite.SetPosition(this->sprite.GetPosition().x+41,this->sprite.GetPosition().y+53);
}else{
this->bullets[i].sprite.SetPosition(this->sprite.GetPosition().x + 61,this->sprite.GetPosition().y+53);
}
}
}

this->jets[0].sprite.SetPosition( (this->sprite.GetPosition().x + 43), (this->sprite.GetPosition().y + 137) );
this->jets[1].sprite.SetPosition( (this->sprite.GetPosition().x + 53), (this->sprite.GetPosition().y + 137) );

if(currpyl == 4){
currpyl = 0;
}

if(pylonlimiter < pylonlimit){
pylonlimiter+= 100*ElapsedTime;
}

if(currcan == 2){
currcan = 0;
}

if(cannonlimiter < cannonlimit){
cannonlimiter+= 100*ElapsedTime;
}
}

int main(){
    sf::RenderWindow wind(sf::VideoMode(800, 600, 32), "fighterjet");
wind.UseVerticalSync(true);
wind.SetFramerateLimit(75);

fighter player1;
player1.load();

img_sky.LoadFromFile("data/clearsky.png");
simg_sky.SetImage(img_sky);

gui_wepstats_bg.LoadFromFile("data/hud_stats_bg.png");
gui_wepstats_miss.LoadFromFile("data/hud_miss.png");
gui_wepstats_nomiss.LoadFromFile("data/hud_nomiss.png");

sgui_wepstats_bg.SetPosition(8, 8);
sgui_wepstats_bg.SetImage(gui_wepstats_bg);

sgui_wepstats_missile1.SetPosition(8+15, 8+48);
sgui_wepstats_missile2.SetPosition(8+24, 8+44);
sgui_wepstats_missile3.SetPosition(8+56, 8+44);
sgui_wepstats_missile4.SetPosition(8+65, 8+48);

sgui_wepstats_missile1.SetImage(gui_wepstats_miss);
sgui_wepstats_missile2.SetImage(gui_wepstats_miss);
sgui_wepstats_missile3.SetImage(gui_wepstats_miss);
sgui_wepstats_missile4.SetImage(gui_wepstats_miss);

fnt_debug.LoadFromFile("tahoma.ttf");

str_debug.SetFont(fnt_debug);
str_debug.SetSize(24);

    while (wind.IsOpened())
    {
    str_debug.SetPosition(800-64,8);
    str_debug.SetText(to_string(fps));
fps = 1.f / wind.GetFrameTime();
    ElapsedTime = wind.GetFrameTime();
        sf::Event Event;
        while (wind.GetEvent(Event))
        {
            // Close window : exit
            if (Event.Type == sf::Event::Closed)
            {
                wind.Close();
            }
// F12 : Screenshot
if ((Event.Type == sf::Event::KeyPressed) && (Event.Key.Code == sf::Key::F12))
{
sf::Image Screen = wind.Capture();
Screen.SaveToFile("screenshot.jpg");
}

        }

if (wind.GetInput().IsKeyDown(sf::Key::Left))  player1.sprite.Move(-500 * ElapsedTime, 0);
if (wind.GetInput().IsKeyDown(sf::Key::Right)) player1.sprite.Move( 500 * ElapsedTime, 0);
if (wind.GetInput().IsKeyDown(sf::Key::Up))    player1.sprite.Move(0, -300 * ElapsedTime);
if (wind.GetInput().IsKeyDown(sf::Key::Down))  player1.sprite.Move(0,  300 * ElapsedTime);
if (wind.GetInput().IsKeyDown(sf::Key::X)){
// Cannon
if(cannonlimiter >= cannonlimit){
cannonlimiter = 0;
player1.bullets[currbull].active = true;
currcan++;
currbull++;
}
}
if (wind.GetInput().IsKeyDown(sf::Key::Z)){
// Missile
if(pylonlimiter >= pylonlimit){
pylonlimiter = 0;
player1.pylons[currpyl].rcket.active = true;
switch(currpyl){
case 0:
sgui_wepstats_missile1.SetImage(gui_wepstats_nomiss);
break;
case 1:
sgui_wepstats_missile2.SetImage(gui_wepstats_nomiss);
break;
case 2:
sgui_wepstats_missile3.SetImage(gui_wepstats_nomiss);
break;
case 3:
sgui_wepstats_missile4.SetImage(gui_wepstats_nomiss);
break;
}

currpyl++;
}
}


player1.update();

        wind.Clear();
        wind.Draw(simg_sky);

wind.Draw(player1.pylons[0].rcket.sprite);
wind.Draw(player1.pylons[1].rcket.sprite);
wind.Draw(player1.pylons[2].rcket.sprite);
wind.Draw(player1.pylons[3].rcket.sprite);

wind.Draw(player1.jets[0].sprite);
wind.Draw(player1.jets[1].sprite);

wind.Draw(player1.sprite);

for(int i = 0;i < 128;i++){
if(player1.bullets[i].active){
wind.Draw(player1.bullets[i].sprite);
}
}

wind.Draw(sgui_wepstats_bg);
wind.Draw(sgui_wepstats_missile1);
wind.Draw(sgui_wepstats_missile2);
wind.Draw(sgui_wepstats_missile3);
wind.Draw(sgui_wepstats_missile4);



wind.Draw(str_debug);

        wind.Display();
    }

    return EXIT_SUCCESS;
}

4
Graphics / Software/Hardware-rendering?
« on: July 03, 2009, 05:28:44 am »
Hey, i was just wondering if SFML is using software or hardware-rendering when using sf::renderwindow's and sf::sprites/sf::images and such.
I've noticed a lot of lag and low fps when it should be going smooth.

5
Graphics / in-game console, inputting text.
« on: May 21, 2009, 08:39:31 pm »
Quote from: "Hiura"
Use TextEntered event ( ? ) http://www.sfml-dev.org/tutorials/1.5/window-events.php


Okay, im going crazy about this.
How do you get exactly what is entered by text-entered ?

6
Graphics / in-game console, inputting text.
« on: May 20, 2009, 11:25:55 am »
Hey, im new to SFML, and pretty new to c++.

Im currently writing on the ingame console for a game,
and im having problems figuring out how to make the text-input part.

Do i need to write some type of keymapsystem ?

Any help or maybe links to tutorials would be highly appreciated!

Pages: [1]
anything