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 - CBenni::O

Pages: 1 [2] 3 4
16
General / Visual Studio 2010 Libs
« on: July 18, 2010, 12:08:03 pm »
I could send them to you (SFML 2.0, quite new)

bye,

CBenni::O

17
Network / [Solved] FTP progressbar
« on: July 17, 2010, 07:50:41 pm »
How? Other users might want to know, or will you just wait for the SFML 2.0 release?

bye,
CBenni::O

18
Graphics / Problems with sf::Text
« on: July 17, 2010, 07:45:26 pm »
Got it!

This may not be minimal, but it may be short enough: (Compile with SFML 2.0)
Code: [Select]
#include <Windows.h>
#include <SFML/Graphics.hpp>

class style
{
public:
sf::Font Font;
int fs;
sf::Vector2f pos;
style()
: Font(sf::Font::GetDefaultFont()),fs(30),pos(sf::Vector2f(0.f,0.f))
{
}
};

class btn
{
public:
btn(std::string txt)
{
MyValue = sf::Text(txt,st.Font,st.fs);
}
void up()
{
MyValue.SetFont(st.Font);
MyValue.SetCharacterSize(st.fs);
MyValue.SetPosition(st.pos);
}
void add(std::string txt,int at)
{
std::string t=MyValue.GetString();
t.insert(at,txt);
MyValue.SetString(t);
}
void render(sf::RenderTarget* rt)
{
rt->Draw(MyValue);
}
style st;
private:
sf::Text MyValue;
};

int WINAPI WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPSTR lpCmdLine, int nShowCommand)
{
sf::RenderWindow App(sf::VideoMode(800,600),"Text Bug");
btn b1("Btn1");
b1.st.fs = 35;
b1.st.pos.x = 100;
b1.up();
btn b2("Btn2");
b2.st.fs = 25;
b2.st.pos.x = 400;
b2.up();
btn b3("Btn3");
b3.st.fs = 20;
b3.st.pos.x = 700;
b3.up();
while(App.IsOpened())
{
sf::Event e;
while (App.GetEvent(e))
{
std::string txt = " ";
switch(e.Type)
{
case sf::Event::Closed:
App.Close();
break;
case sf::Event::TextEntered:
txt[0] = (char)e.Text.Unicode;
b2.add(txt,2);
}
}
App.Clear();
b1.render(&App);b2.render(&App);b3.render(&App);
App.Display();
}
return 0;
}


bye,
CBenni::O

19
Graphics / Problems with sf::Text
« on: July 16, 2010, 04:37:43 pm »
Yes, I know... I'll try to extract something smaller...

bye, CBenni::O

20
Graphics / Problems with sf::Text
« on: July 16, 2010, 03:37:28 pm »
Hy,

I'm building some kind of GUI Framework using SFML 2.0 (quite a new revision, less than a week old) and had several Problems with drawing sf::Texts:

These Pictures show the Bug:
Pict1 (Starting Situation)
and Pict2 (After some Text Input)

Problem (as you can probably see) is that the fontsize isn't updated correctly. I haven't been able to Isolate some kind of minimal code reproducing this, I can Upload my code on request.

Has anyone ever have a similar Problem, is it a Bug in SFML 2.0 or what can I do about it?

Thanks ;)

bye, CBenni::O

21
General / Using SFML in Borland C++ Builder 6
« on: May 21, 2010, 03:36:12 pm »
Quote
[C++ Fehler] Utf.inl( 28 ): E2478 Für Template 'Utf<8>' wurden zu viele Template-Parameter deklariert


(I'm using the german version ;) translation see above)

But I have solved the Problem by using GDI+ instead... It just didn't work out :(
bye, CBenni::O

22
General / Using SFML in Borland C++ Builder 6
« on: May 21, 2010, 01:30:10 pm »
Well, yes,

There are several Messages, all in Utf.inl:
lines 28,76,129,138,153,167,181...

there are about 25 of these...

I think the borland Builder doesn't accept the definition of the Utf class-template, as the messages aren't limited only for Utf<8>, but Utf<16>, too.

EDIT: Is there any tutorial how to includ SFML in the Borland Builder? I haven't found any...

bye, CBenni::O

23
General / Using SFML in Borland C++ Builder 6
« on: May 21, 2010, 01:00:31 pm »
Hy,

I have been trying to install the SFML(2.0)-Graphics-part in Borland C++ Builder 6

I have found this german thread where I found out how to convert the SFML libs correctly.

But now I get lots and lots of compiler errors:
Quote
E2478 Too many template parameters were declared for template 'Utf<8>'


Double-clicking on the error leads me to Utf.inl...

This is what I included:
Code: [Select]
#pragma comment(lib, "sfml-systemB.lib")
#pragma comment(lib, "sfml-graphicsB.lib")
#pragma comment(lib, "sfml-mainB.lib")
#include "SFML/Graphics.hpp"
#include "SFML/System.hpp"


I do not hava a clue how to resolve this, I haven't changed anything of SFML exept for the .lib files...

Thanks for every Help ;)

bye, CBenni::O

24
SFML wiki / [Sources] Thread-safe Resource Manager
« on: May 12, 2010, 11:43:10 am »
Quote from: "Xorlium"
Hi,

I keep having problems with using sfml together with this.

So I can make an image manager. So I have the class ImageManager which inherits from ResourceManager.

