Skip to content
This repository has been archived by the owner on Mar 3, 2022. It is now read-only.

Commit

Permalink
Reread and commented some files
Browse files Browse the repository at this point in the history
  • Loading branch information
jlppc committed Oct 15, 2018
1 parent 5169807 commit ab7b2fa
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 39 deletions.
7 changes: 7 additions & 0 deletions src/opmon/view/Jukebox.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
/*
Jukebox.cpp
Author : Cyrion
Contributors : Samurai413x, BAKFR
File under GNU GPL v3.0 license
*/
#include "Jukebox.hpp"
#include "../model/storage/ResourceLoader.hpp"
#include "../start/Core.hpp"
Expand All @@ -19,6 +25,7 @@ namespace OpMon {
}

void Jukebox::addSound(std::string name, std::string path) {
//Sounds are saved in the code as a pair of sf::SoundBuffer and sf::Sound.
sf::SoundBuffer *sb = new sf::SoundBuffer();
Model::ResourceLoader::load(*sb, path.c_str());
if(soundsList[name].first != nullptr) {
Expand Down
4 changes: 2 additions & 2 deletions src/opmon/view/Jukebox.hpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/**
Jukebox.hpp
Author : Cyrion
File under licence GNU GPL-3.0
http://opmon-game.ga
Contributor : Samurai413x
File under GNU GPL v3.0 license
*/
#pragma once

Expand Down
24 changes: 10 additions & 14 deletions src/opmon/view/MainMenu.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
/*
MainMenu.cpp
Author : Cyrion
Contributors : BAKFR, torq
File under GNU GPL v3.0 license
*/
#include "MainMenu.hpp"
#include "../../utils/StringKeys.hpp"
#include "../../utils/defines.hpp"
Expand Down Expand Up @@ -28,27 +34,17 @@ namespace OpMon {
textPos[i]->setPosition(sf::Vector2f(60, j));
j += 85;
}
Model::ResourceLoader::load(sounds[0], "audio/sounds/select.ogg");
Model::ResourceLoader::load(sounds[1], "audio/sounds/selectbuttons.ogg");
//sounds[2].loadFromFile(RESSOURCES_PATH + "audio/sounds/nope.ogg");
bg.setTexture(data.getTitlescreen());
cursor.setTexture(data.getArrChoice());
bruitArr.setBuffer(sounds[0]);
bruitPush.setBuffer(sounds[1]);
//bruitNope.setBuffer(sounds[2]);
cursor.setScale(3, 3);
initStrings();

for(auto *text : {&playtx, &charge, &options, &exit}) {
for(auto *text : textPos) {
text->setSfmlColor(sf::Color::White);
text->setFont(data.getUiDataPtr()->getFont());
text->setCharacterSize(FONT_SIZE_DEFAULT);
}

//Mix_Volume(2, MIX_MAX_VOLUME / 4);
//Mix_Volume(1, MIX_MAX_VOLUME);
//Mix_Volume(0, MIX_MAX_VOLUME / 2);


data.getUiDataPtr()->getJukebox().play("Title");
}

Expand All @@ -67,9 +63,9 @@ namespace OpMon {
}

void MainMenu::moveArrow(bool direction) {
if(direction /* == true*/) {
if(direction) {//If direction is true, the cursor goes down.
curPosI--;
} else {
} else {//Obviously, if direction is false, the cursor goes up.
curPosI++;
}

Expand Down
22 changes: 9 additions & 13 deletions src/opmon/view/MainMenu.hpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
/*
MainMenu.hpp
Author : Jlppc
File under the license GPL-3.0
http://opmon-game.ga
Contains MainMenu namespace
Author : Cyrion
Contributors : Navet56, BAKFR
File under GNU GPL v3.0 license
*/
#ifndef MAINMENU_HPP
#define MAINMENU_HPP
Expand All @@ -18,8 +17,8 @@ namespace OpMon {
namespace View {

/**
* View of the main menu (displayed when the game starts).
*/
* MainMenu's view (displayed when the game starts).
*/
class MainMenu : public I18n::ATranslatable {

public:
Expand All @@ -29,10 +28,10 @@ namespace OpMon {
void initStrings();
void onLangChanged() override;

/**
* Move the cursor to select another menu entry.
* @param `true` moves the cursor up; `false` moves it down.
*/
/**
* Moves the cursor to select another menu entry.
* @param `true` moves the cursor up; `false` moves it down.
*/
void moveArrow(bool direction);

void pause();
Expand All @@ -52,10 +51,7 @@ namespace OpMon {
sf::Text exit;
sf::Sprite cursor;
sf::Vector2f curPos[4];
sf::Sound bruitArr;
sf::Sound bruitPush;
sf::Texture textures[2];
sf::SoundBuffer sounds[3];
int curPosI = 0;
Model::MainMenuData &data;
};
Expand Down
17 changes: 12 additions & 5 deletions src/opmon/view/OptionsMenu.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
/*
OptionsMenu.cpp
Author : Cyrion
Contributors : torq, Navet56, BAKFR
File under GNU GPL v3.0 license
*/
#include "OptionsMenu.hpp"
#include "../model/save/OptionsSave.hpp"
#include "../model/storage/ResourceLoader.hpp"
Expand Down Expand Up @@ -111,10 +117,11 @@ namespace OpMon {
bgCredits.setTexture(data.getCreditsBg());

volumeCur.setTexture(data.getVolumeCur());
//volumeCur.setPosition(165, 290);//0
//volumeCur.setPosition(460, 290);//100
//Cursor positions :
//volumeCur.setPosition(165, 290);// = 0
//volumeCur.setPosition(460, 290);// = 100

coche.setPosition(425, 88);
check.setPosition(425, 88);

initStrings();

Expand Down Expand Up @@ -233,12 +240,12 @@ namespace OpMon {
frame.draw(txtOpt5);
frame.draw(txtRetour);
frame.draw(txtOptions);

volumeCur.setPosition(166 + (295 * data.getUiDataPtr()->getJukebox().getGlobalVolume() / 100), 298);

frame.draw(volumeCur);
if(Model::OptionsSave::getParam("fullscreen").getValue() == "true") {
frame.draw(coche);
frame.draw(check);
}
rectSurb.setPosition(curPosOpt[curPosOptI]);
rectSurb.setScale(curSizeOpt[curPosOptI]);
Expand Down
8 changes: 3 additions & 5 deletions src/opmon/view/OptionsMenu.hpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
/*
OptionsMenu.hpp
Author : Cyrion
File under the GPL-3.0 license
http://opmon-game.ga
Contains OptionsMenu namespace
Contributors : torq, Navet56, BAKFR
File under GNU GPL v3.0 license
*/
#ifndef OPTIONSMENU_HPP
#define OPTIONSMENU_HPP
Expand Down Expand Up @@ -94,11 +93,10 @@ namespace OpMon {
sf::Text txtLang;
sf::Text txtCred;
sf::Sprite bgLangues;
//J_Texture listeLangues[3] = {};
sf::Vector2f curPosLang[5] = {};
sf::Vector2f curSizeLang[5];
sf::Texture textures2[5];
sf::Sprite coche;
sf::Sprite check;

bool continuer = true;
};
Expand Down

0 comments on commit ab7b2fa

Please sign in to comment.