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

Pages: [1] 2
1
General / Qt Creator and sfml
« on: July 12, 2010, 02:10:09 am »
hi i just had a quick question, i am using sfml with qt and everything is working fine except the images from sfml show up white when rendered in the window. i make sure that they load. they show up because i clear the color to green and they show up white with out am image... i was wondering if this was qt related or not. i use the qt creator to compile it but i configured it with the msvc2008 compiler so i think it uses that. i link against libs made in vc++ and im using sfml2

ok i had solved this for one of the windows but now my second child window will not load the image lol any one have an idea?

2
General / SOLVED
« on: June 19, 2010, 03:56:37 am »
i found my problem, i did not link properly to my lib in the release build and that caused this :)

3
General / yes
« on: June 19, 2010, 03:46:09 am »
you can type it in using
(char)event.Text.Uincode and adding it to a std::string  // sf::String::SetText(std_string + _char);

std::cout << _text.GetText(); // it will print the entered text


just giving you a map, it is simple you use event.Text.Uincode to get the typed char and typecast it to a char so you can add it to the current string in the set text function the use the get text function to get the data

4
General / link error
« on: June 19, 2010, 03:39:12 am »
i made my own lib from a project i want to use in the future and it was giving me a bunch of undefined refs so i made it a dll instead of a static lib and now it only gives me this error

