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

Pages: [1] 2
1
Feature requests / New class for SFML2: TextArea.
« on: December 22, 2009, 09:41:57 pm »
oh...I'm sorry...didn't realize it was polish. Anyways, keep up the good work :D

2
Feature requests / New class for SFML2: TextArea.
« on: December 22, 2009, 06:55:11 am »
woah the comments are in russian O_o

can you give a version with English comments plz?

3
Graphics / text wrapping?
« on: December 22, 2009, 05:13:34 am »
How do you get a long string of text to display inside a "box" using the sf::String? I want it to make a new line whenever it runs out of room for the next word so it doesn't go out of the "box"

Is there a simple way to do this?

4
General / [Solved] question
« on: December 18, 2009, 06:17:35 am »
Ohhhh I see. So the Input class cannot be on it's own. Got it

Thanks :D

5
General / [Solved] question
« on: December 18, 2009, 03:47:08 am »
I'm not using events so I'm not calling GetEvent.

anyways,

Code: [Select]
int main()
{
lua_State* settings = lua.initialize_script("resource/scripts/settings.lua");

Game.initialize_app(settings, "Stick War");

while(Game.game_state == Game.Menu)
{
Input.update_mouse();
Input.update_keyboard();

if(Input.keyboard.esc)
{
Game.exit();
}

std::cout << Input.mouse.mouse_x << std::endl;
std::cout << Input.mouse.mouse_y << std::endl;

Game.App.Clear();
Game.App.Display();
}

Game.exit();
}


and the CGame class

Code: [Select]
class CGame: public CBase
{
public:

sf::RenderWindow App;

int game_state;

enum GameState{
Menu,
Setup,
Ingame
};

//create window
int initialize_app(lua_State* L, std::string app_name)
{
set_fullscreen(L);

if(fullscreen)
{
App.Create(sf::VideoMode(1024, 768, 32), app_name, sf::Style::Fullscreen);
}

else
{
App.Create(sf::VideoMode(1024, 768, 32), app_name);
}

return 0;
};

//call when app is closed
int exit(void)
{
App.Close();
return 0;
};



private:

int set_fullscreen(lua_State* L)
{
fullscreen = CScript::lua_retreive_boolean(L, "Fullscreen");

return 0;
};
bool fullscreen;


};


This is probably horrible coding, but please bear with me, as I'm still a beginner

6
General / Any Key and Settext
« on: December 17, 2009, 06:00:29 am »
I believe hotkeys are done by reading stored text files. (scripting)
This way the program can read/write the the text file to access/change the hotkeys.

7
General / [Solved] question
« on: December 17, 2009, 05:56:31 am »
Hmm odd. I'm having some problems. The input seems like it's not updating.

Here's my input class
Code: [Select]
class CInput
{
public:

const sf::Input& user_input;

struct Mouse
{
int mouse_x;
int mouse_y;
bool lmb;
bool rmb;
} mouse;

struct Keyboard
{
bool esc;
} keyboard;

void update_keyboard(void)
{
keyboard.esc = user_input.IsKeyDown(sf::Key::Escape);
};

void update_mouse(void)
{
mouse.mouse_x = user_input.GetMouseX();
mouse.mouse_y = user_input.GetMouseY();
mouse.lmb = user_input.IsMouseButtonDown(sf::Mouse::Left);
mouse.rmb = user_input.IsMouseButtonDown(sf::Mouse::Right);
};

CInput(sf::RenderWindow &app) : user_input(app.GetInput())
{
};

private:

};

CInput Input(Game.App);


And my main loop
Code: [Select]

while(Game.game_state == Game.Menu)
{
Input.update_mouse();
Input.update_keyboard();

if(Input.keyboard.esc)
{
Game.exit();
}

std::cout << Input.mouse.mouse_x << std::endl;
std::cout << Input.mouse.mouse_y << std::endl;

Game.App.Clear();
Game.App.Display();
}


It enters the loops but it seems like the update_mouse and update_keyboard functions is not working. The console writes 0 and when I press escape key nothing happens >_<

I'm guessing it has to do something with the user_input being a reference but I'm not sure

8
General / [Solved] question
« on: December 16, 2009, 06:11:01 am »
I'm getting this error

error C2678: binary '=' : no operator found which takes a left-hand operand of type 'const sf::Input' (or there is no acceptable conversion)
        C:\Documents and Settings\SFML-1.5\include\SFML/Window/Input.hpp(129): could be 'sf::Input &sf::Input::operator =(const sf::Input &)'
        while trying to match the argument list '(const sf::Input, const sf::Input)'

while trying to run this line

Code: [Select]
Input.user_input = Game.App.GetInput();

Here's my class and constructor

Code: [Select]
class CInput
{
public:

const sf::Input& user_input;


CInput(sf::RenderWindow &app) : user_input(app.GetInput())
{
};
};


what's going wrong here

9
Graphics / Processor gets hot and motherboard beeps
« on: December 06, 2009, 07:58:34 am »
is vsync on by default? I'm using App.setframerlimit(60) right after I create my window. (not in my loop)

My friends are reporting frame rates around 60-65. (It's running on 3 on my computer >_<)

what should I do?

10
General / framerate
« on: December 05, 2009, 05:32:05 am »
just wondering how SFML calculated frame rate? how does it know when one frame passed?

11
Graphics / 2d animation?
« on: November 29, 2009, 04:10:42 am »
How is 2d animation (playing a sequence of sprites in a set time frame) done is SFML?

12
General / sf::string
« on: November 29, 2009, 03:38:55 am »
oh, I get it. What if I just set the Font(not string) size really high? will it take up more resources and slow the program down?

13
General / sf::string
« on: November 28, 2009, 09:40:48 pm »
thanks for the answer!

Another problem I've run into with fonts is that when I set the size high (like 100) the text becomes blurry. I use a .ttf font.

Is there font types that uses vector graphics rather then raster graphics? can I load/use them with SFML?

Or is there any solution to increase the quality? (I'm quite fond of the font I'm using)

14
General / sf::string
« on: November 23, 2009, 01:43:51 am »
Thanks for the answers.

So anyway, I tried to create basic class that would let me display text.

 
Code: [Select]
class TextEngine{
public:
sf::Font Font;

std::string GetFont();
int CreateFont(std::string FileDir);
sf::String CreateText(sf::String Text, std::string String, float Size, float X, float Y);
int DisplayText(sf::RenderWindow Window, sf::String FileToDisplay);
};

std::string TextEngine::GetFont(){
std::string FileName;
lua_getglobal(Menu,"Font");
FileName = (std::string)lua_tostring(Menu, -1);
lua_pop(Menu, 1);

return FileName;
};

int TextEngine::CreateFont(std::string FileDir)
{
Font.LoadFromFile(FileDir);

return 0;
}

sf::String TextEngine::CreateText(sf::String Text, std::string String, float Size, float X, float Y){
Text.SetText(String);
Text.SetFont(Font);
Text.SetSize(Size);
Text.SetX(X);
Text.SetY(Y);

return Text;
};

int TextEngine::DisplayText(sf::RenderWindow Window, sf::String FileToDisplay){
Window.Draw(FileToDisplay);
return 0;
};


but whenever I try to use it, it gives me compiler errors that refers me to this "NonCopyable.hpp" page.

Am I accessing a private member? How do I fix this?

15
General / sf::string
« on: November 19, 2009, 07:32:42 am »
I'm trying to make "selectable text" meaning that when the mouse hovers over the words, it gets highlighted and stuff. However, the text is changing in length. How do I do this?

Is a way to figure out how much pixels each letter is or something?

Pages: [1] 2