Commit df865711 authored by Elias Leinenweber's avatar Elias Leinenweber
Browse files

Rogne et transparence sprites, et generation Ecole -> Classes -> Prof + Etudiants

parent 5c766fc8
......@@ -51,6 +51,8 @@ class Actor : public Texturable {
* @param surname nom de famille du personnage
*/
void setSurname(const std::string &surname) { this->surname = surname; }
void render() const;
};
#endif
......@@ -40,6 +40,14 @@ class School : public Component {
*/
void addClass(Classroom *classe) { classrooms.push_back(classe); }
/**
* @brief Get the Class From Index object
*
* @param index
* @return Classroom*
*/
Classroom *getClassFromIndex(int index) { return classrooms[index]; }
void render() const;
};
......
......@@ -104,8 +104,6 @@ class Student : public Actor {
* @param grade Note
*/
void addGrades(Subject *subject, double grade);
void render() const;
};
#endif
resources/images/eleves/eleve_garcon2.png

1.71 KB | W: | H:

resources/images/eleves/eleve_garcon2.png

947 Bytes | W: | H:

resources/images/eleves/eleve_garcon2.png
resources/images/eleves/eleve_garcon2.png
resources/images/eleves/eleve_garcon2.png
resources/images/eleves/eleve_garcon2.png
  • 2-up
  • Swipe
  • Onion skin
resources/images/eleves/eleve_garcon3.png

1.66 KB | W: | H:

resources/images/eleves/eleve_garcon3.png

900 Bytes | W: | H:

resources/images/eleves/eleve_garcon3.png
resources/images/eleves/eleve_garcon3.png
resources/images/eleves/eleve_garcon3.png
resources/images/eleves/eleve_garcon3.png
  • 2-up
  • Swipe
  • Onion skin
resources/images/profs/prof1.png

6.32 KB | W: | H:

resources/images/profs/prof1.png

2.19 KB | W: | H:

resources/images/profs/prof1.png
resources/images/profs/prof1.png
resources/images/profs/prof1.png
resources/images/profs/prof1.png
  • 2-up
  • Swipe
  • Onion skin
......@@ -10,6 +10,7 @@
#include "imgui/imgui.h"
#include "controller/Game.h"
#include "controller/StudentFactory.h"
#include "view/GameWindow.h"
#include "view/MainMenu.h"
#include "view/MainView.h"
......@@ -31,6 +32,7 @@ Game::newGame()
{
assert(mainWindow);
clearComponents();
StudentFactory::loadStudentFactory();
addComponent(new MainView);
}
......
#include <iostream>
#include <SFML/Graphics.hpp>
#include "imgui/imgui-SFML.h"
#include "imgui/imgui.h"
#include "model/Actor.h"
......@@ -9,3 +12,10 @@ Actor::Actor(const std::string &firstname, const std::string &surname,
, surname(surname)
{
}
void
Actor::render() const
{
ImGui::ImageButton(
texture, ImVec2(texture.getSize().x / 2, texture.getSize().y / 2));
}
......@@ -6,16 +6,21 @@
#include "imgui/imgui-SFML.h"
#include "imgui/imgui.h"
#include "controller/StudentFactory.h"
#include "model/Classroom.h"
#include "model/Student.h"
#include "model/Teacher.h"
#define NB_STUDENTS 5
ImGuiID Classroom::lastID = 0;
Classroom::Classroom(int n, Teacher *teacher)
: Texturable("resources/images/salles/salle" + std::to_string(n) + ".png")
, teacher(teacher)
{
for (int i = 1; i <= NB_STUDENTS; ++i)
addStudent(StudentFactory::getRandomStudent());
}
ImTextureID
......@@ -29,19 +34,20 @@ convertGLTextureHandleToImTextureID(GLuint glTextureHandle)
void
Classroom::render() const
{
ImVec2 size(ImGui::GetIO().DisplaySize.x / 2.5,
ImGui::GetIO().DisplaySize.y / 2.5);
if (ImGui::BeginChild(Game::getComponentID(), size)) {
// ImGui::SameLine();
ImVec2 size(ImGui::GetIO().DisplaySize.x / 2.25,
ImGui::GetIO().DisplaySize.y / 2.25);
if (ImGui::BeginChild(Game::getComponentID(), size, true,
ImGuiWindowFlags_NoBackground)) {
ImGui::GetBackgroundDrawList()->AddImage(
convertGLTextureHandleToImTextureID(texture.getNativeHandle()),
ImGui::GetWindowPos(),
ImVec2(ImGui::GetWindowPos().x + ImGui::GetContentRegionAvail().x,
ImGui::GetWindowPos().y + ImGui::GetContentRegionAvail().y));
// ImGui::Image(texture, size);
ImGui::SameLine();
teacher->render();
for (const Student *student : students) {
// std::cout << "rendering student" << std::endl;
student->render();
ImGui::SameLine();
}
}
ImGui::EndChild();
......
......@@ -6,20 +6,22 @@
#include "imgui/imgui-SFML.h"
#include "imgui/imgui.h"
#include "controller/StudentFactory.h"
#include "model/Classroom.h"
#include "model/School.h"
#include "model/Teacher.h"
#include "view/Utils.h"
#define NB_CLASSES 4
School::School(const std::string &name)
: name(name)
{
Classroom *classroom;
for (int i = 1; i <= 4; ++i) {
classroom = new Classroom(i, new Teacher("H.", "Julien", 70, 40));
classroom->addStudent(new Student("de Noel", "Golden", 80, 70, 70));
classrooms.push_back(classroom);
for (int i = 1; i <= NB_CLASSES; ++i) {
Student *dummy = StudentFactory::getRandomStudent();
classrooms.push_back(new Classroom(
i, new Teacher(dummy->getFirstName(), dummy->getSurname(),
dummy->getMotivation(), dummy->getSkill())));
}
}
......@@ -35,8 +37,9 @@ void
School::render() const
{
maximizeNextWindow();
if (ImGui::Begin(name.c_str(), nullptr,
ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove)) {
if (ImGui::Begin(name.c_str(), nullptr, ImGuiWindowFlags_NoResize |
ImGuiWindowFlags_NoMove |
ImGuiWindowFlags_NoBackground)) {
ImGui::Columns(2, NULL);
ImGui::Separator();
for (int i = 0; i < 4; ++i) {
......
......@@ -24,12 +24,6 @@ Student::addGrades(Subject *subject, double grade)
}
}
void
Student::render() const
{
ImGui::ImageButton(texture);
}
Student::~Student()
{
// todo
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment