I've decided to learn sfml

Pages: 123
Mitch wrote:
WHATEVER YOU DO, don't use DirectX, it's going down hill, FAST.
M$ had been making a LOT of stupid choices recently, and DirectX is Microsoft ONLY!

Not only is OpenGL faster (proven), but it's better supported, more documented,
has an open licence, works on EVERYTHING, and isn't written by greedy M$!

When M$ dies (which it is, from Win8 to Xbox one), DirectX will fall with it anyways.


Sorry to tell, but you're wrong right here, as even a lot of other users are telling you.

Making a comparison in CS1.6 (who has support for both DX and OpenGL), OpenGL runs quite slower.
And I'm on a HD5450 right now.
Tests made by myself, no YouTube OpenGL fanboys' videos included.

I've never seen DirectX going "down hill".
Instead, I am really really stunned by the magnificient shader effects that game developers are able to give us, while mantaining the fps high.

Better support for OpenGL? I find OpenGL and DirectX supporting abilities balanced.
I even found that checking DirectX features is even easier than in OpenGL.

http://msdn.microsoft.com/en-us/library/windows/desktop/bb172513(v=vs.85).aspx

Also the DirectX are able to work on every kind of system configuration, as long as Windows is installed:

http://msdn.microsoft.com/en-us/library/windows/desktop/bb172547(v=vs.85).aspx

Microsoft is doing a really good job in programming.
It's just that people don't like them because... IDK.
People should just learn not to go mainstream, as the mainstream of today is to hate Microsoft.

This doesn't mean you should become a fanboy and buy all MS things.
But you should just be fair.

Still doubtful?

http://store.steampowered.com/search/?sort_by=Metascore&sort_order=DESC&category1=998&os=win
cire wrote:
And.. still wondering.

Figured it was obvious in less than a month of posting. Should I be concerned that you are still wondering after two years of posting?
I don't think anyone understands what I am saying... Though that is my fault.

Please, don't think I am saying that Microsoft (I use the '$' because it's true to MS) is nearly dead.
I am simply saying, that most of us will outlive MS. Have you not noticed how greedy they have gotten?

I DON'T THINK MICROSOFT IS GOING AWAY ANYTIME IN THE NEXT DECADE.
I am simply saying IT WILL DIE, and sooner then most people probably think


I never played the Xbox, but my uncle did, for years. And he isn't getting the Xbox One.
Why? Because it requires internet, you can't buy used games easily, and everything else.

My same Uncle (who loved Microsoft) will not be getting Windows 8, because it's simply... Well, you know (I hope).
And I feel the same way. I used to love Microsoft (I am still using Windows 7 OS), but my love is fading.


Also, I never had any issues with OpenGL, not "ambiguous errors", or lack of "tools".
OpenGL is cross-platform, and honestly is the way to go. How can someone say anything good about DirectX?


And please, don't say "DirectX is faster" because that is REALLY off.
I don't know what OS you are using, but I am pretty sure you have not tested it as much as me.

Simply Googling "is directx faster than opengl" will give you your answer.
closed account (o1vk4iN6)
Would've agreed before, but the things provided by SFML 2.0 gives you a bit more flexibility/lower-level support. Changing sf::Image to sf::Texture was a nice indicator of that. Still is pretty high-level, though.


That change still doesn't do much if anything at all. In both cases you don't know how image data is represented on the GPU or even how to get it onto the GPU. Filtering ? Nope. MipMaps ? Nope. If anything he just changed the naming convention to match that of OpenGL/Directx's Texture instead of Image.

I don't understand why OS creators wont get together to make code that is cross-platform.


There is Posix and the only one that doesn't really follow or support it is Windows.
Last edited on
Please. Stop.

