Skip to content

Commit fe22f63

Browse files
committed
xrEngine, xrGame: replace DIK_ on SDL_SCANCODE_
1 parent c2984ce commit fe22f63

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

89 files changed

+337
-305
lines changed

src/editors/xrEditor/packages.config

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<packages>
3+
<package id="sdl2" version="2.0.5" targetFramework="native" />
4+
<package id="sdl2.redist" version="2.0.5" targetFramework="native" />
5+
</packages>

src/editors/xrEditor/xrEditor.vcxproj

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,19 @@
9696
</Reference>
9797
<Reference Include="WindowsBase" />
9898
</ItemGroup>
99+
<ItemGroup>
100+
<None Include="packages.config" />
101+
</ItemGroup>
99102
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
100103
<ImportGroup Label="ExtensionTargets">
104+
<Import Project="..\..\packages\sdl2.redist.2.0.5\build\native\sdl2.redist.targets" Condition="Exists('..\..\packages\sdl2.redist.2.0.5\build\native\sdl2.redist.targets')" />
105+
<Import Project="..\..\packages\sdl2.2.0.5\build\native\sdl2.targets" Condition="Exists('..\..\packages\sdl2.2.0.5\build\native\sdl2.targets')" />
101106
</ImportGroup>
107+
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
108+
<PropertyGroup>
109+
<ErrorText>Данный проект ссылается на пакеты NuGet, отсутствующие на этом компьютере. Используйте восстановление пакетов NuGet, чтобы скачать их. Дополнительную информацию см. по адресу: http://go.microsoft.com/fwlink/?LinkID=322105. Отсутствует следующий файл: {0}.</ErrorText>
110+
</PropertyGroup>
111+
<Error Condition="!Exists('..\..\packages\sdl2.redist.2.0.5\build\native\sdl2.redist.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\sdl2.redist.2.0.5\build\native\sdl2.redist.targets'))" />
112+
<Error Condition="!Exists('..\..\packages\sdl2.2.0.5\build\native\sdl2.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\sdl2.2.0.5\build\native\sdl2.targets'))" />
113+
</Target>
102114
</Project>

src/editors/xrEditor/xrEditor.vcxproj.filters

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,10 @@
77
<ClCompile Include="pch.cpp" />
88
<ClCompile Include="entry_point.cpp" />
99
</ItemGroup>
10+
<ItemGroup>
11+
<Natvis Include="..\..\TypeHelper.natvis" />
12+
</ItemGroup>
13+
<ItemGroup>
14+
<None Include="packages.config" />
15+
</ItemGroup>
1016
</Project>

src/xrEngine/IInputReceiver.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ void IInputReceiver::IR_OnDeactivate(void)
2727
int i;
2828
for (i = 0; i < CInput::COUNT_KB_BUTTONS; i++)
2929
if (IR_GetKeyState(i))
30-
IR_OnKeyboardRelease(i);
30+
IR_OnKeyboardRelease((SDL_Scancode)i);
3131

3232
for (i = 0; i < CInput::COUNT_MOUSE_BUTTONS; i++)
3333
if (IR_GetBtnState(i))

src/xrEngine/IInputReceiver.h

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,11 @@
66
#ifndef IINPUTRECEIVERH
77
#define IINPUTRECEIVERH
88
#include "xrCore/_flags.h"
9+
#include "xrGame/xr_level_controller.h"
910

1011
// fwd. decl.
11-
template <class T> struct _vector2;
12+
template <class T>
13+
struct _vector2;
1214
using Fvector2 = _vector2<float>;
1315
using Ivector2 = _vector2<int>;
1416

@@ -29,16 +31,16 @@ class ENGINE_API IInputReceiver
2931
virtual void IR_OnDeactivate(void);
3032
virtual void IR_OnActivate(void);
3133

