Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
S3
Barre Oblique V3
Headmaster Simulator
Commits
525e670e
Commit
525e670e
authored
Dec 11, 2020
by
Elias Leinenweber
Browse files
Commence fiche info eleve
parent
6b8539d2
Changes
7
Hide whitespace changes
Inline
Side-by-side
include/model/Actor.h
View file @
525e670e
...
...
@@ -14,15 +14,14 @@ class Actor : public Texturable {
/**
* @brief Crée un personnage.
*
* @param firstname
le prénom du personnage
* @param firstname le prénom du personnage
* @param surname le nom de famille du personnage
* @param texturePath le chemin du fichier de texture
*/
Actor
(
const
std
::
string
&
firstname
,
const
std
::
string
&
surname
,
const
std
::
string
&
texturePath
);
Actor
(
const
std
::
string
&
firstname
,
const
std
::
string
&
surname
,
const
std
::
string
&
texturePath
);
public:
/**
* @brief Renvoie le prénom du personnage.
*
...
...
@@ -58,13 +57,13 @@ class Actor : public Texturable {
/**
* @brief affiche la fiche d'information de l'Actor
*
*
*/
virtual
void
infoSheet
()
const
=
0
;
/**
* @brief affiche les options disponibles lorsque l'on clique sur l'Actor
*
*
*/
virtual
void
clickPopup
()
const
=
0
;
};
...
...
include/model/Student.h
View file @
525e670e
...
...
@@ -91,31 +91,30 @@ class Student : public Actor {
/**
* @brief Affiche la fiche information de l'élève
*
*
*/
void
infoSheet
()
const
override
;
/**
* @brief Affiche les options disponibles lorsque l'on clique sur l'élève
*
*
*/
void
clickPopup
()
const
override
;
/**
* @brief calcule la moyenne générale de l'élève
*
*
* @return double moyenne générale de l'élève
*/
double
moyenneGenerale
()
const
;
/**
* @brief cacule la moyenne d'une matière d'un élève
*
*
* @param subject matière concerné
* @return double moyenne d'une matière
*/
double
moyenneMatiere
(
Subject
*
subject
)
const
;
double
moyenneMatiere
(
Subject
*
subject
)
const
;
};
#endif
include/model/Teacher.h
View file @
525e670e
...
...
@@ -64,14 +64,12 @@ class Teacher : public Actor {
}
/**
* @brief Affiche la fiche informations du prof
*
* @brief Affiche la fiche informations du prof.
*/
void
infoSheet
()
const
override
;
/**
* @brief Affiche les options disponibles lorsque l'on clique sur le prof
*
* @brief Affiche les options disponibles lorsque l'on clique sur le prof.
*/
void
clickPopup
()
const
override
;
};
...
...
include/view/InfoSheet.h
0 → 100644
View file @
525e670e
#ifndef INFO_SHEET_H
#define INFO_SHEET_H
#include
"view/Component.h"
/** @brief Une fiche d'information d'un personnage. */
class
InfoSheet
:
public
Component
{
public:
void
render
()
const
;
};
#endif
/* INFO_SHEET_H */
src/model/Student.cpp
View file @
525e670e
#include
<assert.h>
#include
"imgui/imgui-SFML.h"
#include
"imgui/imgui.h"
#include
"model/Actor.h"
#include
"model/Student.h"
#include
"view/InfoSheet.h"
Student
::
Student
(
const
std
::
string
&
firstname
,
const
std
::
string
&
surname
,
double
mood
,
double
motivation
,
double
skill
,
...
...
@@ -25,39 +27,40 @@ Student::addGrades(Subject *subject, double grade)
}
void
Student
::
clickPopup
()
const
{
Student
::
clickPopup
()
const
{
if
(
ImGui
::
MenuItem
(
"Afficher fiche information"
))
{
infoSheet
();
}
if
(
ImGui
::
MenuItem
(
"Interroger"
))
{
}
if
(
ImGui
::
MenuItem
(
"Lancer une craie"
))
{
}
if
(
ImGui
::
MenuItem
(
"Envoyer au coin"
))
{
}
}
void
Student
::
infoSheet
()
const
{
// TODO
Student
::
infoSheet
()
const
{
Game
::
addComponent
(
new
InfoSheet
);
}
double
Student
::
moyenneGenerale
()
const
{
Student
::
moyenneGenerale
()
const
{
double
res
=
0
;
double
sommeCoeff
=
0
;
for
(
const
auto
&
kv
:
grades
){
double
sommeCoeff
=
0
;
for
(
const
auto
&
kv
:
grades
)
{
sommeCoeff
+=
kv
.
first
->
getCoeff
();
res
+=
moyenneMatiere
(
kv
.
first
)
*
kv
.
first
->
getCoeff
();
}
return
res
/
sommeCoeff
;
// on divise la moyenne par la somme des coeffs
return
res
/
sommeCoeff
;
// on divise la moyenne par la somme des coeffs
}
double
Student
::
moyenneMatiere
(
Subject
*
subject
)
const
{
double
Student
::
moyenneMatiere
(
Subject
*
subject
)
const
{
assert
(
grades
.
count
(
subject
)
>
0
);
double
moyMatiere
;
...
...
@@ -65,9 +68,9 @@ double Student::moyenneMatiere(Subject * subject) const {
const
std
::
vector
<
double
>
&
notes
=
grades
.
at
(
subject
);
std
::
vector
<
double
>::
size_type
vecsize
=
notes
.
size
();
for
(
std
::
vector
<
double
>::
size_type
i
=
0
;
i
<
vecsize
;
i
++
)
for
(
std
::
vector
<
double
>::
size_type
i
=
0
;
i
<
vecsize
;
i
++
)
moyMatiere
+=
notes
[
i
];
// somme des notes de la matiere
moyMatiere
/=
vecsize
;
// divise par le nombre de notes
return
moyMatiere
;
}
\ No newline at end of file
}
src/model/Teacher.cpp
View file @
525e670e
#include
<string>
#include
"imgui/imgui-SFML.h"
#include
"imgui/imgui.h"
...
...
@@ -22,14 +23,15 @@ Teacher::Teacher(const std::string &firstname, const std::string &surname,
}
void
Teacher
::
clickPopup
()
const
{
Teacher
::
clickPopup
()
const
{
if
(
ImGui
::
MenuItem
(
"Afficher fiche information"
))
{
infoSheet
();
}
}
void
Teacher
::
infoSheet
()
const
{
Teacher
::
infoSheet
()
const
{
// TODO
}
src/view/InfoSheet.cpp
0 → 100644
View file @
525e670e
#include
<string>
#include
<SFML/Graphics.hpp>
#include
<SFML/OpenGL.hpp>
#include
<SFML/System.hpp>
#include
"imgui/imgui-SFML.h"
#include
"imgui/imgui.h"
#include
"controller/Game.h"
#include
"view/InfoSheet.h"
#include
"view/Utils.h"
void
InfoSheet
::
render
()
const
{
centerNextWindow
(
500
,
320
);
if
(
ImGui
::
Begin
(
"Fiche d'info"
,
nullptr
,
ImGuiWindowFlags_NoMove
))
{
ImGui
::
LabelText
(
"Satisfaction"
,
"I can't get no"
);
ImGui
::
LabelText
(
"Humeur"
,
"jsp"
);
ImGui
::
LabelText
(
"Moyenne générale"
,
"20/20"
);
}
ImGui
::
End
();
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment