commit
0f3f8d0d1f
Binary file not shown.
@ -0,0 +1,13 @@
|
||||
#ifndef MENU_CONNECTION_INCLUDED
|
||||
#define MENU_CONNECTION_INCLUDED
|
||||
|
||||
#include <SDL2/SDL.h>
|
||||
#include <string.h>
|
||||
#include "engine/Button.h"
|
||||
#include "engine/TextLabel.h"
|
||||
#include "engine/TextInput.h"
|
||||
#include "engine/FontUtils.h"
|
||||
|
||||
bool drawMenuConnection(const SDL_Renderer* renderer, TTF_Font* font, int w, int h);
|
||||
|
||||
#endif
|
@ -0,0 +1,4 @@
|
||||
#include <SDL2/SDL.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
bool drawGameCreationMenu(SDL_Renderer* renderer, TTF_Font* font, int width, int height);
|
@ -1,10 +0,0 @@
|
||||
#ifndef MENU_CONNECTION_INCLUDED
|
||||
#define MENU_CONNECTION_INCLUDED
|
||||
|
||||
#include <SDL2/SDL.h>
|
||||
#include <string.h>
|
||||
#include "engine/Button.h"
|
||||
|
||||
bool drawMenuConnection(const SDL_Renderer* renderer);
|
||||
|
||||
#endif
|
@ -0,0 +1 @@
|
||||
curvilingus/Curvilingus.otf
|
Binary file not shown.
@ -0,0 +1,16 @@
|
||||
Free font by Tup Wanders
|
||||
http://www.tupwanders.nl
|
||||
|
||||
Licensed with a Creative Commons attribution license.
|
||||
|
||||
If you add to the font, please send me a copy! If you've made fun stuff with the font that you would like to show me, please send me that as well. I like that.
|
||||
|
||||
Have fun,
|
||||
Tuppus
|
||||
tupwanders@tupwanders.nl
|
||||
|
||||
If this font suddenly makes you feel like spending huge amounts of money, please do so by going to Paypal and transferring your fortune to tupwanders@tupwanders.nl
|
||||
And if this font suddenly makes feel like spending small or fairly large amounts of money, you can do that via Paypal as well.
|
||||
|
||||
More fonts here:
|
||||
http://www.dafont.com/tup-wanders.d2245
|
Binary file not shown.
Binary file not shown.
@ -0,0 +1,41 @@
|
||||
#include "view/ConnectionMenu.h"
|
||||
|
||||
bool drawMenuConnection(const SDL_Renderer* renderer, TTF_Font* font, int w, int h)
|
||||
{
|
||||
if(font == NULL)
|
||||
{
|
||||
fprintf(stderr, "WARNING: Font can't be null\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
TextInput pseudoInput;
|
||||
P_Button connectionButton;
|
||||
|
||||
SDL_Color black = {255,255,255,255};
|
||||
SDL_Rect pseudoInputRect = {50, h*0.35, 50, 20};
|
||||
|
||||
char title[] = "Connexion";
|
||||
SDL_Point titlePos = {.x=w*0.05, .y=h*0.1};
|
||||
TextLabel titleLabel = createTextLabel(title, &titlePos, &black, font, renderer);
|
||||
|
||||
char pseudoText[] = "Pseudonyme: ";
|
||||
SDL_Point pseudoPos = {.x=w*0.05, .y=h*0.35};
|
||||
TextLabel pseudoLabel = createTextLabel(pseudoText, &pseudoPos, &black, font, renderer);
|
||||
|
||||
char colorText[] = "Couleur: ";
|
||||
SDL_Point colorPos = {.x=w*0.05, .y=h*0.55};
|
||||
TextLabel colorLabel = createTextLabel(colorText, &colorPos, &black, font, renderer);
|
||||
|
||||
if(!initTextInput(&pseudoInput, &pseudoInputRect, NULL, font))
|
||||
{
|
||||
fprintf(stderr, "WARNING: Can't init TextInput\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
drawTextLabel(renderer, &titleLabel);
|
||||
drawTextLabel(renderer, &pseudoLabel);
|
||||
drawTextLabel(renderer, &colorLabel);
|
||||
|
||||
|
||||
return true;
|
||||
}
|
@ -1,17 +0,0 @@
|
||||
#include "view/MenuConnection.h"
|
||||
|
||||
bool drawMenuConnection(const SDL_Renderer* renderer)
|
||||
{
|
||||
const char title[] = "Connexion";
|
||||
const unsigned int titleHeightPercetange = 8;
|
||||
|
||||
const char pseudoLabel[] = "Pseudonyme: ";
|
||||
const unsigned int pseudoLabelHeightPercentage = 16;
|
||||
|
||||
const char colorLabel[] = "Couleur: ";
|
||||
const unsigned int colorLabelHeihetPercentage = 18;
|
||||
|
||||
|
||||
|
||||
return true;
|
||||
}
|
@ -0,0 +1,98 @@
|
||||
#include <SDL2/SDL.h>
|
||||
#include <stdio.h>
|
||||
#include "view/ConnectionMenu.h"
|
||||
#include "engine/FontLoader.h"
|
||||
#include "engine/TextInput.h"
|
||||
|
||||
int testConnectionMenu(void) {
|
||||
SDL_Window *window = NULL;
|
||||
SDL_Renderer *renderer = NULL;
|
||||
SDL_Texture* picture;
|
||||
TextInput textInput;
|
||||
int statut = EXIT_FAILURE;
|
||||
char* path = "rsrc/img/Lenna.png";
|
||||
int i=0;
|
||||
int w, h;
|
||||
if(0 != SDL_Init(SDL_INIT_VIDEO))
|
||||
{
|
||||
fprintf(stderr, "Erreur SDL_INIT: %s\n", SDL_GetError());
|
||||
goto Quit;
|
||||
}
|
||||
|
||||
//fenetre
|
||||
window = SDL_CreateWindow("Fenêtre", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 640,480, SDL_WINDOW_SHOWN);
|
||||
if(window == NULL)
|
||||
{
|
||||
fprintf(stderr, "Erreur SDL_CreateWindow: %s\n", SDL_GetError());
|
||||
goto Quit;
|
||||
}
|
||||
|
||||
//rendu
|
||||
renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED);
|
||||
if(renderer == NULL)
|
||||
{
|
||||
fprintf(stderr, "Erreur SDL_CreateRenderer: %s\n", SDL_GetError());
|
||||
goto Quit;
|
||||
}
|
||||
|
||||
//Fonts
|
||||
if(TTF_Init() == -1)
|
||||
{
|
||||
fprintf(stderr, "Erreur: TTF_Init: %s\n", TTF_GetError());
|
||||
goto Quit;
|
||||
}
|
||||
|
||||
if(0 != SDL_SetRenderDrawColor(renderer, 0,0,0,0)) //choisi la couleur avec laquelle travailler
|
||||
{
|
||||
fprintf(stderr, "Erreur SDL_SetRenderDrawColor: %s\n", SDL_GetError());
|
||||
goto Quit;
|
||||
}
|
||||
|
||||
if(0 != SDL_RenderClear(renderer)) //efface le rendu en le repeignant avec la couleur choisi
|
||||
{
|
||||
fprintf(stderr, "Erreur SDL_SetRenderDrawColor: %s\n", SDL_GetError());
|
||||
goto Quit;
|
||||
}
|
||||
|
||||
if(0 != SDL_SetRenderDrawColor(renderer, 255,255,255,255)) //choisi la couleur avec laquelle travailler
|
||||
{
|
||||
fprintf(stderr, "Erreur SDL_SetRenderDrawColor: %s\n", SDL_GetError());
|
||||
goto Quit;
|
||||
}
|
||||
|
||||
|
||||
SDL_bool quit = SDL_FALSE;
|
||||
SDL_Event event;
|
||||
|
||||
FontHandler fontHandler = loadFonts();
|
||||
|
||||
SDL_GetWindowSize(window, &w, &h);
|
||||
while(!quit)
|
||||
{
|
||||
while(SDL_PollEvent(&event))
|
||||
{
|
||||
switch(event.type)
|
||||
{
|
||||
case SDL_QUIT:
|
||||
quit = SDL_TRUE;
|
||||
break;
|
||||
case SDL_MOUSEBUTTONUP:
|
||||
break;
|
||||
}
|
||||
}
|
||||
drawMenuConnection(renderer, fontHandler.fonts[FONT_retro], w, h);
|
||||
SDL_RenderPresent(renderer);
|
||||
|
||||
SDL_Delay(20);
|
||||
}
|
||||
|
||||
Quit:
|
||||
freeFonts(fontHandler);
|
||||
if(renderer != NULL)
|
||||
SDL_DestroyRenderer(renderer);
|
||||
if(window != NULL)
|
||||
SDL_DestroyWindow(window);
|
||||
TTF_Quit();
|
||||
SDL_Quit();
|
||||
return statut;
|
||||
}
|
Loading…
Reference in new issue