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

Pages: [1]
1
SFML projects / Re: Just another Tower Defense
« on: June 10, 2013, 07:24:30 pm »
Thank you all for the replies. :)

@up
Okay, no problem. But I'm warning - there are some parts of my code, of which I am not really proud. I can blame a bit the requirements from my teacher, and lack of time at the end (deadline), but after all, I wrote it by myself, and it's the first game which I have written.

I am wondering: what part of code are you especially interested in?

//deleted

2
SFML projects / Just another Tower Defense
« on: June 07, 2013, 12:11:44 am »
I made a project of simple game using SFML and TGUI to my college. Upgrade and Sell button actions are not implemented yet.

The game is not balanced, I just wanted to share what I have already done. Enjoy. :)

http://tnij.org/kf21




3
Yes, you are right of course, but I thought that I cannot iterate via the list, when the function is completely const (that was my mistake, and that's why I asked this question).

I've already implemented the destructor which take care about memory, so it is not a problem for me right now, but I'll take your idea into consideration.

Thank you for your advice, right now my game has some static Sprites, but I'm thinking about some animations. When I decide to implement this feature I'll look at Thor (but I think AnimatedSprite from wiki should be enough for my needs). ;)

4
I still have a lot to learn, thank you. :)

5
C'mon it was seriously that simple? I'm sorry for my stupidity and lack of knowledge, I just assumed that const_iterator is not incrementable and I haven't even tried that.

Thank you for your really fast answer, everything is working now, this topic can be removed.

6
General / Why sf::Drawable::draw is a complately const function?
« on: May 21, 2013, 01:17:44 am »
I've searched this forum for similar topics, but I haven't found any.

virtual void draw(sf::RenderTarget& target, sf::RenderStates states) const;

I'd like to know why? I'm asking because right now I have a problem, because of this little "const", here is a preview of this issue:
Wave.h
class Wave :
        public sf::Drawable
{
private:
        std::list<Enemy*> enemies;
[...]
public:
        virtual void draw(sf::RenderTarget& target, sf::RenderStates states) const;
}
In Wave.cpp I would like to draw every enemy in wave.
void Wave::draw(sf::RenderTarget& target, sf::RenderStates states) const
{
        std::list<Enemy*>::iterator temp = enemies.begin();

        for(temp; temp != currentEnemy; temp++)
        {
                target.draw(**temp);
        }
}

But there is an error:
Quote
Error   1   error C2440: 'initializing' : cannot convert from 'std::_List_const_iterator<_Mylist>' to 'std::_List_iterator<_Mylist>'

Looks like one does not simply iterate the const list. ;) (there is a problem with initializing iterator "std::list<Enemy*>::iterator temp = enemies.begin();", without const it works, but it cannot initiate abstract class)

If you have any advices how to workaround this problem, please write them.

PS
Is the AnimatedSprite included in standard version of SFML, or I have to copy it by myself?

PS2
Sorry for my lame English.

PS8
If the section on forum is wrong, please move this topic (I wasn't sure where to put it).

7
SFML projects / Re: TGUI: a c++ GUI for SFML (with Form Builder)
« on: April 30, 2013, 09:14:41 pm »
Thank you for your reply, I'll try to cope with simple pictures.

However the correct way to do the inheritance it this:
struct myObj : public tgui::Object
{
    typedef SharedObjectPtr<myObj> Ptr;
};

I expect that there will be only a minor difference with inheriting from tgui::Object::Ptr directly, namely the use of the dot or the arrow operator.
You are right, but with inheritance from tgui::Object::Ptr I can simply make an object in this way:
MyObj nameofobject(tguiWindow);
(I have to call init method inside constructor to do it)

I'm sure your version is "more correct", but I have some problems with setting text into the label inside my statusbar, so I'll leave it as it is right now (inherited from Ptr).

8
SFML projects / Re: TGUI: a c++ GUI for SFML (with Form Builder)
« on: April 30, 2013, 05:12:16 pm »
I want to add the button, with the icon, something like this:


Then the button should have method like setImage/setIcon. Maybe it could be done by pushing callback from image downward to the button?

If you ever decide to inherit something, don't inherit from the Ptr (it won't even compile).
That's strange, because I'm using this in my TD. :)
I made my own class Statusbar, which inherits from tgui::Panel::Ptr. Inside id has its own objects, it seems to work pretty well. I had a problem when I set inheritance from tgui::Panel, because I didn't know know do add it (Suatusbar) later to the tgui window. I can show you my code to make it more clear. ;)