Then I make a sf::Sprite sp, and suppose I have a boost::shared_ptr<sf::Image> im and I want to assign that image to the sprite. So I go sp.SetImage(*im). But then I get always the white rectangle, because the use count doesn't increase and the resource manager thinks it has the unique pointer to it, so it deletes it.

What can I do?


I had the same problem,
Either you have to lock every other thread while you load your picture (see the tutorial), or do what I did:

I have a ResourceManager-class with a Resourceloading-thread. It saves different kinds of resources, which all have a Load() and a Get() method.
The Load Method loads the image, despite the fact that it is useless ;)
The first call of Get() runs ths code:
Code: [Select]
MyImage.reset(new sf::Image(*MyImage.get()));
This works out fine ;)

If you want to download the whole Framework, click here
(It is in german, but I hope that works out somehow)

EDIT: Oh, I just saw, does using boost::shared_ptr solve the problem?

bye, CBenni::O

25
General discussions / Re: SFML 2.0 & Memory Leaks
« on: March 12, 2010, 11:49:46 pm »
Quote from: "Nexus"
Quote from: "CBenni::O"
I was playing a bit with the vld (Visual Leak Detector) and SFML, and this piece of Code (taken from the example Code) Throws 83 Memory Leaks!

[...]

Whats the matter?
It's highly probable that you applied the leak detector tool in a wrong way. You should get used to it, before you claim SFML. ;)


What have I done wrong, then? In the description of vld it only says that you simply have to add #include <vld.h> in the beginning of the file...

And usually it works :?

I'll try some more...

bye, CBenni::O

EDIT: If I take out everything which is related to sf::Text (creating and Drawing the String), there are no Memory-Leaks recorded

26
General discussions / SFML 2.0 & Memory Leaks
« on: March 12, 2010, 10:37:16 pm »
Hy,

I was playing a bit with the vld (Visual Leak Detector) and SFML, and this piece of Code (taken from the example Code) Throws 83 Memory Leaks!

Code: [Select]
#include <vld.h>
#include <SFML/Audio.hpp>
#include <SFML/Graphics.hpp>

int main()
{
// Create the main window
sf::RenderWindow App(sf::VideoMode(800, 600), "SFML window");
 
// Load a sprite to display
sf::Image Image;
if (!Image.LoadFromFile("cute_image.jpg"))
return EXIT_FAILURE;
sf::Sprite Sprite(Image);
 
// Create a graphical string to display
sf::Font Arial;
if (!Arial.LoadFromFile("arial.ttf"))
return EXIT_FAILURE;
sf::Text Text("Hello SFML", Arial, 50);
 
// Load a music to play
sf::Music Music;
if (!Music.OpenFromFile("nice_music.ogg"))
return EXIT_FAILURE;

// Play the music
Music.Play();
 
// Start the game loop
while (App.IsOpened())
{
// Process events
sf::Event Event;
while (App.GetEvent(Event))
{
// Close window : exit
if (Event.Type == sf::Event::Closed)
App.Close();
}
 
// Clear screen
App.Clear();
 
// Draw the sprite
App.Draw(Sprite);
 
// Draw the string
App.Draw(Text);
 
// Update the window
App.Display();
}
 
return EXIT_SUCCESS;

}


Whats the matter? Most of them appear to be inside of sf::Drawable...
bye, CBenni::O

27
Audio / Problems with sf::SoundBuffer
« on: March 10, 2010, 12:46:04 pm »
Quote from: "Laurent"
Quote
No, It's the final version of my framework...

Sorry, I'm lost. Is your problem solved now?


Yes, it is... But I don't know what the error was... It had something to do what I do with my Resource after Aquiring it...

Quote from: "Laurent"
I'm talking about your framework, not the demo (which is the only place where you use std::auto_ptr, right?). An example of memory leak is in FloatingObj: the image used by the sprite is allocated with new but never deleted.

You should really not allocate everything dynamically ;)


Yes, thank you... I've changed it... There ist only 1 dynamic Allocation per FloatingObj-Constructor now...

bye, CBenni::O

28
Audio / Problems with sf::SoundBuffer
« on: March 09, 2010, 06:02:29 pm »
No, It's the final version of my framework...

All I need to add is the Release ()-Function in ResourceManager, but this is no Problem...

And:
Quote from: "Laurent"
By the way, I looked at your code and there are indeed too many pointers and dynamic allocations ;)
None of them are really necessary, and you have many leaks because you don't destroy all the objects that you create with new.


Are you sure? I didn't find any Hidden memory leaks using vld, and auto_ptr or whatever does nothing else but to allocate and free Memory... And I Hate to return auto_ptr's, because you get More and more get()'s etc...

bye, CBenni::O

29
Audio / Problems with sf::SoundBuffer
« on: March 08, 2010, 11:23:14 pm »
Yes, I only use it in my example program, in all other cases I use some kind of RAII :D

Download of my Framework

bye, CBenni::O

30
Audio / Problems with sf::SoundBuffer
« on: March 08, 2010, 09:31:34 pm »
What I have above, is just a short snippet of a Program I used for testing... in my example Program (that I will release tonight :D), I use auto_ptr's if not local variables...

One good thing: my Framework does not have any memoryleaks and is exeption-safe (I hope so ;) ) thanks to "Effektiv C++ Programmieren"
Thank you for that tipp :)

bye, CBenni::O

Pages: 1 [2] 3 4