I swear this happens every time. I don't know how asking for tutorials and learning resources turns into a directX v OpenGL debate. I swear some people act like 12 year olds on this forum.
Last edited on
Mitch wrote:
(I use the '$' because it's true to MS)


It's no more true for Microsoft than it is for any other successful corporation.
Ok I'd be cool if you guys would stop talking about off-topic things before this ends up being a thread about unicorns.
I don't know how asking for tutorials and learning resources turns into a directX v OpenGL debate.

Well it will always break down to this debate because ultimately you will have to make this debate with yourself and the goals of your project. Better to go into it having some knowledge from this debate than having to google for it later.
I swear some people act like 12 year olds on this forum.

I don't think that has the same impact when it comes from a person near the age range you pick.
Mitch wrote:
(I use the '$' because it's true to MS)

Like Disch said, all companies are greedy. You can look at grocery stores and see that, different companies charge more than another company. Greed controls them because if they didn't get more money they wouldn't be able to stay in business and make more products. Doesn't matter the industry, MS is just in the forefront because they are in the media more (people would say the same thing if a company did the same for a OS based off Linux).
Ok I'd be cool if you guys would stop talking about off-topic things before this ends up being a thread about unicorns.

I don't think that we are that flighty on topics to break into unicorn discussion :/.
Last edited on by closed account z6A9GNh0
Yeah, but I feel Microsoft is especially greedy...
**Sorry if my off-topic discussion offended anybody.

I like Windows, but not the new stuff...

Though it would mess up my (and a lot of other people's) recent developments,
I would probably rather Windows to go out of business.

Microsoft has gotten too greedy, they have horrible customer service, and Linux is simply better.
Linux is more efficient, better written, and customization like Windows never was.

Why use Windows? Because everyone else does, and thus there are more programs...
That is the only thing Microsoft has, and it's good enough for people to buy their product.


I really don't intend to start a debate.

Though I really have to say OpenGL is usually more powerful (faster), and cross-platform.
And I like SDL more than SFML, because it's smaller, and quite port-able!

I said before that it's more extendable, but I said that assuming SFML was closed source (I never looked into it).

Here is an article that expresses how I feel about OpenGL:
http://www.extremetech.com/gaming/133824-valve-opengl-is-faster-than-directx-even-on-windows
sam dhilion wrote:
Do u think i have made the right decision?

Probably yes,now you can really concentrate more on your Game then on low-level aspects , there are already much things in a game to be dealt with like physics , game-play etc. than fancy shaders and more efficient rendering.
After making a game or two you may opt to learn OpenGL(recommended) or DirectX.

SFML does encapsulates many things and does makes many things much easier but it shouldn't be seen as a downside , while making your first game you would want it to run and enjoy programming it.
What I mean is ...
This is what most people begin programming with.
1
2
3
4
5
6
7
8
//The classic hello world
# include <iostream>
 
int main()
{
   std::cout << "Hello, world!\n";
}


and not this...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
/*!
 * Hello world! application
 * 
 * \file hello.cpp
 */

#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <cassert>

/*!
 * Dispay message.
 */
void displayMessage();

/*!
 * Sentence type
 *
 * Type of sentence, used to decide how to terminate sentence.
 */
enum ESentenceType {
    eStatement,
    eExclamation,
    sQuestion,
    eCommand
};

/*!
 * Utility class to prevent unintended copying of class instances.
 */
class nonCopyable {
protected:
    nonCopyable() {
    }

    ~nonCopyable() {
    }

private:
    nonCopyable(const nonCopyable&);
    const nonCopyable& operator=(const nonCopyable&);
};

/*!
 * Utility function to obtain punctuation mark to end sentence
 * of specified type.
 */
inline char getPunctionMark(ESentenceType sentenceType) {
    char puncMark = '.';
    switch(sentenceType) {
        case eStatement  : puncMark = '.'; break;
        case eExclamation: puncMark = '!'; break;
        case sQuestion   : puncMark = '?'; break;
        case eCommand    : puncMark = '.'; break;
        default: {
            // should never get here
            assert(false);
        }
    }
    return puncMark;
}

/*!
 * Utility class for creation of instances.
 */
template<typename TElem>
class Creatable {
protected:
    Creatable() {
    }

    virtual ~Creatable() {
        clear();
    }

public:
    static TElem* create() {
        TElem* e = new TElem;
        return e;
    }

    void free() {
        delete this;
    }

    virtual void clear() {
    }
};

template<typename TElem, typename TParam>
class CreatableParam {
protected:
    CreatableParam() {
    }

    virtual ~CreatableParam() {
    }

public:
    static TElem* create(TParam p) {
        TElem* e = new TElem;
        e->initialize(p);
        return e;
    }

    void free() {
        finalize();
        delete this;
    }

    virtual void initialize(TParam /*p*/) {
    }

    virtual void finalize() {
        clear();
    }

    virtual void clear() {
    }
};

/*!
 * Base class for displayable content
 */
class DisplayElem
: public nonCopyable {
protected:
    DisplayElem() {
    }

    virtual ~DisplayElem() {
    }

public:
    virtual void display(std::ostream& os) const = 0;
};

/*!
 * STL algorithm for displaying elements
 */
class Displayer
: public std::unary_function<void, const DisplayElem*> {
private:
    std::ostream& m_os;
    char   m_sep;
    size_t m_count;

public:
    Displayer(std::ostream& os, char sep = '\0')
    : m_os(os)
    , m_sep(sep)
    , m_count(0) {
    }

    ~Displayer() {
    }

    void operator()(const DisplayElem* e) {
        if(('\0' != m_sep) && (0 < m_count)) {
            m_os << m_sep;
        }
        e->display(m_os);
        ++m_count;
    }
};

/*!
 * STL algorithm for freeing display elements
 */
template <typename TElem>
class Freer
: public std::unary_function<void, TElem*> {
public:
    void operator()(TElem* e) {
        e->free();
    }
};

/*!
 * Display element for letter.
 *
 * The letter is the fundamental element: it has no substructure.
 */
class Letter
: public DisplayElem
, public CreatableParam<Letter, char> {
private:
    char m_ch;

protected:
    /*virtual*/ ~Letter() {
    }

public:
    Letter() : m_ch('\0') {
    }

    void initialize(char ch) {
        m_ch = ch;
    }

    void finalize() {
        m_ch = '\0';
    }

    void display(std::ostream& os) const {
        os << m_ch;
        // no endLetter()
    }
};

/*!
 * Display element for word.
 *
 * A word is a sequence of letters.
 */
class Word
: public DisplayElem
, public Creatable<Word> {
private:
    std::vector<Letter*> m_letters;

protected:
    /*virtual*/ ~Word() {
        clear();
    }

public:
    Word() {
    }

    void clear() {
        std::for_each(m_letters.begin(), m_letters.end(), Freer<Letter>());
        m_letters.clear();
    }

    void addLetter(Letter* s) {
        m_letters.push_back(s);
    }

    /*virtual*/ void display(std::ostream& os) const {
        std::for_each(m_letters.begin(), m_letters.end(), Displayer(os));
        // no endLetter()
    }
};

/*!
 * Display element for sentence.
 *
 * A sentence is a sequence of words.
 */
class Sentence
: public DisplayElem
, public CreatableParam<Sentence, ESentenceType> {
private:
    std::vector<Word*> m_words;

    ESentenceType m_sentenceType;

protected:
    /*virtual*/ ~Sentence() {
        clear();
    }

    void endSentence(std::ostream& os) const {
        const char puncMark = getPunctionMark(m_sentenceType);
        os << puncMark;
    }

public:
    Sentence()
    : m_sentenceType(eStatement) {
    }

    void initialize(ESentenceType sentenceType) {
        m_sentenceType = sentenceType;
    }

    void finalize() {
        m_sentenceType = eStatement;
    }

    void clear() {
        std::for_each(m_words.begin(), m_words.end(), Freer<Word>());
        m_words.clear();
    }

    void addWord(Word* w) {
        m_words.push_back(w);
    }

    void display(std::ostream& os) const {
        std::for_each(m_words.begin(), m_words.end(), Displayer(os, ' '));
        endSentence(os);
    }
};

/*!
 * Display element for message.
 *
 * A message is a sequence of sentences.
 */
class Message
: public DisplayElem
, public Creatable<Message> {
private:
    std::vector<Sentence*> m_sentences;

protected:
    /*virtual*/ ~Message() {
        clear();
    }

    void endMessage(std::ostream& os) const {
        os << std::endl;
    }

public:
    Message() {
    }

    void clear() {
        std::for_each(m_sentences.begin(), m_sentences.end(), Freer<Sentence>());
        m_sentences.clear();
    }

    void addSentence(Sentence* s) {
        m_sentences.push_back(s);
    }

    void display(std::ostream& os) const {
        std::for_each(m_sentences.begin(), m_sentences.end(), Displayer(os, ' '));
        endMessage(os);
    }
};

/*!
 * Main entrance point.
 */
int main() {
    displayMessage();
    return 0;
}

/*!
 * Display message.
 */
void displayMessage() {
    Word* first_word = Word::create();
    first_word->addLetter(Letter::create('H'));
    first_word->addLetter(Letter::create('e'));
    first_word->addLetter(Letter::create('l'));
    first_word->addLetter(Letter::create('l'));
    first_word->addLetter(Letter::create('o'));

    Word* second_word = Word::create();
    second_word->addLetter(Letter::create('w'));
    second_word->addLetter(Letter::create('o'));
    second_word->addLetter(Letter::create('r'));
    second_word->addLetter(Letter::create('l'));
    second_word->addLetter(Letter::create('d'));

    Sentence* sentence = Sentence::create(eExclamation);
    sentence->addWord(first_word);
    sentence->addWord(second_word);

    Message* message = Message::create();
    message->addSentence(sentence);

    message->display(std::cout);

    message->free();
    // sentences, etc freed by parent
}

While the latter code uses OOP concepts and such,it has more learning curve speaking in your context.
Last edited on
closed account (o1vk4iN6)
Code tags really need to have a scroll function when someone posts 500 lines of code.

What does your Creatable class provide that normal constructors and destructors don't ? Seems like a lot of fluff to achieve nothing.
Last edited on
@xerzi
1. That code isn't mine , found that by googling "complex hello world c++"
2.Yep, most of that code is nonsense.

To clarify stuff,I was sarcastic when i said that the latter code has a better learning curve.
Last edited on
Mitch wrote:
I said before that it's more extendable, but I said that assuming SFML was closed source (I never looked into it).


So what you're saying is that you haven't even downloaded SFML or spent more than 15 seconds on the website and you're making statements about it being "massive" and "not extensible"? That's intelligent...
ModShop wrote:

Mitch wrote:
I said before that it's
more extendable, but I
said that assuming
SFML was closed source
(I never looked into it).
So what you're saying is
that you haven't even
downloaded SFML or
spent more than 15
seconds on the website
and you're making
statements about it
being "massive" and
"not extensible"? That's
intelligent...

I second that...
Wow, I have used SFML multiple times.
I simply never looked for it's source.

I really just wasn't interested in it.

Also the last time I saw it's website, was over 2 years ago...
So I forgot whether it was OS or not (and assumed it wasn't).


And it is massive. I have compiled over 10 games with it.
If you include it's Sound, and Graphical stuff, you usually get a 1MB game.

Even the stupid pong demo is a MB.
Mitch wrote:
And it is massive. I have compiled over 10 games with it.
If you include it's Sound, and Graphical stuff, you usually get a 1MB game.

Even the stupid pong demo is a MB.
Memory is cheap.
Last edited on
If Mitch wants to prefer SDL, let him. Even if his reasons are ill informed or wrong... who cares.

As long as he doesn't recommend SDL 1.2 I don't mind. If he does recommend SDL 1.x then I'll have to slap him. ;P
Last edited on
BHXSpecter wrote:
I don't think that has the same impact when it comes from a person near the age range you pick.


I swear some people just will never understand sarcasm.

I mean I bolded out the goddamned thing.

Just shameful.

Some times I just wonder.
Last edited on
I swear some people just will never understand sarcasm.

I swear some people just will never understand sarcasm it noticeable by the tone of the speaker's voice and text does not convey sarcasm well as is evident by the fact that novels even have to point out sarcasm. Also evident by you thinking the irony was lost on me and pointing out it was sarcasm.

Cursing, really? Bold doesn't emphasize sarcasm, it only empasizes the age which detracted from the sarcasm and made it look like you were trying to make note of insulting the age instead.
Yeah, memory is cheap... But I really don't like simple demos that are over 1MB.
It seems like such a waste, I really would hate to wait 15 minutes
(my old address didn't offer anything but dial-up), just to download a silly pong game.

I like SFML, and I think it's really well made, but the "this is a rotating cube" example is also over 1MB...
Recently, I compiled that (in assembly), with OpenGL to exactly 2.7KB (1:522)... SFML could never do that.

And my reasons are not ill-informed, I simply don't like bulky libraries.
Why do you hate SDL 1.2? I agree it's outdated, but it was good for it's time.

Over time, I have become obsessed with small binaries (C did that to me)...
It started when I moved from a bulky interpreted language, to C,
I was amazed that I could make a whole game less than 64KB!
Pages: 123