32-
virtual void IR_OnMousePress(int /*btn*/) {};
33-
virtual void IR_OnMouseRelease(int /*btn*/) {};
34-
virtual void IR_OnMouseHold(int /*btn*/) {};
35-
virtual void IR_OnMouseWheel(int /*direction*/) {};
36-
virtual void IR_OnMouseMove(int /*x*/, int /*y*/) {};
37-
virtual void IR_OnMouseStop(int /*x*/, int /*y*/) {};
34+
virtual void IR_OnMousePress(int /*btn*/){};
35+
virtual void IR_OnMouseRelease(int /*btn*/){};
36+
virtual void IR_OnMouseHold(int /*btn*/){};
37+
virtual void IR_OnMouseWheel(int /*direction*/){};
38+
virtual void IR_OnMouseMove(int /*x*/, int /*y*/){};
39+
virtual void IR_OnMouseStop(int /*x*/, int /*y*/){};
3840

39-
virtual void IR_OnKeyboardPress(int /*dik*/) {};
40-
virtual void IR_OnKeyboardRelease(int /*dik*/) {};
41-
virtual void IR_OnKeyboardHold(int /*dik*/) {};
41+
virtual void IR_OnKeyboardPress(int /*dik*/){};
42+
virtual void IR_OnKeyboardRelease(int /*dik*/){};
43+
virtual void IR_OnKeyboardHold(int /*dik*/){};
4244
};
4345

4446
ENGINE_API extern float psMouseSens;

src/xrEngine/XR_IOConsole.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -614,6 +614,8 @@ void CConsole::Show()
614614
Device.seqFrame.Add(this);
615615
}
616616

