Skip to content

Commit

Permalink
Generate sources (3ee94f7)
Browse files Browse the repository at this point in the history
  • Loading branch information
Robot committed Jul 22, 2018
1 parent 8bbcfa7 commit 6bf58da
Show file tree
Hide file tree
Showing 35 changed files with 2,185 additions and 366 deletions.
19 changes: 10 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ The API of *CrSFML* (a library for Crystal) attempts to be similar to SFML (a C+
- `x.getSomeProperty()` becomes `x.some_property`.
- `x.isSomeProperty()`, `x.hasSomeProperty()` become `x.some_property?`.
- `x.setSomeProperty(v)` becomes `x.some_property = v`.
- Structs in Crystal are are always passed by copy, so modifying them can be problematic. For example, `my_struct.x = 7` is fine but `array_of_structs[2].x = 5` will not work. To work around this, copy the whole struct, modify it, then write it back. Better yet, avoid the need to modify structs (work with them like with immutable objects).
- Structs in Crystal are always passed by copy, so modifying them can be problematic. For example, `my_struct.x = 7` is fine but `array_of_structs[2].x = 5` will not work. To work around this, copy the whole struct, modify it, then write it back. Better yet, avoid the need to modify structs (work with them like with immutable objects).
- Member functions, such as `loadFromFile`, that are used for initialization, each have a corresponding shorthand class method (`from_file`) that raises `SF::InitError` on failure.
- SFML sometimes uses *enum* values as bitmasks. You can combine them using the `|` operator.
- *enum* members are exposed at class level, so instead of `SF::Keyboard::Code::Slash` you can use `SF::Keyboard::Slash`.
Expand All @@ -53,26 +53,27 @@ Note that using [Shards][] is not enough to install *CrSFML*.

This section defines two sets of step-by-step instructions to install *CrSFML* but these are not the only ways to do it; they can even be mixed (see [VoidCSFML installation instructions](voidcsfml/README.md#installation) for an alternative look)

- [Approach 1](#approach-1): Generate latest *CrSFML* and *VoidCSFML* source code; build and use them from a local directory
- [Approach 1](#approach-1) **(recommended)**: Generate latest *CrSFML* and *VoidCSFML* source code; build and use them from a local directory
- Advantages:
- The bindings can be fine-tuned to your system.
- This is the right setup if you wish to:
- Distribute your application with the libraries
- Contribute to *CrSFML*
- Supports multiple recent [SFML versions](#install-sfml).
- This is the right setup if you wish to contribute to *CrSFML*.
- Disadvantages:
- Need to always provide full path to *VoidCSFML* libraries when running a program using *CrSFML*.
- Can't install *CrSFML* directly though [shards][].
- Can't install *CrSFML* directly through [shards][].
- [Approach 2](#approach-2): Use pre-compiled sources; build *VoidCSFML* and install it globally; install a release of *CrSFML* through [shards][]
- Advantages:
- Convenient installation.
- Disadvantages:
- Tied to a particular version of SFML (only SFML 2.4 right now).
- Less performant, because memory layout optimizations can't be cross-platform.
- Global installation litters your system.
- Tied to a particular version of SFML.

### Install SFML

The first step is to install the [SFML][] library itself. There are detailed [official instructions][sfml-install] on how to install it manually, however, on many systems there are easier ways.

SFML versions 2.4.x and 2.3.x are supported by *CrSFML*.
SFML versions 2.3.x through 2.5.x are supported by *CrSFML*.

#### Linux

Expand Down Expand Up @@ -117,7 +118,7 @@ cd crsfml
cmake . && make
```

> **Optional:** [out-of-source builds][] are also supported, but note that even the sources go to the build directory, so you would need perform all the following steps inside the build directory and not the root *crsfml* directory.
> **Optional:** [out-of-source builds][] are also supported, but note that even the sources go to the build directory, so you would need to perform all the following steps inside the build directory and not the root *crsfml* directory.
If ran successfully, this generates all the source files for *VoidCSFML* and *CrSFML*, and also compiles *VoidCSFML*.

Expand Down
13 changes: 10 additions & 3 deletions examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ Examples
- React to close and keyboard events
- Use a `Texture` and a `Sprite`
- Move, scale, rotate, draw
- Elapsed time for physics, using `Clock`

### [snakes](snakes.cr)

Expand All @@ -33,14 +34,20 @@ Examples
### [transformable](transformable.cr)

- Custom transformable drawable
- `Clock`
- Absolute time measurement with `Clock`

### [text_input](text_input.cr)
- Unicode keyboard input
- Text metric measurements
- Periodic events with `Clock`
- `BlendMode` (draw with inverted color)
- Detecting features by SFML version

### [diagnostics](diagnostics.cr)

- Listing controllers, screen modes, audio devices
- Mouse state and events
- Keyboard state and events, `TextEntered`
- Unicode
- Keyboard state and events
- Controller state and events
- Drawing with shapes
- Simple GUI (just buttons)
Expand Down
Loading

0 comments on commit 6bf58da

Please sign in to comment.