But in the future there will be a turorial about writing custom objects in v0.6 and there it will be explained.
Ok, great, I'm looking forward to it. :)

9
SFML projects / Re: TGUI: a c++ GUI for SFML (with Form Builder)
« on: April 30, 2013, 02:39:49 pm »
Sorry for the second reply, but I have another problem. I need a button with background image/texture.

AFAIK there is nothing like this in tgui, but maybe there is a workaround for it? Or maybe it is a good idea to make my own ImageButton class? I assume inheritance from tgui::Button/tgui::Button::Ptr is a bad idea (?).

10
General discussions / Re: SFML 2 and its new website released
« on: April 29, 2013, 09:23:23 pm »
Site looks awesome, great job, keep it up! :)

11
SFML projects / Re: TGUI: a c++ GUI for SFML (with Form Builder)
« on: April 29, 2013, 02:53:22 pm »
Thank you for your answers. I thought VS somehow includes the main TGUI dir, when I do everything like in the tutorial. Yet, the example code didn't work, because of the wrong paths, and I had to manually change them to direct paths. Thanks! :)
(maybe you (texus) should add this information in tutorial, for future newbies like me ? ; )

I'm not sure where the working directory is in visual studio (I haven't been on windows for some time). I think it is the folder that contains your project file
Yes it is by default (..\Visual Studio 2012\Projects\[project name]\[project name]), when you run your app via Debugger, but when you run via explorer, it's the executable dir.

12
SFML projects / Re: TGUI: a c++ GUI for SFML (with Form Builder)
« on: April 29, 2013, 12:56:54 pm »
Thanks for fast reply.  Ok, I don't need setOrigin that much, because there is a simple workaround for this method.

You're right, my version is about 1month old, I'll download the latest one. ;-)

Hm, that's weird, it works fine for me too... Then I don't know how I provoked this issue. And since I already fix that by changing the code I can't take it back.  :-\
I'll try to find what was the problem and if I found it, I'll notice you.

I have another question. How to make loading like this work?
loadingBar->load("TGUI/objects/LoadingBar/Black");
I mean the path, because right now it gives me an error:
Quote
TGUI error: Failed to open TGUI/objects/LoadingBar/Black/info.txt
and I have to give the direct path to the folder with object. I work with VS2012 on Win7.

13
SFML projects / Re: TGUI: a c++ GUI for SFML (with Form Builder)
« on: April 29, 2013, 11:30:31 am »
@texus
First of all - many thanks for this library, this is the best-looking GUI for the sfml I have found. I'm currently making some tower defence game and it really helped me.

Ok, but that's not why I'm writing this post. I found some issues, and I decided to write them down inhere.

So, your library has problems with the inherited functions, for example in Label, when you use setOrigin method, it does not set the origin, but instead of that it moves the text in label so that the origin you have set is in the top-left corner (I'm assuming it happens in every other GUI element, but I haven't checked that). Maybe a picture will show it in the better way:


Also, in the loading bar, when you use setText method it works well, but when you move loading bar (setPostition method), it does not move the text, but only the loading bar, and the text is not show when it's out of bounds.

I have one question too: when you will release the next version? I'm asking because on your site you have written:
Quote
WARNING: I am depreciating the above code because it will no longer work in the future. Read the alternative usage to find out how you should use tgui::Window. If you use the method below then you will only need minor changes when I effectively make the planned design change.
But it doesn't work right now.

Regards :)

PS
Sorry for my English, I hope you understand all.

Pages: [1]