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

Author Topic: sf::Ram, sf::Cfg  (Read 4780 times)

0 Members and 1 Guest are viewing this topic.

panithadrum

  • Sr. Member
  • ****
  • Posts: 304
    • View Profile
    • Skyrpex@Github
    • Email
sf::Ram, sf::Cfg
« on: April 09, 2010, 09:40:12 pm »
I'm writing one or two projects using the namespace sf. One is a couple of functions like:
Code: [Select]
sf::Ram::GetTotalAmount();
sf::Ram::GetFreeAmount();

And the other is a class called sf::Cfg that opens/writes text files using this sintax:
Code: [Select]
Text.txt:
Group name {
    Field 1 = "Text value";
    Group 2 {
        Field 2 = "Value1", "Value2";
    }
}


Should I post'em in the wiki? It isn't multimedia related, so I ask first!

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
sf::Ram, sf::Cfg
« Reply #1 on: April 10, 2010, 10:26:17 am »
Sure you can :)
Laurent Gomila - SFML developer

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6288
  • Thor Developer
    • View Profile
    • Bromeon
sf::Ram, sf::Cfg
« Reply #2 on: April 10, 2010, 05:55:03 pm »
I would not use the namespace sf for own code. This might confuse users, as your functionality is not even multimedia-related (even if it were, I'd put code into another namespace).

Why not only Ram and Cfg? Or a specific framework name? Be creative ;)
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

panithadrum

  • Sr. Member
  • ****
  • Posts: 304
    • View Profile
    • Skyrpex@Github
    • Email
sf::Ram, sf::Cfg
« Reply #3 on: April 10, 2010, 07:34:13 pm »
Quote from: "Nexus"
I would not use the namespace sf for own code. This might confuse users, as your functionality is not even multimedia-related (even if it were, I'd put code into another namespace).

Why not only Ram and Cfg? Or a specific framework name? Be creative ;)

I do because this is the first time I don't try to make a set of classes encapsulating other libraries (I use SFML almost directly). Its functionality is great, so encapsulating it would be just renaming things. So, when I create other classes, I try to use that namespace, which means Simple and Fast (just what I'm looking for).  :D

gsaurus

  • Sr. Member
  • ****
  • Posts: 262
    • View Profile
    • Evolution Engine
sf::Ram, sf::Cfg
« Reply #4 on: April 11, 2010, 11:19:02 am »
Nexus is right.

Yes, envelop classes for SFML doesn't make much sense because it's interface is already simple. But that doesn't mean you should use sf namespace, specially if you're going to put code on the wiki, because we indirectly assume that sf namespace means the code is part of the SFML library.
It's like the std namespace, you probably use the standard C++ directly to build your own generic and "standard" functionalities, however you don't use std namespace for your own code.

So you can use SFML directly and still have your own distinguishable namespace, like pd (from panithadrum)
Pluma - Plug-in Management Framework

Mr. X

  • Jr. Member
  • **
  • Posts: 80
    • View Profile
sf::Ram, sf::Cfg
« Reply #5 on: April 12, 2010, 12:12:42 am »
Its depending on what you want:
If you want to extend SFML, why not put it into namespace sf? You could make a subnamespace for the code to seperate it while also showing the relationship between own code and SFML.

Ceylo

  • Hero Member
  • *****
  • Posts: 2325
    • View Profile
    • http://sfemovie.yalir.org/
    • Email
sf::Ram, sf::Cfg
« Reply #6 on: April 12, 2010, 12:34:55 am »
When expanding SFML features, I usually use sfe (for "sf extension"). I actually disagree with using the sf namespace because it would mean your work is part of the official SFML API.
Want to play movies in your SFML application? Check out sfeMovie!

coolhome

  • Jr. Member
  • **
  • Posts: 59
    • View Profile
sf::Ram, sf::Cfg
« Reply #7 on: April 12, 2010, 04:31:38 am »
You should add CPU usage into this.
CoderZilla - Everything Programming

panithadrum

  • Sr. Member
  • ****
  • Posts: 304
    • View Profile
    • Skyrpex@Github
    • Email
sf::Ram, sf::Cfg
« Reply #8 on: April 12, 2010, 08:09:58 am »
Quote from: "Mr. X"
Its depending on what you want:
If you want to extend SFML, why not put it into namespace sf? You could make a subnamespace for the code to seperate it while also showing the relationship between own code and SFML.

Actually that's what I intended to do when I read Nexus and Gsaurus opinions.

Namespace "sfe" is also OK. I think I will use it!

Coolhome, I'm also doing functions to check Cpu and Gpu info, and maybe something to check the OS name and build, etc!