win32: Make USE_CONSOLE compile again

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

View File

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

View File

@ -204,7 +204,6 @@ src/game/C4GraphicsSystem.h \
src/game/C4Physics.h \
src/game/C4Viewport.cpp \
src/game/C4Viewport.h \
src/game/ClonkMain.cpp \
src/gamescript/C4Effect.cpp \
src/gamescript/C4Effects.h \
src/gamescript/C4FindObject.cpp \
@ -451,7 +450,6 @@ src/object/C4Shape.cpp \
src/object/C4Shape.h \
src/platform/C4App.cpp \
src/platform/C4App.h \
src/platform/C4AppT.cpp \
src/platform/C4AppWin32Impl.h \
src/platform/C4FileMonitor.cpp \
src/platform/C4FileMonitor.h \
@ -541,6 +539,9 @@ clonk_SOURCES += \
src/platform/C4AppDelegate.h \
src/platform/C4AppDelegate.mm \
src/platform/C4FileMonitorMac.mm
else
clonk_SOURCES += \
src/game/ClonkMain.cpp
endif
if SDL_MAIN_LOOP
@ -557,6 +558,10 @@ src/platform/C4AppGTK.cpp \
src/platform/C4AppGTKImpl.h \
src/platform/C4WindowGTK.cpp
else
if CONSOLE
clonk_SOURCES += \
src/platform/C4AppT.cpp
else
if WIN32
clonk_SOURCES += \
src/editor/C4ConsoleWin32.cpp \
@ -582,6 +587,7 @@ src/platform/ObjectiveCAssociated.h
endif
endif
endif
endif
if AUTOUPDATE
clonk_SOURCES += \

View File

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

View File

@ -41,8 +41,10 @@
#define MK_CONTROL (KMOD_LCTRL | KMOD_RCTRL)
#define MK_ALT (KMOD_LALT | KMOD_RALT)
#elif defined(USE_CONSOLE)
#ifndef _WIN32
#define MK_SHIFT 0
#define MK_CONTROL 0
#endif
#define MK_ALT 0
#elif defined(USE_COCOA)
// declare as extern variables and initialize them in StdMacWindow.mm so as to not include objc headers
@ -84,11 +86,15 @@ public:
// StdSchedulerProc override
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)
{
pollfd pfd = { 0, POLLIN, 0 };
checkfds.push_back(pfd);
}
#endif
private:
// commands from stdin
StdCopyStrBuf CmdBuf;

View File

@ -23,7 +23,8 @@
/* A wrapper class to OS dependent event and window interfaces, Text version */
#include <C4Include.h>
#ifdef USE_CONSOLE
#include "C4App.h"
#include <C4Window.h>
#include <C4Draw.h>
#include <C4Application.h>
@ -125,7 +126,7 @@ CStdInProc::~CStdInProc()
bool CStdInProc::Execute(int iTimeout, pollfd *)
{
#ifdef _WIN32
#if 0 && defined(_WIN32)
while (_kbhit())
{
// 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::SetSize(unsigned int, unsigned int) {}
void C4Window::SetTitle(char const*) {}
#endif // USE_CONSOLE