<commit_before>/**
 * Copyright (C) 2012 by INdT
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 *
 * @author <NAME> <<EMAIL>>
 * @author <NAME> <<EMAIL>>
 */

QuasiGame {
    id: game

    width: 800
    height: 400

    currentScene: scene

    QuasiScene {
        id: scene

        width: parent.width
        height: parent.height

        entities: [
            QuasiLayers {
                // TODO: make 'horizontalStep' a property from QuasiLayers, not QuasiAnimatedLayer?
                anchors.fill: parent
                drawType: Quasi.TiledDrawType // XXX: There are some problems with Quasi.PLaneDrawType
                tileWidth: 40
                tileHeight: 40
                //drawGrid: true // nice for debug; default: false

                layers: [
                    QuasiAnimatedLayer {
                        source: ":/images/space.png"
                        factor: 0.3
                        order: Quasi.BackgroundLayerOrdering_01

                        horizontalStep: 1
                        layerType: Quasi.MirroredType
                    },
                    QuasiAnimatedLayer {
                        source: ":/images/planet.png"
                        factor: 0.5
                        order: Quasi.BackgroundLayerOrdering_02

                        horizontalStep: 1
                        layerType: Quasi.InfiniteType
                    },
                    QuasiAnimatedLayer {
                        source: ":/images/stars.png"
                        factor: 1.1
                        order: Quasi.ForegroundLayerOrdering_01

                        horizontalStep: 1
                        layerType: Quasi.InfiniteType
                    },
                    QuasiAnimatedLayer {
                        source: ":/images/moon.png"
                        factor: 1.2
                        order: Quasi.ForegroundLayerOrdering_02

                        horizontalStep: 1
                        layerType: Quasi.InfiniteType
                    }
                ]
            },
            QuasiEntity {
                id: ship

                y: (game.height / 2) - (shipImage.height / 2)
                x: 25
                /* layer ordering, set how the layers will be presented when rendering
                 * possible values, splited in three main areas:
                 * - These enums defines the ordering of the game entities
                      EntityOrdering_01 (default), EntityOrdering_02 and EntityOrdering_03
                 * Please, bear in mind that you can use as many entities you want to (and that your system can support), but they will be ordered according these values
                 * Prefer to keep colliding items on the same ordering
                 */
                order: Quasi.EntityOrdering_01

                Image {
                    id: shipImage

                    source: ":/images/rocketship.png"
                }

                focus: true
                Keys.onPressed: {
                    switch (event.key) {
                        case Qt.Key_Left:
                            ship.x -= 5;
                            break;
                        case Qt.Key_Right:
                            ship.x += 5;
                            break;
                        case Qt.Key_Down:
                            ship.y += 5;
                            break;
                        case Qt.Key_Up:
                            ship.y -= 5;
                            break;
                    }
                }
            }
        ]
    }
}<commit_msg>Adjusting parallax_layers to work with new animated layers behavior<commit_after>/**
 * Copyright (C) 2012 by INdT
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 *
 * @author <NAME> <<EMAIL>>
 * @author <NAME> <<EMAIL>>
 */

QuasiGame {
    id: game

    width: 800
    height: 400

    currentScene: scene

    fps: 300

    function toLeft() {
        shipImage.mirror = true;
        layers.direction = Quasi.ForwardDirection;
    }

    function toRight() {
        shipImage.mirror = false;
        layers.direction = Quasi.BackwardDirection;
    }

    QuasiScene {
        id: scene

        width: parent.width
        height: parent.height

        entities: [
            QuasiLayers {
                id: layers

                // TODO: make 'horizontalStep' a property from QuasiLayers, not QuasiAnimatedLayer?
                anchors.fill: parent
                drawType: Quasi.TiledDrawType // XXX: There are some problems with Quasi.PLaneDrawType
                tileWidth: 40
                tileHeight: 40
                //drawGrid: true // nice for debug; default: false

                property variant direction: Quasi.BackwardDirection

                layers: [
                    QuasiAnimatedLayer {
                        source: ":/images/space.png"
                        factor: 0.3
                        order: Quasi.BackgroundLayerOrdering_01

                        horizontalStep: 1
                        layerType: Quasi.MirroredType
                        direction: layers.direction
                    },
                    QuasiAnimatedLayer {
                        source: ":/images/planet.png"
                        factor: 0.5
                        order: Quasi.BackgroundLayerOrdering_02

                        horizontalStep: 1
                        layerType: Quasi.InfiniteType
                        direction: layers.direction
                    },
                    QuasiAnimatedLayer {
                        source: ":/images/stars.png"
                        factor: 1.1
                        order: Quasi.ForegroundLayerOrdering_01

                        horizontalStep: 1
                        layerType: Quasi.InfiniteType
                        direction: layers.direction
                    },
                    QuasiAnimatedLayer {
                        source: ":/images/moon.png"
                        factor: 1.2
                        order: Quasi.ForegroundLayerOrdering_02

                        horizontalStep: 1
                        layerType: Quasi.InfiniteType
                        direction: layers.direction
                    }
                ]
            },
            QuasiEntity {
                id: ship

                y: (game.height / 2) - (shipImage.height / 2)
                x: 25
                /* layer ordering, set how the layers will be presented when rendering
                 * possible values, splited in three main areas:
                 * - These enums defines the ordering of the game entities
                      EntityOrdering_01 (default), EntityOrdering_02 and EntityOrdering_03
                 * Please, bear in mind that you can use as many entities you want to (and that your system can support), but they will be ordered according these values
                 * Prefer to keep colliding items on the same ordering
                 */
                order: Quasi.EntityOrdering_01

                Image {
                    id: shipImage

                    source: ":/images/rocketship.png"
                }

                focus: true
                Keys.onPressed: {
                    switch (event.key) {
                        case Qt.Key_Left:
                            toLeft();
                            ship.x -= 5;
                            break;
                        case Qt.Key_Right:
                            toRight();
                            ship.x += 5;
                            break;
                        case Qt.Key_Down:
                            ship.y += 5;
                            break;
                        case Qt.Key_Up:
                            ship.y -= 5;
                            break;
                    }
                }
            }
        ]
    }
}
{'fraction_non_alphanumeric': 0.06023448424222867, 'fraction_numerical': 0.013660320533505433, 'mean_word_length': 1.1184780132148553, 'pattern_counts': {'":': 10, '<': 15, '<?xml version=': 0, '>': 15, 'https://': 0, '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': '6187605', 'n_tokens_mistral': 2282, 'n_tokens_neox': 2024, 'n_words': 702}