oprypin / crsfml

Crystal bindings to SFML multimedia/game library

Home Page:https://oprypin.github.io/crsfml

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add tutorials

alanwillms opened this issue Β· comments

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?

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

That's pretty bad 😞

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

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

Ok, now we can proceed with this.

What do you think about this (for now):

  • create a simple homepage with Bootstrap or Material Design Light
  • move API docs to a sub-folder
  • create two buttons: tutorials / api and display the README.md text

Can I do this?

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

Ok, let me know if you need any help πŸ˜‰

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.

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.

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

I think we should always make sure:

  • the converted code runs successfully in our machines
  • the syntax is highlighted as Crystal in MarkDown code blocks

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.

Perfect!

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?

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

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)

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

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

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

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

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

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.

give me a day and I will write that πŸ‘

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

Ok, now it's complete

This can be considered done.

I will add the remaining tutorials over time.

πŸ‘