From 8aaeee4327e4b35822557a51c75b3889e3ece7f0 Mon Sep 17 00:00:00 2001 From: "simon.kagstrom" Date: Sat, 2 Jan 2010 12:41:50 +0000 Subject: [PATCH] Add C64 mock and implement network connecting --- main.cpp | 5 +++++ mocks/C64.h | 21 +++++++++++++++++++++ mocks/Network.h | 9 +++++++++ network_menu.cpp | 3 ++- 4 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 mocks/C64.h create mode 100644 mocks/Network.h diff --git a/main.cpp b/main.cpp index fa50691..09d0d90 100644 --- a/main.cpp +++ b/main.cpp @@ -3,8 +3,10 @@ #include "gui.hh" #include "utils.hh" +#include SDL_Surface *screen; +C64 *TheC64; static void run(void) { @@ -28,6 +30,9 @@ static void run(void) static void init(void) { + /* Creation of the mocks */ + TheC64 = new C64(); + screen = SDL_SetVideoMode(640, 480, 16, SDL_DOUBLEBUF); panic_if(!screen, "Cannot initialize video: %s\n", SDL_GetError()); diff --git a/mocks/C64.h b/mocks/C64.h new file mode 100644 index 0000000..a16f67e --- /dev/null +++ b/mocks/C64.h @@ -0,0 +1,21 @@ +#ifndef __MOCKS_C64_H__ +#define __MOCKS_C64_H__ + +/* Network connection type */ +enum +{ + NONE, + CONNECT, + MASTER, + CLIENT +}; + +class C64 +{ +public: + int network_connection_type; +}; + +extern C64 *TheC64; + +#endif /*__MOCKS_C64_H__ */ diff --git a/mocks/Network.h b/mocks/Network.h new file mode 100644 index 0000000..188f470 --- /dev/null +++ b/mocks/Network.h @@ -0,0 +1,9 @@ +#ifndef __MOCKS_NETWORK_H__ +#define __MOCKS_NETWORK_H__ + +class Network +{ +public: +}; + +#endif /*__MOCKS_NETWORK_H__ */ diff --git a/network_menu.cpp b/network_menu.cpp index b4ec7cb..b93c821 100644 --- a/network_menu.cpp +++ b/network_menu.cpp @@ -2,6 +2,7 @@ #include "menu.hh" #include "help_box.hh" #include "virtual_keyboard.hh" +#include class NetworkView; @@ -67,7 +68,7 @@ public: if ( strncmp(Gui::gui->np->NetworkName, "Unset", strlen("Unset")) == 0) Gui::gui->pushDialogueBox(new DialogueBox(network_unset_name_dlg)); else - printf("Connect NYI\n"); // FIXME! Do the actual connect + TheC64->network_connection_type = CONNECT; break; case 6: printf("Send message NYI\n"); // FIXME! Send message