obj\Release\ScriptConsole.o:ScriptConsole.cpp:(.text$_ZN3gui6ButtonD1Ev[gui::Button::~Button()]+0xe): undefined reference to `vtable for gui::Button'
collect2: ld returned 1 exit status

here is the Button class


Code: [Select]

#ifndef _BUTTON_H
#define _BUTTON_H

#include "UIState.h"

namespace gui
{
    class DLL_EXPORT Button
    {
        public:
            Button( float x, float y, float w, float h, std::string lua_script = "", std::string text = "" );
            ~Button();

            void SetPosition(float x, float y);
            void Render(sf::RenderWindow& window);
            void Update();

            void LetLuaUpdate(bool let) { _luaUpdate = let; }

            void Lock()     { _locked = true;   }
            void UnLock()   { _locked = false;  }

            inline bool Clicked();
            inline bool Hovering();
            inline bool Locked()    { return _locked; }

            void SetText(std::string text);
            float GetX() const { return _rect.Left;         }
            float GetY() const { return _rect.Top;          }
            float GetH() const { return _rect.GetHeight();  }
            float GetW() const { return _rect.GetWidth();   }

        private:
            sf::Font        _font;
            sf::Shape       _button;
            sf::Shape       _hoverRect;
            std::string     _textStr;
            std::string     _luaScript;
            sf::String      _text;
            bool            _locked;
            bool            _luaUpdate;
            sf::FloatRect   _rect;
            UIState*        _ui;
            LuaManager*     _lua;
    };
}

#endif




and the cpp file



Code: [Select]


#include "Button.h"

using namespace gui;


Button::Button(float x, float y, float w, float h, std::string lua_script, std::string text)
:
_ui(UIState::GetInst()),
_lua(LuaManager::GetInst()),
_rect(x,y,x+w,y+h)
{

    _textStr = text;
    _luaScript = lua_script;
    _luaUpdate = true;
    _font.LoadFromFile("system.ttf", 20);
    _text.SetFont(_font);

    _text.SetText(_textStr);
_text.SetCenter((_text.GetRect().Left + (_text.GetRect().Right - _text.GetRect().Left)/2),
(_text.GetRect().Top + (_text.GetRect().Bottom - _text.GetRect().Top)/2));

    _text.SetScale(0.45f,0.45f);

    SetPosition(x, y);
}

Button::~Button() {}

void Button::Render(sf::RenderWindow& window)
{
    window.Draw(_button);
if(Hovering())
window.Draw(_hoverRect);
window.Draw(_text);
}


void Button::SetPosition(float x, float y)
{
    _rect.Left = x;
    _rect.Right = x + _rect.GetWidth();
    _rect.Top = y;
    _rect.Bottom = y + _rect.GetHeight();
    _button = sf::Shape::Rectangle(_rect.Left, _rect.Top, _rect.Right, _rect.Bottom, sf::Color(200, 200, 200));

_hoverRect = sf::Shape::Rectangle(_rect.Left, _rect.Top, _rect.Right, _rect.Bottom, sf::Color(0,0,200,60));

_text.SetPosition(_rect.Left + _rect.GetWidth()/2, _rect.Top + _rect.GetHeight()/2);
}


void Button::Update()
{
    if(_luaUpdate)
    {
        if(Clicked())
        {
            _lua->DoFile(_luaScript);
            _ui->itemActive = 2;
        }
    }
}

bool Button::Clicked()
{
    return (
_ui->mouseX >= _rect.Left   &&
_ui->mouseX <= _rect.Right  &&
_ui->mouseY >= _rect.Top    &&
_ui->mouseY <= _rect.Bottom &&
_ui->mouseDown              &&
_ui->itemActive <= 1          // only allow one click a click (lol)
);
}

bool Button::Hovering()
{
    return (
_ui->mouseX >= _rect.Left   &&
_ui->mouseX <= _rect.Right  &&
_ui->mouseY >= _rect.Top    &&
_ui->mouseY <= _rect.Bottom
);
}

void Button::SetText(std::string text)
{
    _text.SetText(text);
}

5
General / i have the same problem
« on: June 19, 2010, 03:10:04 am »
i have been working on this for a long time now, i created a lib and now it gives me the errors. it did not before i tried linking to my own lib, i also made a dll and i get the same errors and it is pissing me off

6
SFML projects / just downloaded
« on: May 12, 2010, 11:38:51 pm »
i see you have an image manager lol sorry for the reply but i downloaded and it is loading SECT_MENU now ( is it soposto take long? ) oh well ill wait

7
SFML projects / nice
« on: May 12, 2010, 11:33:43 pm »
sounds sweet, i think you should prob implement an image/sound manager if you dont have one cause i found it makes everything much cleaner and nicer to use. ill check it out. p.s. sorry if the input on it was not a help cause i think you prob have it done already  :wink:

8
SFML projects / why not use lua?
« on: May 10, 2010, 03:10:04 am »
i program for 2 reasons, 1 is to have fun and 2 is to learn. creating my own scripting language provides me with the opportunity to do both. lua is great but i want to do something i can be proud of and learn a lot form.

p.s. im not reinventing the wheel im improving it, jk lua will own me but i prefer angle script to lua because you dont need to use a 3d party binding lib to export c++ classes and it is statically typed which makes your code much more understandable and less runtime errors.

9
SFML projects / update
« on: May 09, 2010, 05:12:55 pm »
i just finished a small part of the parser for my scripting lang! it handles if statements and variables lol. i am going to work on getting this into byte code before adding on to it, but i want at least while loops, functions, and maby classes

10
SFML projects / 3d game engine
« on: May 09, 2010, 04:19:54 pm »
i've been working on a 3d game engine for a few months now and it uses sfml for window and input, i made my own 3d model format and an exporter for blender and im currently working on creating a scripting language/engine for it. writing a scripting language is super hard and i may abort the mission lol but my engine currently supports a small amount of things. lighting, texturing, billboarding, 3d model loading ( 3ds, md2, cell(mine), obj ), input, game states, 3d math and some sound. much more to come

11
Graphics / sorry
« on: May 09, 2010, 04:05:47 pm »
i posted to see if i could get more input on it. i have been using sfml for a while and it has never happened before but now it is.

12
General / i have the same problem
« on: May 09, 2010, 04:02:09 pm »
i found that it is because the window is not being created but i dont know how to fix it... it never happened before but i was working an another project for a while and when i came back to sfml it happened

13
Graphics / Unexpected error at window.Clear();
« on: May 09, 2010, 05:58:20 am »
i have an unexpected error at window.Clear and it is only with projects that i recently compiled cause i can still run old exes.

Code: [Select]

_window.Clear();// fail here
_window.Draw(_page[_currentPage]);
_window.Display();


any help would be nice

14
Graphics / im having the same problem!
« on: May 09, 2010, 05:55:34 am »
did you find a fix yet?

15
General / Opengl OBJ C++ loader
« on: March 11, 2010, 06:10:40 am »
It is super easy to write your own just jive it a shot before getting one, the file is readable by humans so learn about reading files ( with std::ifstream ) and look for online tutorials. You will feel good if you write your own

Pages: [1] 2
anything