Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: [Sources] Rich text  (Read 17898 times)

0 Members and 1 Guest are viewing this topic.

panithadrum

  • Sr. Member
  • ****
  • Posts: 304
    • View Profile
    • Skyrpex@Github
    • Email
[Sources] Rich text
« on: August 10, 2010, 09:00:40 pm »
sfe::RichText Allows the user to draw paragraphs of text with mixed styles and colors.

The source code is found in this git repository: https://github.com/Skyrpex/RichText.

You are invited to contribute using the issue tracker.

Have fun!
« Last Edit: February 26, 2014, 10:27:22 pm by panithadrum »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: [Sources] Richt text
« Reply #1 on: July 24, 2012, 01:55:15 am »
I could have created a new thread, but I thought to give all the credit to panithadrum and keep the 'history' clear I'll bump this old thread. ;)

I've converted the class using an old version of SFML 2 from the old wiki to the latest SFML 2 version and added it to the GitHub wiki (unfortunatly the titles still don't get updated correctly).

- A RichText class

This class can still get some improvements, so feel free to do so. ;)
« Last Edit: October 18, 2012, 03:59:34 pm by eXpl0it3r »
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

panithadrum

  • Sr. Member
  • ****
  • Posts: 304
    • View Profile
    • Skyrpex@Github
    • Email
Re: [Sources] Rich text
« Reply #2 on: July 24, 2012, 06:30:40 am »
I forgot about that class 8) Thanks for the conversion!

It would be cool if someone fixes the return carriage thing. Maybe I will do myself, but I'm quite busy this month.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: [Sources] Rich text
« Reply #3 on: July 24, 2012, 08:04:18 am »
Quote
unfortunatly the titles still don't get updated correctly
The GitHub guy answered me about this: they changed how title work, and now the page name is shown as the main title, regardless of whether there is a level-1 title (one #) or not.

So it seems that the whole naming convention has to be changed, you must use "human friendly" page names directly.
Laurent Gomila - SFML developer

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: [Sources] Rich text
« Reply #4 on: July 24, 2012, 11:12:28 am »
I forgot about that class 8) Thanks for the conversion!

It would be cool if someone fixes the return carriage thing. Maybe I will do myself, but I'm quite busy this month.
Hehe no problem, maybe I'll look into it.

@Laurent: Will you give out new directives?
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
Re: [Sources] Rich text
« Reply #5 on: July 24, 2012, 11:30:20 am »
Looks great!

I've 2-3 remarks though.  ;D

Wouldn't vector be more efficient here (instead of list) ? (Insertion is only at the end so it's should be O(1) most of the time, and iteration is quite frequent in this class so it should be faster with continuous memory.) I know that at this scale it doesn't really matter which collection you use but it's a good programming practice.

On the style level, using a typedef std::somecollection<sf::Text> CollectionType; would allow changing the collection in one line editing.

Last remarque : using sf as the namespace is quite confusion IMHO. If someone sees an example alone he would think RichText is part of SFML itself and when he will try to use it he will get errors without understanding why.

And I say it again : great job, this is really useful !
SFML / OS X developer

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: [Sources] Rich text
« Reply #6 on: July 24, 2012, 12:56:23 pm »
Last remarque : using sf as the namespace is quite confusion IMHO. If someone sees an example alone he would think RichText is part of SFML itself and when he will try to use it he will get errors without understanding why.
Hehe I knew you would bring that up. ;D
But I fully agree with you. It kind of is like trying to put some code into the std namespace (which isn't allowed afaik).  ;)

Btw Hirua, will you consider porting your sources from the old wiki to the new one?
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Ceylo

  • Hero Member
  • *****
  • Posts: 2325
    • View Profile
    • http://sfemovie.yalir.org/
    • Email
Re: [Sources] Rich text
« Reply #7 on: July 24, 2012, 01:24:06 pm »
It's probably quite another level but I guess it would be interesting to read real RTF files and to be able to display them. librtf seems to do a good part of the job.
Want to play movies in your SFML application? Check out sfeMovie!

Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
Re: [Sources] Rich text
« Reply #8 on: July 24, 2012, 01:42:47 pm »
Btw Hirua, will you consider porting your sources from the old wiki to the new one?
Yes, I might do that later this summer if I have enough free time (it has been on my mind since a few months now but time is running out so fast...).
SFML / OS X developer

panithadrum

  • Sr. Member
  • ****
  • Posts: 304
    • View Profile
    • Skyrpex@Github
    • Email
Re: [Sources] Rich text
« Reply #9 on: July 26, 2012, 01:12:21 pm »
I felt like creating a git repository so... https://github.com/Skyrpex/RichText

You are invited to contribute!

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: [Sources] Rich text
« Reply #10 on: July 26, 2012, 01:28:40 pm »
I felt like creating a git repository so... https://github.com/Skyrpex/RichText
Nice! :)

Btw you could update the first post of yours, adding the new wiki page & the git repository.

Also it's now questionable if the wiki page is really needed or if we should just link to your repository...
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

panithadrum

  • Sr. Member
  • ****
  • Posts: 304
    • View Profile
    • Skyrpex@Github
    • Email
Re: [Sources] Rich text
« Reply #11 on: July 26, 2012, 01:46:06 pm »
Btw you could update the first post of yours, adding the new wiki page & the git repository.
Done!

Also it's now questionable if the wiki page is really needed or if we should just link to your repository...
I've just edited the wiki page to link to the repository, but I think it should move from source code to projects.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: [Sources] Rich text
« Reply #12 on: July 26, 2012, 01:52:40 pm »
I've just edited the wiki page to link to the repository, but I think it should move from source code to projects.
Then do so! :P
The wiki is the territory of the users. ;)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

panithadrum

  • Sr. Member
  • ****
  • Posts: 304
    • View Profile
    • Skyrpex@Github
    • Email
Re: [Sources] Rich text
« Reply #13 on: February 24, 2014, 08:09:52 pm »
Hey guys!

FYI, I've released version 2.0.0 that mainly fixes the newline bug.

Have fun!

 

anything