oprypin / crsfml

Crystal bindings to SFML multimedia/game library
https://oprypin.github.io/crsfml
zlib License
350 stars 14 forks source link

Add tutorials #4

Closed alanwillms closed 9 years ago

alanwillms commented 9 years ago

Maybe we could adapt SFML tutorials to Crystal and add them to the gh-pages:

http://www.sfml-dev.org/tutorials/2.3/

I could submit a PR for this, what do you think?

oprypin commented 9 years ago

Thanks for volunteering.

I would rather have this separate from the main repository. You can publish the tutorials in any way you want, and I'll link to them.

But the real problem is...

License doesn't allow translating tutorials to other languages

alanwillms commented 9 years ago

That's pretty bad :disappointed:

I will follow that thread. If there is no other way, I will write brand new tutorials.

oprypin commented 9 years ago

They're nice guys and shouldn't mind changing the license (if there are no big obstacles for it).

alanwillms commented 9 years ago

Ok, now we can proceed with this.

What do you think about this (for now):

Can I do this?

oprypin commented 9 years ago

I will start working on this tomorrow

I'm considering GitBook

I don't think another homepage is needed. GitHub+Readme is good.

I will write an update in 8 hours

alanwillms commented 9 years ago

Ok, let me know if you need any help :wink:

oprypin commented 9 years ago

I'm working on converting the SFML tutorials to Markdown and putting them into Gitbook. This will facilitate the work on converting it to Crystal.

Still not entirely sure if the tutorials should be added to this repository or not.

oprypin commented 9 years ago

I have set up all the infrastructure and converted SFML tutorials to Markdown+GitBook.

http://blaxpirit.github.io/crsfml/tutorials/

Now we just need to decide how to coordinate the work.

alanwillms commented 9 years ago

Can I submit random PRs or do you wanna assign some of those tutorials to me?

I think we should always make sure:

oprypin commented 9 years ago

How about... you do whatever amount of work you want to do (skip what you perhaps don't know), then submit one big pull request. Then I will do the rest.


Just need to wrap code in this:

```ruby


Sadly, `crystal` doesn't work.

---

You will, of course, need `gitbook` to see the results of what you changed.
alanwillms commented 9 years ago

Perfect!

alanwillms commented 9 years ago

How do we deal with unsupported operations in CrSFML? For example:

t1 = SF.seconds(123.0)
t2 = t1 * 2
t3 = t1 + t2
t4 = -t3

b1 = (t1 == t2)
b2 = (t3 > t4)

puts [t1, t2, t3, t4, b1, b2].inspect

Currently arithmetic and comparison operators are not supported in Time class.

Should I skip the tutorial block or is it something you can implement in CrSFML?

oprypin commented 9 years ago

This is something I should implement. Will look into it in 6 hours or earlier.

alanwillms commented 9 years ago

No rush, take your time.

I am testing each block of code to make sure they all work, so I may find a few bugs like the above.

Now I found a new one: Vector2i does not accept any constructor arguments. I am not sure if it is a bug or if I should use Vector2 instead:

SF::Mouse.position = SF::Vector2i.new(10, 50)
# Error: wrong number of arguments for 'CSFML::Vector2i::new' (2 for 0)
ervumlens commented 9 years ago

I think the *f and *i types are meant to be internal. E.g., they lack the usual vector operators.

alanwillms commented 9 years ago

Yeah, the same thing happens with SF::ViewMode.new(800, 600).

But if I use the SF.video_mode(800, 600) method it instantiates.

alanwillms commented 9 years ago

Ok, never mind, @BlaXpirit explains this in the README file. Sorry! :worried:

alanwillms commented 9 years ago

I opened a pull request #6 so we can discuss any issues directly in the code

oprypin commented 9 years ago

I overhauled readme and added a link to tutorials.

I would welcome a contribution of a tutorial or a good link on how to install SFML + CSFML on Mac.

alanwillms commented 9 years ago

give me a day and I will write that :+1:

alanwillms commented 9 years ago

I added instructions on the "easy way" (using the most popular OSX package manager) and instructions on how to compile CSFML from scratch (but I didn't add about SFML yet, I am looking for it):

https://github.com/BlaXpirit/crsfml/wiki/Installing-CSFML

alanwillms commented 9 years ago

Ok, now it's complete

oprypin commented 9 years ago

This can be considered done.

I will add the remaining tutorials over time.

alanwillms commented 9 years ago

:+1: