Subversion Repository Public Repository

fonline_sdk

This repository has no backups
This repository's network speed is throttled to 100KB/sec

Diff Revisions 645 vs 646 for /Modules/Core/Input.fos

Diff revisions: vs.
  @@ -1,32 +1,28 @@
1 1 // FOS Client
2 2
3 - #include "Input"
4 - #include "Gui"
5 -
6 - import void TryExit() from "GuiScreens";
7 - import void NextCursor() from "GuiScreens";
8 - import void SwitchMainItemMode( bool next ) from "Parameters";
3 + /*EXPORT*/ funcdef bool KeyDownCallback( uint8 key, string@ text );
4 + /*EXPORT*/ funcdef void KeyUpCallback( uint8 key );
9 5
10 6 bool[] KeyPressed;
11 7 bool[] MousePressed;
12 8
13 9 KeyDownCallback@[] KeyDownCallbacks;
14 10 KeyUpCallback@[] KeyUpCallbacks;
15 - void AddKeyDownCallback( KeyDownCallback@ callback ) { KeyDownCallbacks.insertLast( callback ); }
16 - void AddKeyUpCallback( KeyUpCallback@ callback ) { KeyUpCallbacks.insertLast( callback ); }
11 + /*EXPORT*/ void AddKeyDownCallback( KeyDownCallback@ callback ) { KeyDownCallbacks.insertLast( callback ); }
12 + /*EXPORT*/ void AddKeyUpCallback( KeyUpCallback@ callback ) { KeyUpCallbacks.insertLast( callback ); }
17 13
18 14 // Export
19 - bool IsKeyPressed( uint8 key ) { return KeyPressed[ key ]; }
20 - bool IsMousePressed( int button ) { return MousePressed[ button ]; }
21 - bool IsCtrlDown() { return KeyPressed[ DIK_RCONTROL ] || KeyPressed[ DIK_LCONTROL ]; }
22 - bool IsAltDown() { return KeyPressed[ DIK_LMENU ] || KeyPressed[ DIK_RMENU ]; }
23 - bool IsShiftDown() { return KeyPressed[ DIK_LSHIFT ] || KeyPressed[ DIK_RSHIFT ]; }
15 + /*EXPORT*/ bool IsKeyPressed( uint8 key ) { return KeyPressed[ key ]; }
16 + /*EXPORT*/ bool IsMousePressed( int button ) { return MousePressed[ button ]; }
17 + /*EXPORT*/ bool IsCtrlDown() { return KeyPressed[ DIK_RCONTROL ] || KeyPressed[ DIK_LCONTROL ]; }
18 + /*EXPORT*/ bool IsAltDown() { return KeyPressed[ DIK_LMENU ] || KeyPressed[ DIK_RMENU ]; }
19 + /*EXPORT*/ bool IsShiftDown() { return KeyPressed[ DIK_LSHIFT ] || KeyPressed[ DIK_RSHIFT ]; }
24 20
25 - bool[] @ GetKeyPressed()
21 + /*EXPORT*/ bool[] @ GetKeyPressed()
26 22 {
27 23 return KeyPressed;
28 24 }
29 - bool[] @ GetMousePressed()
25 + /*EXPORT*/ bool[] @ GetMousePressed()
30 26 {
31 27 return MousePressed;
32 28 }
  @@ -44,14 +40,14 @@
44 40 MousePressed.resize( MOUSE_BUTTON_EXT4 + 1 );
45 41 }
46 42
47 - void ReleaseKeys()
43 + /*EXPORT*/ void ReleaseKeys()
48 44 {
49 45 for( uint i = 0; i < KeyPressed.length(); i++ )
50 46 if( KeyPressed[ i ] )
51 47 OnKeyUp( i );
52 48 }
53 49
54 - void ReleaseMouse()
50 + /*EXPORT*/ void ReleaseMouse()
55 51 {
56 52 for( uint i = 0; i < MousePressed.length(); i++ )
57 53 if( MousePressed[ i ] )
  @@ -65,19 +61,19 @@
65 61 {
66 62 MousePressed[ button ] = true;
67 63
68 - GUI_EngineCallback_MouseDown( button );
64 + Gui::EngineCallback_MouseDown( button );
69 65 }
70 66
71 67 void OnMouseUp( int button ) // Engine callback
72 68 {
73 69 MousePressed[ button ] = false;
74 70
75 - GUI_EngineCallback_MouseUp( button );
71 + Gui::EngineCallback_MouseUp( button );
76 72 }
77 73
78 74 void OnMouseMove() // Engine callback
79 75 {
80 - GUI_EngineCallback_MouseMove();
76 + Gui::EngineCallback_MouseMove();
81 77 }
82 78
83 79 // //////////////////////////////////////////////////////////////////////////////////////////////////
  @@ -98,7 +94,7 @@
98 94 for( uint i = 0; !handled && i < KeyDownCallbacks.length(); i++ )
99 95 handled = KeyDownCallbacks[ i ] ( key, text );
100 96 if( !handled )
101 - GUI_EngineCallback_KeyDown( key, text );
97 + Gui::EngineCallback_KeyDown( key, text );
102 98 }
103 99
104 100 void OnKeyUp( uint8 key ) // Engine callback
  @@ -111,7 +107,7 @@
111 107 // Handlers
112 108 for( uint i = 0; i < KeyUpCallbacks.length(); i++ )
113 109 KeyUpCallbacks[ i ] ( key );
114 - GUI_EngineCallback_KeyUp( key );
110 + Gui::EngineCallback_KeyUp( key );
115 111 }
116 112
117 113 // //////////////////////////////////////////////////////////////////////////////////////////////////
  @@ -122,6 +118,6 @@
122 118 ReleaseKeys();
123 119 ReleaseMouse();
124 120
125 - // GUI handler
126 - GUI_EngineCallback_InputLost();
121 + // Gui:: handler
122 + Gui::EngineCallback_InputLost();
127 123 }