Merge branch 'master' of github.com:matteodelabre/projet-cmi
This commit is contained in:
commit
c5a4402369
|
@ -2,10 +2,12 @@
|
||||||
#define __PTF_ENGINE_HPP__
|
#define __PTF_ENGINE_HPP__
|
||||||
|
|
||||||
#include <SFML/Graphics.hpp>
|
#include <SFML/Graphics.hpp>
|
||||||
|
#include <SFML/Audio.hpp>
|
||||||
#include "object.hpp"
|
#include "object.hpp"
|
||||||
#include "engine_state.hpp"
|
#include "engine_state.hpp"
|
||||||
#include "resource_manager.hpp"
|
#include "resource_manager.hpp"
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* La classe principale Engine coordonne les éléments
|
* La classe principale Engine coordonne les éléments
|
||||||
* du jeu et organise le dessin des frames
|
* du jeu et organise le dessin des frames
|
||||||
|
@ -15,6 +17,7 @@ private:
|
||||||
sf::Clock clock;
|
sf::Clock clock;
|
||||||
sf::RenderWindow window;
|
sf::RenderWindow window;
|
||||||
sf::View view;
|
sf::View view;
|
||||||
|
sf::Music music;
|
||||||
|
|
||||||
EngineState state;
|
EngineState state;
|
||||||
ResourceManager resources;
|
ResourceManager resources;
|
||||||
|
|
BIN
res/ball.bmp
BIN
res/ball.bmp
Binary file not shown.
Before Width: | Height: | Size: 1.4 KiB |
BIN
res/block.bmp
BIN
res/block.bmp
Binary file not shown.
Before Width: | Height: | Size: 2.1 KiB |
Binary file not shown.
|
@ -16,7 +16,7 @@ void Block::draw(sf::RenderWindow& window, ResourceManager& resources) {
|
||||||
Object::draw(window, resources);
|
Object::draw(window, resources);
|
||||||
|
|
||||||
// utilisation de la texture
|
// utilisation de la texture
|
||||||
sprite.setTexture(resources.getTexture("block.bmp"));
|
sprite.setTexture(resources.getTexture("block.png"));
|
||||||
|
|
||||||
// coloration du bloc en fonction de sa charge
|
// coloration du bloc en fonction de sa charge
|
||||||
if (getCharge() > 0) {
|
if (getCharge() > 0) {
|
||||||
|
|
|
@ -16,6 +16,13 @@ Engine::Engine() : window(
|
||||||
|
|
||||||
void Engine::start() {
|
void Engine::start() {
|
||||||
float accumulator = 0;
|
float accumulator = 0;
|
||||||
|
if (!music.openFromFile("./res/music_lvl1.wav"))
|
||||||
|
{
|
||||||
|
// erreur
|
||||||
|
}
|
||||||
|
music.play();
|
||||||
|
music.setVolume(15);
|
||||||
|
music.setLoop(true);
|
||||||
|
|
||||||
// boucle d'événements sur la fenêtre
|
// boucle d'événements sur la fenêtre
|
||||||
while (window.isOpen()) {
|
while (window.isOpen()) {
|
||||||
|
|
|
@ -40,7 +40,7 @@ void Player::draw(sf::RenderWindow& window, ResourceManager& resources) {
|
||||||
Object::draw(window, resources);
|
Object::draw(window, resources);
|
||||||
|
|
||||||
// utilisation de la texture
|
// utilisation de la texture
|
||||||
sprite.setTexture(resources.getTexture("ball.bmp"));
|
sprite.setTexture(resources.getTexture("ball.png"));
|
||||||
|
|
||||||
// déplacement du sprite à la position de la balle
|
// déplacement du sprite à la position de la balle
|
||||||
sprite.rotate(getVelocity().x * .1f);
|
sprite.rotate(getVelocity().x * .1f);
|
||||||
|
|
Loading…
Reference in New Issue