Browse Source

added networking startup to main.cpp. todo: do front end game design of what makes a game fun. fester.h is some windows socket related stuff.

wes 4 years ago
parent
commit
e975f02ae5
5 changed files with 56 additions and 1 deletions
  1. 22 0
      Qwixx/fester.h
  2. 2 1
      Qwixx/game.cpp
  3. 1 0
      Qwixx/game.h
  4. 14 0
      Qwixx/main.cpp
  5. 17 0
      Qwixx/toDo.md

+ 22 - 0
Qwixx/fester.h

@@ -0,0 +1,22 @@
+#ifndef FESTER
+    #define FESTER
+	
+	#include <stdint.h>
+	
+	#ifdef _WIN32
+	#include <winsock2.h>
+	#define __STARTUP() WSADATA wsaData; if(dumbdumbdumbdumbdumb(&wsaData)) return 1;	
+	int dumbdumbdumbdumbdumb(WSADATA *w);
+	#else
+	#defien __STARTUP() ;
+	#endif
+	
+    // get socket, set socket options, bind to a port, and listen
+    int setup();
+	
+	struct client* allocateBunnies(int sock);
+	
+	int somethingNeedDoing(uint16_t milliseconds, struct client * pool);
+
+
+#endif

+ 2 - 1
Qwixx/game.cpp

@@ -85,7 +85,8 @@ void Game::round()
             temp = temp && players[i].isTurnDone;
         }
         if(temp){break;}
-        Sleep(1);
+        // technically this is a sleep, milliseconds is for how long
+		somethingNeedDoing(1000 /* milliseconds */, storage);
     }
     // save data from currentTurnOlok into cumulativeOlok
     for(int i = 0; i <players.size();i++)

+ 1 - 0
Qwixx/game.h

@@ -6,6 +6,7 @@
     #include <windows.h>
     #include <array>
     #include <time.h>
+    #include "fester.h" //temp network library
     struct Turn 
     {
         std::array<Move, 2> moves;

+ 14 - 0
Qwixx/main.cpp

@@ -1,7 +1,21 @@
 #include <iostream>
 #include <stdlib.h>
 #include "game.h"
+#include "fester.h"
 int main (){
+    struct client * storage;
+	
+	// does something dumb for Msft
+	__STARTUP();
+	
+	// get a server socket from the Operating system
+	int sock = setup();
+	
+	// allocate memory for storage for the life of the application
+	if(NULL == (storage = allocateBunnies(sock))) {
+		fprintf(stderr, "not enough memory for program to run\n");
+		return 0;
+	}
     fprintf (stdout,"Qwixx initiated!\n");
     Game newgame;
     newgame.addPlayer("itsMe");

+ 17 - 0
Qwixx/toDo.md

@@ -40,5 +40,22 @@
 - current make process involves compiling all object files from dice, game, playercard to create main.exe which has to be manually linked to these objects. update makefile to support object file code
 - what comes in from players: newest item checked off on row&column (maybe 2) or penalty
 
+##  front end
+    1. executable (icon 2 dice with Word Qwixx over it)
+    1. transition screen with sound effect & game name
+    1. home screen - falling dice in background and casino music
+    1. user buttons (make a sound when clicked)
+        - start/join game
+        - player stats (shows game stats from prior games of all players)
+        - options
+        - exit
+    1. during turns the outside of the screen goes from green(1min), to yellow(1.5min), to orange(pulsing), to red depending on time left
+    1. user gets a Win/Loss Ratio posted in the middle-top of screen and associated title
+    1. when user takes a penalty flash a RED X & -5 points across their screen and associated penalty sound
+    1. game end shows score screen with a sound
+    1. kyle likes sounds, emotes, "tips", levels, player back stories, subtle lists to players
+    1. kyle hates loading screens, blank areas (things with no purpose)
+    1. emma likes a ready check
+
 ## the game is ended
 - list the scores and indicate the winner