win32: Make USE_CONSOLE compile again

There's even a plausible implementation of CStdInProc::GetEvent.
Günther Brammer 2012-11-15 23:01:24 +01:00
parent 13b9dd2e53
commit a8dfeeaf7e
5 changed files with 22 additions and 7 deletions

View File

@ -488,7 +488,6 @@ set(OC_CLONK_SOURCES
src/object/C4Shape.h src/object/C4Shape.h
src/platform/C4App.cpp src/platform/C4App.cpp
src/platform/C4App.h src/platform/C4App.h
src/platform/C4AppT.cpp
src/platform/C4AppWin32Impl.h src/platform/C4AppWin32Impl.h
src/platform/C4FileMonitor.cpp src/platform/C4FileMonitor.cpp
src/platform/C4FileMonitor.h src/platform/C4FileMonitor.h
@ -633,6 +632,10 @@ elseif(USE_SDL_MAINLOOP)
src/platform/C4AppSDL.cpp src/platform/C4AppSDL.cpp
src/platform/C4WindowSDL.cpp src/platform/C4WindowSDL.cpp
) )
elseif(USE_CONSOLE)
list(APPEND OC_SYSTEM_SOURCES
src/platform/C4AppT.cpp
)
elseif(WIN32) elseif(WIN32)
list(APPEND OC_SYSTEM_SOURCES list(APPEND OC_SYSTEM_SOURCES
src/editor/C4ConsoleWin32.cpp src/editor/C4ConsoleWin32.cpp

View File

@ -203,7 +203,6 @@ src/game/C4GraphicsSystem.h \
src/game/C4Physics.h \ src/game/C4Physics.h \
src/game/C4Viewport.cpp \ src/game/C4Viewport.cpp \
src/game/C4Viewport.h \ src/game/C4Viewport.h \
src/game/ClonkMain.cpp \
src/gamescript/C4Effect.cpp \ src/gamescript/C4Effect.cpp \
src/gamescript/C4Effects.h \ src/gamescript/C4Effects.h \
src/gamescript/C4FindObject.cpp \ src/gamescript/C4FindObject.cpp \
@ -452,7 +451,6 @@ src/object/C4Shape.cpp \
src/object/C4Shape.h \ src/object/C4Shape.h \
src/platform/C4App.cpp \ src/platform/C4App.cpp \
src/platform/C4App.h \ src/platform/C4App.h \
src/platform/C4AppT.cpp \
src/platform/C4AppWin32Impl.h \ src/platform/C4AppWin32Impl.h \
src/platform/C4FileMonitor.cpp \ src/platform/C4FileMonitor.cpp \
src/platform/C4FileMonitor.h \ src/platform/C4FileMonitor.h \
@ -542,6 +540,9 @@ clonk_SOURCES += \
src/platform/C4AppDelegate.h \ src/platform/C4AppDelegate.h \
src/platform/C4AppDelegate.mm \ src/platform/C4AppDelegate.mm \
src/platform/C4FileMonitorMac.mm src/platform/C4FileMonitorMac.mm
else
clonk_SOURCES += \
src/game/ClonkMain.cpp
endif endif
if SDL_MAIN_LOOP if SDL_MAIN_LOOP
@ -558,6 +559,10 @@ src/platform/C4AppGTK.cpp \
src/platform/C4AppGTKImpl.h \ src/platform/C4AppGTKImpl.h \
src/platform/C4WindowGTK.cpp src/platform/C4WindowGTK.cpp
else else
if CONSOLE
clonk_SOURCES += \
src/platform/C4AppT.cpp
else
if WIN32 if WIN32
clonk_SOURCES += \ clonk_SOURCES += \
src/editor/C4ConsoleWin32.cpp \ src/editor/C4ConsoleWin32.cpp \
@ -583,6 +588,7 @@ src/platform/ObjectiveCAssociated.h
endif endif
endif endif
endif endif
endif
if LIBUPNP if LIBUPNP
clonk_SOURCES += src/network/C4Network2UPnPLinux.cpp clonk_SOURCES += src/network/C4Network2UPnPLinux.cpp

View File

@ -208,6 +208,7 @@ else
enable_sdlmainloop=no enable_sdlmainloop=no
VL_LIB_READLINE VL_LIB_READLINE
fi fi
AM_CONDITIONAL([CONSOLE], [test $enable_console = yes])
# Check for boost # Check for boost
AX_BOOST_BASE([1.40.0], [], [ AX_BOOST_BASE([1.40.0], [], [

View File

@ -41,8 +41,10 @@
#define MK_CONTROL (KMOD_LCTRL | KMOD_RCTRL) #define MK_CONTROL (KMOD_LCTRL | KMOD_RCTRL)
#define MK_ALT (KMOD_LALT | KMOD_RALT) #define MK_ALT (KMOD_LALT | KMOD_RALT)
#elif defined(USE_CONSOLE) #elif defined(USE_CONSOLE)
#ifndef _WIN32
#define MK_SHIFT 0 #define MK_SHIFT 0
#define MK_CONTROL 0 #define MK_CONTROL 0
#endif
#define MK_ALT 0 #define MK_ALT 0
#elif defined(USE_COCOA) #elif defined(USE_COCOA)
// declare as extern variables and initialize them in StdMacWindow.mm so as to not include objc headers // declare as extern variables and initialize them in StdMacWindow.mm so as to not include objc headers
@ -84,11 +86,15 @@ public:
// StdSchedulerProc override // StdSchedulerProc override
virtual bool Execute(int iTimeout, pollfd *); virtual bool Execute(int iTimeout, pollfd *);
#ifdef STDSCHEDULER_USE_EVENTS
virtual HANDLE GetEvent() { return GetStdHandle(STD_INPUT_HANDLE); }
#else
virtual void GetFDs(std::vector<struct pollfd> & checkfds) virtual void GetFDs(std::vector<struct pollfd> & checkfds)
{ {
pollfd pfd = { 0, POLLIN, 0 }; pollfd pfd = { 0, POLLIN, 0 };
checkfds.push_back(pfd); checkfds.push_back(pfd);
} }
#endif
private: private:
// commands from stdin // commands from stdin
StdCopyStrBuf CmdBuf; StdCopyStrBuf CmdBuf;

View File

@ -23,7 +23,8 @@
/* A wrapper class to OS dependent event and window interfaces, Text version */ /* A wrapper class to OS dependent event and window interfaces, Text version */
#include <C4Include.h> #include <C4Include.h>
#ifdef USE_CONSOLE #include "C4App.h"
#include <C4Window.h> #include <C4Window.h>
#include <C4Draw.h> #include <C4Draw.h>
#include <C4Application.h> #include <C4Application.h>
@ -125,7 +126,7 @@ CStdInProc::~CStdInProc()
bool CStdInProc::Execute(int iTimeout, pollfd *) bool CStdInProc::Execute(int iTimeout, pollfd *)
{ {
#ifdef _WIN32 #if 0 && defined(_WIN32)
while (_kbhit()) while (_kbhit())
{ {
// Surely not the most efficient way to do it, but we won't have to read much data anyway. // Surely not the most efficient way to do it, but we won't have to read much data anyway.
@ -213,5 +214,3 @@ bool C4Window::RestorePosition(char const*, char const*, bool) {return 0;}
void C4Window::RequestUpdate() {} void C4Window::RequestUpdate() {}
void C4Window::SetSize(unsigned int, unsigned int) {} void C4Window::SetSize(unsigned int, unsigned int) {}
void C4Window::SetTitle(char const*) {} void C4Window::SetTitle(char const*) {}
#endif // USE_CONSOLE