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

Pages: 1 2 3 [4]
46
General discussions / Visuel c++ 2010
« on: December 12, 2009, 10:07:02 pm »
Is it possible to let it work, I just tried to use the 2008 libary from the none svn but it ain't working :(

47
General / What am I doing wrong here ?
« on: November 11, 2009, 11:48:51 am »
I am trying to make a sprite point to the place where I click but it just seems to point upward when I click somewhere, I know it updates the sprite cause in the beginning stage its about 45 degrees and then when I click it points upwards.

Code: [Select]

// The class which needs to update
Cockpit::Cockpit()
{
std::cout << "Cockpit" << std::endl;
    turningspeed = 4;
direction = 0.f;
if (!Image.LoadFromFile("Cockpit.png"))
{
std::cout << "Error loading image file !" << std::endl;
}
sprite.SetImage(Image);
sprite.SetScale(0.5f,0.5f);
float Width  = sprite.GetSize().x;
float Height = sprite.GetSize().y;
sprite.SetRotation(direction);
sprite.SetCenter(Width/2, Height/2);
sprite.SetPosition(400.f,300.f);
x,target_x = 400;y,target_y,y = 300;
}

void Cockpit::Think(sf::RenderWindow &Render)
{
direction = atan2(target_y-y,target_x-x)*180/PI;
sprite.SetRotation(direction);
}
// Inputmanager
void InputManager::Think(sf::RenderWindow &Render)
{
const sf::Input &Input = Render.GetInput();
mouse_x = Input.GetMouseX();
mouse_y = Input.GetMouseY();
mouse_right = Input.IsMouseButtonDown(sf::Mouse::Right);
sprite.SetPosition(mouse_x,mouse_y);

if (mouse_right == true)
{
hold_right += Render.GetFrameTime();
}
if (mouse_right == false && hold_right > 0)
{
if (hold_right >= 0.5)
{
hold_right = 0;
std::cout << "Window" << std::endl;
} else {
hold_right = 0;
player->Goto(mouse_x,mouse_y);
}
}

if(Render.GetEvent(Event))
{
if (Event.Type == sf::Event::Closed)
Render.Close();

if((Event.Type == sf::Event::KeyReleased) && (Event.Key.Code == sf::Key::Escape))
Render.Close();

if (Event.Key.Code == sf::Key::F1)
{
sf::Image Screen = Render.Capture();
Screen.SaveToFile("screenshot.jpg");
}
}

}


Anybody knows what I am doing wrong ?

48
Window / Changing the Cursor
« on: November 02, 2009, 08:40:13 pm »
How would you hide the cursor  :?:

49
Window / Input
« on: November 02, 2009, 05:31:16 pm »
I got some code



world.hpp
Code: [Select]

#ifndef WORLD
#define WORLD

#include <iostream>
#include <vector>
#include <SFML/Graphics.hpp>
#include "BaseEnt.hpp"
#include "Cockpit.hpp"

class World
{
private:
sf::Input& Input;
sf::Event Event;
sf::RenderWindow GameWindow;
public:
std::vector<BaseEnt*> Entities;
World();
void Draw();
void Think();
void CreateCockpit();
sf::RenderWindow &GetApp() {return GameWindow;}
};

#endif

world.cpp
Code: [Select]

#include "world.hpp"

World::World()
{
GameWindow.Create(sf::VideoMode(800,600,32),"Space Snapper",sf::Style::Close,sf::WindowSettings(8,24,2));
GameWindow.SetFramerateLimit(100);
Input = GameWindow.GetInput();
std::cout<<"World Created !" << std::endl;
}

Errors :
    1>c:\users\quincy\documents\visual studio 2008\projects\space snapper\space snapper\world.cpp(4) : error C2758: 'World::Input' : must be initialized in constructor base/member initializer list
    1>        c:\users\quincy\documents\visual studio 2008\projects\space snapper\space snapper\world.hpp(13) : see declaration of 'World::Input'

I know this is something with initializers lists but I still don't know how to fix it.

50
Graphics / Png loading.
« on: September 04, 2009, 05:45:24 pm »
When I try to open my png file it says :

Failed to load image "Images/world.png". Reason : interlaced

Whats up with that ? :(

51
Graphics / Font help
« on: August 31, 2009, 05:10:40 pm »
Quote from: "Laurent"
Did you define SFML_DYNAMIC?


Uhmmm, No ?

Also I calculated the fps and rounded it, how would I convert+add it to the string.

52
Graphics / Font help
« on: August 31, 2009, 04:55:28 pm »
Im trying to create my own font, but since I added the font part it gives me this error :

1>sfml.obj : error LNK2001: unresolved external symbol "private: static unsigned int * sf::Font::ourDefaultCharset" (?ourDefaultCharset@Font@sf@@0PAIA)

Code

Code: [Select]

#include <SFML/Graphics.hpp>
#include <SFML/System.hpp>  
#include <iostream>
 
class Debug    
{    
private:    
    sf::RenderWindow& Render;  
    sf::String Text;  
    sf::Font IDK;

public:    
    Debug(sf::RenderWindow& app);    
    void Draw();  
};  
   
Debug::Debug(sf::RenderWindow& app) : Render(app)  
{  
if (!IDK.LoadFromFile("arial.ttf"))
{
std::cout<<"Cannot load font !";
}

    Text.SetText("FPS :");    
    Text.SetFont(sf::Font::GetDefaultFont());    
    Text.SetSize(10);    
    Text.SetPosition(5.f, 5.f);  
Text.SetColor(sf::Color(0,0,0,255));
}    
   
void Debug::Draw()  
{  
    Render.Draw(Text);    
}


This code is called by a sfml.cpp

the IDK part is cause I thought it may had to do something with the name.

Pages: 1 2 3 [4]