617+
extern CInput* pInput;
618+
617619
void CConsole::Hide()
618620
{
619621
if (!bVisible || g_pGamePersistent && GEnv.isDedicatedServer)
@@ -622,7 +624,7 @@ void CConsole::Hide()
622624
// if ( g_pGameLevel ||
623625
// ( g_pGamePersistent && g_pGamePersistent->m_pMainMenu && g_pGamePersistent->m_pMainMenu->IsActive() ))
624626

625-
//if (pInput->get_exclusive_mode())
627+
if (pInput->get_exclusive_mode())
626628
{
627629
SetCursorPos(m_mouse_pos.x, m_mouse_pos.y);
628630
}

src/xrEngine/device.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,6 @@ class ENGINE_API CRenderDevice : public CRenderDeviceBase
165165

166166
public:
167167
SDL_Window* m_sdlWnd;
168-
SDL_Renderer* m_sdlRndr;
169168
LRESULT MsgProc(HWND, UINT, WPARAM, LPARAM);
170169

171170
// u32 dwFrame;

src/xrEngine/edit_actions.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@ void callback_base::on_key_press(line_edit_control* const control)
4545

4646
// -------------------------------------------------------------------------------------------------
4747

48-
type_pair::type_pair(u32 dik, char c, char c_shift, bool b_translate) { init(dik, c, c_shift, b_translate); }
48+
type_pair::type_pair(SDL_Scancode dik, char c, char c_shift, bool b_translate) { init(dik, c, c_shift, b_translate); }
4949
type_pair::~type_pair() {}
50-
void type_pair::init(u32 dik, char c, char c_shift, bool b_translate)
50+
void type_pair::init(SDL_Scancode dik, char c, char c_shift, bool b_translate)
5151
{
5252
m_translate = b_translate;
5353
m_dik = dik;

src/xrEngine/edit_actions.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,13 @@ class callback_base : public base
5252
class type_pair : public base
5353
{
5454
public:
55-
type_pair(u32 dik, char c, char c_shift, bool b_translate);
55+
type_pair(SDL_Scancode dik, char c, char c_shift, bool b_translate);
5656
virtual ~type_pair();
57-
void init(u32 dik, char c, char c_shift, bool b_translate);
57+
void init(SDL_Scancode dik, char c, char c_shift, bool b_translate);
5858
virtual void on_key_press(line_edit_control* const control);
5959

6060
private:
61-
u32 m_dik;
61+
SDL_Scancode m_dik;
6262
bool m_translate;
6363
char m_char;
6464
char m_char_shift;

src/xrEngine/line_edit_control.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ line_edit_control::line_edit_control(u32 str_buffer_size)
7373
m_buf2 = nullptr;
7474
m_buf3 = nullptr;
7575

76-
for (u32 i = 0; i < SDL_SCANCODE_COUNT; ++i)
76+
for (u32 i = 0; i < SDL_NUM_SCANCODES; ++i)
7777
m_actions[i] = nullptr;
7878

7979
init(str_buffer_size);
@@ -191,7 +191,7 @@ void line_edit_control::init(u32 str_buffer_size, init_mode mode)
191191

192192
clear_states();
193193

194-
for (u32 i = 0; i < SDL_SCANCODE_COUNT; ++i)
194+
for (u32 i = 0; i < SDL_NUM_SCANCODES; ++i)
195195
{
196196
xr_delete(m_actions[i]);
197197
m_actions[i] = nullptr;
@@ -359,7 +359,7 @@ void line_edit_control::assign_char_pairs(init_mode mode)
359359
create_char_pair(SDL_SCANCODE_Z, 'z', 'Z', true);
360360
}
361361

362-
void line_edit_control::create_key_state(u32 const dik, key_state state)
362+
void line_edit_control::create_key_state(SDL_Scancode const dik, key_state state)
363363
{
364364
Base* prev = m_actions[dik];
365365
// if ( m_actions[dik] )
@@ -369,7 +369,7 @@ void line_edit_control::create_key_state(u32 const dik, key_state state)
369369
m_actions[dik] = new text_editor::key_state_base(state, prev);
370370
}
371371

372-
void line_edit_control::create_char_pair(u32 const dik, char c, char c_shift, bool translate)
372+
void line_edit_control::create_char_pair(SDL_Scancode const dik, char c, char c_shift, bool translate)
373373
{
374374
if (m_actions[dik])
375375
{
@@ -379,9 +379,9 @@ void line_edit_control::create_char_pair(u32 const dik, char c, char c_shift, bo
379379
m_actions[dik] = new text_editor::type_pair(dik, c, c_shift, translate);
380380
}
381381

382-
void line_edit_control::assign_callback(u32 const dik, key_state state, Callback const& callback)
382+
void line_edit_control::assign_callback(SDL_Scancode const dik, key_state state, Callback const& callback)
383383
{
384-
VERIFY(dik < SDL_SCANCODE_COUNT);
384+
VERIFY(dik < SDL_NUM_SCANCODES);
385385
Base* prev_action = m_actions[dik];
386386
m_actions[dik] = new text_editor::callback_base(callback, state);
387387
m_actions[dik]->on_assign(prev_action);
@@ -405,9 +405,9 @@ void line_edit_control::set_edit(pcstr str)
405405

406406
// ========================================================
407407

408-
void line_edit_control::on_key_press(int dik)
408+
void line_edit_control::on_key_press(SDL_Scancode dik)
409409
{
410-
if (SDL_SCANCODE_COUNT <= dik)
410+
if (SDL_NUM_SCANCODES <= dik)
411411
{
412412
return;
413413
}
@@ -451,7 +451,7 @@ void line_edit_control::on_key_press(int dik)
451451

452452
// -------------------------------------------------------------------------------------------------
453453

454-
void line_edit_control::on_key_hold(int dik)
454+
void line_edit_control::on_key_hold(SDL_Scancode dik)
455455
{
456456
update_key_states();
457457
update_bufs();
@@ -478,7 +478,7 @@ void line_edit_control::on_key_hold(int dik)
478478
}
479479
}
480480

481-
void line_edit_control::on_key_release(int dik)
481+
void line_edit_control::on_key_release(SDL_Scancode dik)
482482
{
483483
m_accel = 1.0f;
484484
m_rep_time = 0.0f;

0 commit comments

Comments
 (0)