summaryrefslogtreecommitdiffstats
path: root/game/code/console/debugconsolecallback.h
blob: 3dd3370f6ce8d14a658d2efa80684448ad905f69 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
//==============================================================================
// Copyright (C) 2002 Radical Entertainment Ltd.  All rights reserved.
//
// File:        debugconsolecallback.h
//
// Description: 
//
// History:     05/06/2002 + Created. Thanks to Mirth for this. -- Darwin Chau
//
//==============================================================================

#ifndef DEBUG_CONSOLE_CALLBACK_H
#define DEBUG_CONSOLE_CALLBACK_H

//========================================
// Nested Includes
//========================================
// Radcore
#include <raddebugconsole.hpp>
#include <console/console.h>

//========================================
// Forward References
//========================================

//==============================================================================
//
// Synopsis: Implement the callbacks so our console integrates with the
//           remote input support from radcore.
//
//==============================================================================
class DebugConsoleCallback : public IRadDebugConsoleKeyboardInputCallback,
                             public IRadDebugConsolePointerInputCallback
{
	public:

		DebugConsoleCallback();
		~DebugConsoleCallback();

        // Implement IRadDebugConsoleKeyboardInputCallback
        void OnChar( int asciiKey );
        void OnVKey( int virtualKey, bool ctrl, bool shift, bool alt );
		
		// Implement IRadDebugConsolePointerInputCallback
        void OnButtonClick( int xTextPixels, int yTextPixels, int xScreenPixels, int yScreenPixels, bool ctrl, bool shift, bool alt );
        void OnButtonDown( int xTextPixels, int yTextPixels, int xScreenPixels, int yScreenPixels, bool ctrl, bool shift, bool alt );
        void OnButtonUp( int xTextPixels, int yTextPixels, int xScreenPixels, int yScreenPixels, bool ctrl, bool shift, bool alt );
        void OnButtonMove( int xTextPixels, int yTextPixels, int xScreenPixels, int yScreenPixels, bool ctrl, bool shift, bool alt, bool bottondown );

		const char* GetConsoleEntry( int* cursorPosition )
		{
			*cursorPosition = mCursorPosition;
			return( mConsoleHistory[0] );
		}

	private:
		
        enum{ CONSOLE_HISTORY_SIZE = 64 };
		
        char mConsoleHistory[CONSOLE_HISTORY_SIZE][Console::MAX_STRING_LENGTH];
		int mFirstHistoryIndex;
		int mLastHistoryIndex;
		int mGetHistoryIndex;
		int mCursorPosition;
		
		// Used to let events not handled by OnVKey() be passed to OnChar()
		bool mInputHandled;

		// Tab completion vars
		tNameInsensitive mTabCompleteString;
		tNameInsensitive mTabCurrentFunction ;
};

#endif // DEBUG_CONSOLE_CALLBACK_H