Nouvelle structure de la page d'accueil
This commit is contained in:
@ -59,8 +59,8 @@
|
||||
|
||||
|
||||
/* Vue */
|
||||
#define WIDTH 640
|
||||
#define HEIGHT 640
|
||||
#define WIDTH 720
|
||||
#define HEIGHT 720
|
||||
#define BITSPERPIXEL 32
|
||||
|
||||
#define WINDOWNAME PROJECTDESC
|
||||
|
@ -229,9 +229,17 @@ void dessinerMenu(sfRenderTexture *const renderTexture, const Menu *const menu)
|
||||
}
|
||||
|
||||
|
||||
Bouton* ajouterBoutonAccueil(const Tool outil, const char *const icone, const sfVector2f *const position)
|
||||
Bouton* ajouterBoutonAccueil(const Tool outil, const char *const icone, const sfVector2f *const position, bool lowButt)
|
||||
{
|
||||
const sfVector2f scale = {WIDTH / 4266.7, HEIGHT / 4266.7};
|
||||
sfVector2f scale;
|
||||
if(lowButt)
|
||||
{
|
||||
scale = (sfVector2f){0.15, 0.15};
|
||||
}
|
||||
else
|
||||
{
|
||||
scale = (sfVector2f){0.5, 0.5};
|
||||
}
|
||||
|
||||
Bouton *bouton = loadButtonMenu(outil, "", icone);
|
||||
|
||||
|
@ -111,6 +111,7 @@ void dessinerMenu(sfRenderTexture *const renderTexture, const Menu *const menu);
|
||||
* @param outil L'outil que le bouton représentera.
|
||||
* @param icone Le chemin relatif vers l'icône à charger sur le bouton.
|
||||
* @param position Un pointeur sur les coordonnées du bouton.
|
||||
* @param lowButt booléen pour définir la taille tu bouton
|
||||
* @return Procédure.
|
||||
*/
|
||||
Bouton* ajouterBoutonAccueil(const Tool outil, const char *const icone, const sfVector2f *const position);
|
||||
Bouton* ajouterBoutonAccueil(const Tool outil, const char *const icone, const sfVector2f *const position, bool lowButt);
|
||||
|
49
Vue/vue.c
49
Vue/vue.c
@ -59,27 +59,36 @@ void handleMenu(sfRenderWindow *const window)
|
||||
sfFont *font = loadFontFromFile(REGULARFONTPATH);
|
||||
sfFont *fontIt = loadFontFromFile(ITALICFONTPATH);
|
||||
|
||||
const uint8_t nombreTextes = 8;
|
||||
// Image du projet
|
||||
sfTexture *texture = loadTextureFromFile(PROJECTIMAGEPATH);
|
||||
|
||||
const double ratio = 15 / 100.0;
|
||||
const sfVector2f scale = {((WIDTH + MENUWIDTH) / (float)sfTexture_getSize(texture).x) * ratio, (HEIGHT / (float)sfTexture_getSize(texture).y) * ratio};
|
||||
|
||||
sfSprite *sprite = loadSpriteFromTexture((sfVector2f){(WIDTH + MENUWIDTH) * 83 / 100.0, HEIGHT * 1 / 100.0}, texture);
|
||||
sfSprite_setScale(sprite, scale);
|
||||
|
||||
|
||||
|
||||
/*--------------------------------Textes----------------------------------*/
|
||||
const uint8_t nombreTextes = 4;
|
||||
sfText *textes[nombreTextes];
|
||||
|
||||
textes[0] = creerTexte((sfVector2f){WIDTH / 12.8, HEIGHT / 6.4}, "Cliquez sur l\'icone ci-contre pour", font, WIDTH / 21.3, sfBlack);
|
||||
textes[1] = creerTexte((sfVector2f){WIDTH / 12.8, HEIGHT / 4.3}, "l\'affichage global", font, WIDTH / 21.3, sfBlack);
|
||||
textes[2] = creerTexte((sfVector2f){WIDTH / 12.8, HEIGHT / 2.6}, "Cliquez sur l\'icone ci-contre pour", font, WIDTH / 21.3, sfBlack);
|
||||
textes[3] = creerTexte((sfVector2f){WIDTH / 12.8, HEIGHT / 2.2}, "l'affichage point par point", font, WIDTH / 21.3, sfBlack);
|
||||
textes[4] = creerTexte((sfVector2f){WIDTH / 12.8, HEIGHT / 6.4}, "Cliquez sur l\'icone ci-contre pour", font, WIDTH / 21.3, sfBlack);
|
||||
textes[5] = creerTexte((sfVector2f){WIDTH / 12.8, HEIGHT / 4.3}, "l\'affichage automatique", font, WIDTH / 21.3, sfBlack);
|
||||
textes[6] = creerTexte((sfVector2f){WIDTH / 12.8, HEIGHT / 2.6}, "Cliquez sur l\'icone ci-contre pour", font, WIDTH / 21.3, sfBlack);
|
||||
textes[7] = creerTexte((sfVector2f){WIDTH / 12.8, HEIGHT / 2.2}, "l\'affichage manuel", font, WIDTH / 21.3, sfBlack);
|
||||
textes[0] = creerTexte((sfVector2f){WIDTH * (18 / 100.0), HEIGHT * (67 / 100.0)}, "GLOBAL", font, WIDTH / 21.3, sfBlack);
|
||||
textes[1] = creerTexte((sfVector2f){WIDTH * (60 / 100.0), HEIGHT * (67 / 100.0)}, "POINT PAR POINT", font, WIDTH / 21.3, sfBlack);
|
||||
textes[2] = creerTexte((sfVector2f){WIDTH * (18 / 100.0), HEIGHT * (67 / 100.0)}, "MANUEL", font, WIDTH / 21.3, sfBlack);
|
||||
textes[3] = creerTexte((sfVector2f){WIDTH * (64 / 100.0), HEIGHT * (67 / 100.0)}, "AUTOMATIQUE", font, WIDTH / 21.3, sfBlack);
|
||||
|
||||
|
||||
sfText *cheminFichier = NULL;
|
||||
|
||||
/* -------------------------- Création des boutons du premier menu ------------------------- */
|
||||
Bouton *boutonPBP = ajouterBoutonAccueil(NO_TOOL, "Vue/Ressources/Icones/navigation.png", &(sfVector2f){WIDTH / 1.2, HEIGHT / 2.5});
|
||||
Bouton *boutonGLO = ajouterBoutonAccueil(NO_TOOL, "Vue/Ressources/Icones/global.png", &(sfVector2f){WIDTH / 1.2, HEIGHT / 5.8});
|
||||
Bouton *boutonPBPA = ajouterBoutonAccueil(NO_TOOL, "Vue/Ressources/Icones/video-player.png", &(sfVector2f){WIDTH / 1.2, HEIGHT / 5.8});
|
||||
Bouton *boutonPBPM = ajouterBoutonAccueil(NO_TOOL, "Vue/Ressources/Icones/placeholder.png", &(sfVector2f){WIDTH / 1.2, HEIGHT / 2.5});
|
||||
Bouton *boutonHOME = ajouterBoutonAccueil(NO_TOOL, "Vue/Ressources/Icones/home.png", &(sfVector2f){WIDTH / 10.0, HEIGHT / 1.2});
|
||||
Bouton *boutonGLMF = ajouterBoutonAccueil(NO_TOOL, "Vue/Ressources/Icones/folder.png", &(sfVector2f){WIDTH / 1.2, HEIGHT / 1.2});
|
||||
Bouton *boutonPBP = ajouterBoutonAccueil(NO_TOOL, "Vue/Ressources/Icones/navigation.png", &(sfVector2f){WIDTH * (60/100.0), HEIGHT * (20 / 100.0)}, false);
|
||||
Bouton *boutonGLO = ajouterBoutonAccueil(NO_TOOL, "Vue/Ressources/Icones/global.png", &(sfVector2f){WIDTH / 15, HEIGHT * (20 / 100.0)}, false);
|
||||
Bouton *boutonPBPA = ajouterBoutonAccueil(NO_TOOL, "Vue/Ressources/Icones/video-player.png", &(sfVector2f){WIDTH * (60/100.0), HEIGHT * (20 / 100.0)}, false);
|
||||
Bouton *boutonPBPM = ajouterBoutonAccueil(NO_TOOL, "Vue/Ressources/Icones/placeholder.png", &(sfVector2f){WIDTH / 15, HEIGHT * (20 / 100.0)}, false);
|
||||
Bouton *boutonHOME = ajouterBoutonAccueil(NO_TOOL, "Vue/Ressources/Icones/home.png", &(sfVector2f){WIDTH / 10.0, HEIGHT / 1.2}, true);
|
||||
Bouton *boutonGLMF = ajouterBoutonAccueil(NO_TOOL, "Vue/Ressources/Icones/folder.png", &(sfVector2f){WIDTH / 1.2, HEIGHT / 1.2}, true);
|
||||
/* ----------------------------------------------------------------------------------------- */
|
||||
|
||||
sfSprite *renderSprite = NULL;
|
||||
@ -98,7 +107,7 @@ void handleMenu(sfRenderWindow *const window)
|
||||
{
|
||||
sfRenderTexture_clear(renderTexture, COULEUR_GRIS);
|
||||
|
||||
for(uint8_t i = 0; i < 4; i++)
|
||||
for(uint8_t i = 0; i < 2; i++)
|
||||
{
|
||||
sfRenderTexture_drawText(renderTexture, textes[i], NULL);
|
||||
}
|
||||
@ -112,6 +121,7 @@ void handleMenu(sfRenderWindow *const window)
|
||||
sfRenderTexture_drawText(renderTexture, cheminFichier, NULL);
|
||||
}
|
||||
|
||||
sfRenderTexture_drawSprite(renderTexture, sprite, NULL);
|
||||
sfRenderTexture_display(renderTexture);
|
||||
|
||||
sfSprite_destroy(renderSprite);
|
||||
@ -147,7 +157,7 @@ void handleMenu(sfRenderWindow *const window)
|
||||
sfRenderTexture_clear(renderTexture, COULEUR_GRIS);
|
||||
|
||||
/* ------------------- Affichage du texte et des boutons du second menu ------------------- */
|
||||
for(uint8_t i = 4; i < nombreTextes; i++)
|
||||
for(uint8_t i = 2; i < nombreTextes; i++)
|
||||
{
|
||||
sfRenderTexture_drawText(renderTexture, textes[i], NULL);
|
||||
}
|
||||
@ -155,7 +165,7 @@ void handleMenu(sfRenderWindow *const window)
|
||||
sfRenderTexture_drawSprite(renderTexture, boutonPBPA->spriteButton, NULL);
|
||||
sfRenderTexture_drawSprite(renderTexture, boutonPBPM->spriteButton, NULL);
|
||||
sfRenderTexture_drawSprite(renderTexture, boutonHOME->spriteButton, NULL);
|
||||
|
||||
sfRenderTexture_drawSprite(renderTexture, sprite, NULL);
|
||||
sfRenderTexture_display(renderTexture);
|
||||
|
||||
sfSprite_destroy(renderSprite);
|
||||
@ -213,6 +223,7 @@ void handleMenu(sfRenderWindow *const window)
|
||||
else if(mouseIsInRect(((sfVector2f){event.mouseButton.x, event.mouseButton.y}), boutonGLMF->zone))
|
||||
{
|
||||
temp = chooseFilesToOpen(window, renderSprite, true);
|
||||
uint32_t taille = strlen(temp);
|
||||
if(temp != NULL)
|
||||
{
|
||||
sfText_destroy(cheminFichier);
|
||||
@ -227,7 +238,7 @@ void handleMenu(sfRenderWindow *const window)
|
||||
|
||||
else if(nbFiles == 1)
|
||||
{
|
||||
cheminFichier = creerTexte((sfVector2f){WIDTH / 12.8, HEIGHT / 1.1}, temp, fontIt, WIDTH * (2.5 / 100.0), sfBlack);
|
||||
cheminFichier = creerTexte((sfVector2f){WIDTH * (10 / 100.0), HEIGHT * (90 / 100.0)}, temp, fontIt, WIDTH * (2.5 / 100.0) * 60 / taille, sfBlack);
|
||||
}
|
||||
|
||||
else
|
||||
|
Reference in New Issue
Block a user