<commit_before>
## Cherry.lua

Cherry is the `CoronaSDK App` starter for [Uralys](http://uralys.com/games) mobile games provided as a preset Corona Game.

You may use Cherry as a base to start your own game, with the following facilities:

- [Introduction](#introduction-to-cherry)
- [Usage](#usage)
- [Components](#components-documentation)
- [Music and Sounds](#music-and-sounds)
- [License](#bsd-license)
- [Third Parties](#third-parties)

![cherry](/docs/cherry.jpg)

## Introduction to Cherry

#### Game worflow

Avoid developing your screens by using many pre-defined `screens` to go straight to the point :

- Home + Options
- Level Selection
- Playground
- Score
- Profiles
- Credits

#### Libraries

Many libraries to provide easy tooling for your app :

- screen **routing**
- game **Camera**
- **touch** controller
- **sound** library (music + effects)
- a sublevel to register **effects** from [CBEffects](https://github.com/GymbylCoding/CBEffects).
- **user** profile and game status
- google **analytics** events (a lot are already plugged in the workflow)

#### Components

Either use these components within the full workflow or pick them one by one to use it in your own game :

- Focus
- Progress Bar
- Scroller

See [below](#components-documentation) for the complete documentation for each component.

## Usage

#### Adding a new Screen

A `Screen` implements the [Composer](https://docs.coronalabs.com/daily/api/library/composer/index.html) library.

- Start by creating a new `screen`, for instance duplicate the simplest one `src/screens/Playground.lua`
- Register your new screen in the [Router](https://github.com/chrisdugne/cherry/blob/master/src/Router.lua#L12)  : `YOUR_NEW_SCREEN = 'YourNewScreen'`
- Now you can open your screen from anywhere calling :
    `Router:open(Router.YOUR_NEW_SCREEN)`

#### Adding a new Model
- Each `model` should implement `new` and `show` functions, for instance read how [Item](https://github.com/chrisdugne/cherry/blob/master/src/game/models/Item.lua) is built.
- Register your model in [main.lua](https://github.com/chrisdugne/cherry/blob/master/main.lua#L55) : `YourModel = require 'src.game.models.YourModel'`
- Use `YourModel:new()` during the `LevelDrawer` parsing
- Use `YourModel:show()` during the `Game` rendering

## Components Documentation

#### ProgressBar

An animated progress bar.

![progress-bar](/docs/progress-bar.png)

- copy and require `src/components/ProgressBar.lua` ([example](https://github.com/chrisdugne/cherry/blob/master/main.lua#L45) in Cherry)

- init the ProgressBar
```
    local progress = ProgressBar:new()
```

- use parameters to draw the ProgressBar
```
    progress:draw({
        parent = self.display,
        x      = 30,<commit_msg>enhanced ProgessBar doc<commit_after>
## Cherry.lua

Cherry is the `CoronaSDK App` starter for [Uralys](http://uralys.com/games) mobile games provided as a preset Corona Game.

You may use Cherry as a base to start your own game, with the following facilities:

- [Introduction](#introduction-to-cherry)
- [Usage](#usage)
- [Components](#components-documentation)
- [Music and Sounds](#music-and-sounds)
- [License](#bsd-license)
- [Third Parties](#third-parties)

![cherry](/docs/cherry.jpg)

## Introduction to Cherry

#### Game worflow

Avoid developing your screens by using many pre-defined `screens` to go straight to the point :

- Home + Options
- Level Selection
- Playground
- Score
- Profiles
- Credits

#### Libraries

Many libraries to provide easy tooling for your app :

- screen **routing**
- game **Camera**
- **touch** controller
- **sound** library (music + effects)
- a sublevel to register **effects** from [CBEffects](https://github.com/GymbylCoding/CBEffects).
- **user** profile and game status
- google **analytics** events (a lot are already plugged in the workflow)

#### Components

Either use these components within the full workflow or pick them one by one to use it in your own game.

See [below](#components-documentation) for the complete list and documentation for each component.

## Usage

#### Adding a new Screen

A `Screen` implements the [Composer](https://docs.coronalabs.com/daily/api/library/composer/index.html) library.

- Start by creating a new `screen`, for instance duplicate the simplest one `src/screens/Playground.lua`
- Register your new screen in the [Router](https://github.com/chrisdugne/cherry/blob/master/src/Router.lua#L12)  : `YOUR_NEW_SCREEN = 'YourNewScreen'`
- Now you can open your screen from anywhere calling :
    `Router:open(Router.YOUR_NEW_SCREEN)`

#### Adding a new Model
- Each `model` should implement `new` and `show` functions, for instance read how [Item](https://github.com/chrisdugne/cherry/blob/master/src/game/models/Item.lua) is built.
- Register your model in [main.lua](https://github.com/chrisdugne/cherry/blob/master/main.lua#L55) : `YourModel = require 'src.game.models.YourModel'`
- Use `YourModel:new()` during the `LevelDrawer` parsing
- Use `YourModel:show()` during the `Game` rendering

## Components Documentation

#### ProgressBar

An animated progress bar.

![progress-bar](/docs/progress-bar.png)

- Code : copy and require `src/components/ProgressBar.lua` ([example](https://github.com/chrisdugne/cherry/blob/master/main.lua#L45) in Cherry) and `src/components/Icon.lua`

- assets : you need to copy the assets from `assets/images/gui/progress-bar` (and credit GraphicBurger see [Third Parties](#third-parties))

- init the ProgressBar
```
    local progress = ProgressBar:new()
```

- use parameters to draw the ProgressBar
```
    progress:draw({
        parent = self.display,
        x      = 30,
{'fraction_non_alphanumeric': 0.1303885045236828, 'fraction_numerical': 0.0028383892141209863, 'mean_word_length': 4.405560882070949, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 12, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1133999', 'n_tokens_mistral': 1805, 'n_tokens_neox': 1703, 'n_words': 545}