Ver código fonte

ui: move a lot of files around.

Most input and GUI files are now in a common ui/ directory. The platform/
directory is no longer, as everythyng was moved to application/ or ui/.
legacy
Sam Hocevar 5 anos atrás
pai
commit
016330c12b
24 arquivos alterados com 112 adições e 334 exclusões
  1. +3
    -4
      doc/doxygen.cfg.in
  2. +7
    -11
      src/Makefile.am
  3. +3
    -4
      src/application/android-app.cpp
  4. +0
    -0
      src/application/android-app.h
  5. +2
    -2
      src/application/application.cpp
  6. +2
    -2
      src/application/egl-app.cpp
  7. +0
    -0
      src/application/egl-app.h
  8. +2
    -2
      src/application/sdl-app.cpp
  9. +18
    -18
      src/lol-core.vcxproj
  10. +31
    -30
      src/lol-core.vcxproj.filter
  11. +5
    -5
      src/lol/extras.h
  12. +0
    -187
      src/platform/emscripten/lol_shell.html
  13. +0
    -11
      src/ui/controller.cpp
  14. +6
    -22
      src/ui/controller.h
  15. +23
    -3
      src/ui/d3d9-input.cpp
  16. +0
    -0
      src/ui/d3d9-input.h
  17. +0
    -0
      src/ui/gui.cpp
  18. +0
    -0
      src/ui/gui.h
  19. +5
    -5
      src/ui/input.cpp
  20. +1
    -24
      src/ui/input.h
  21. +0
    -0
      src/ui/input_internal.h
  22. +0
    -0
      src/ui/keys.inc
  23. +4
    -4
      src/ui/sdl-input.cpp
  24. +0
    -0
      src/ui/sdl-input.h

+ 3
- 4
doc/doxygen.cfg.in Ver arquivo

@@ -790,18 +790,17 @@ INPUT = .. \
../src/easymesh \
../src/gpu \
../src/image \
../src/input \
../src/lol \
../src/lol/math \
../src/lol/core \
../src/ath \
../src/math \
../src/mesh \
../src/platform \
../src/platform/android \
../src/platform/d3d9 \
../src/platform/sdl \
../src/platform/xbox \
../src/thread
../src/thread \
../src/ui

# This tag can be used to specify the character encoding of the source files
# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses


+ 7
- 11
src/Makefile.am Ver arquivo

@@ -69,11 +69,10 @@ liblol_core_headers = \

liblol_core_sources = \
application/application.cpp application/application.h \
application/egl-app.cpp application/egl-app.h \
\
lolua/baselua.cpp lolua/baselua.h \
\
eglapp.cpp eglapp.h \
\
commandstack.h \
easymesh/easymeshbuild.cpp easymesh/easymeshbuild.h \
easymesh/easymeshrender.cpp easymesh/easymeshrender.h \
@@ -99,8 +98,9 @@ liblol_core_sources = \
\
audio/audio.cpp audio/sample.cpp \
\
input/input.cpp input/input.h input/input_internal.h input/keys.inc \
input/controller.cpp input/controller.h \
ui/input.cpp ui/input.h ui/input_internal.h ui/keys.inc \
ui/controller.cpp ui/controller.h \
ui/gui.cpp ui/gui.h \
\
gpu/default-material.lolfx \
gpu/empty-material.lolfx \
@@ -142,19 +142,15 @@ liblol_core_sources = \
if LOL_USE_SDL
sdl_sources = \
application/sdl-app.cpp application/sdl-app.h \
input/sdl-input.cpp input/sdl-input.h
ui/sdl-input.cpp ui/sdl-input.h
endif

d3d9_sources = \
platform/d3d9/d3d9input.cpp platform/d3d9/d3d9input.h
ui/d3d9-input.cpp ui/d3d9-input.h

include 3rdparty/lol-imgui.am

imgui_sources += \
lolimgui.cpp lolimgui.h \
$(NULL)

android_sources = \
image/codec/android-image.cpp \
platform/android/androidapp.cpp platform/android/androidapp.h
application/android-app.cpp application/android-app.h


src/platform/android/androidapp.cpp → src/application/android-app.cpp Ver arquivo

@@ -27,9 +27,8 @@ extern "C" {
#include <android_native_app_glue.c>
}

#include "androidapp.h"

#include "input/input_internal.h"
#include "application/android-app.h"
#include "ui/input_internal.h"

using namespace lol;

@@ -107,7 +106,7 @@ private:
*/
int lol::AndroidAppData::CreateDisplay()
{
/* FIXME: there is a lot of code common to eglapp.cpp here. */
/* FIXME: there is a lot of code common to egl-app.cpp here. */
const EGLint attribs[] =
{
EGL_SURFACE_TYPE, EGL_WINDOW_BIT,

src/platform/android/androidapp.h → src/application/android-app.h Ver arquivo


+ 2
- 2
src/application/application.cpp Ver arquivo

@@ -19,11 +19,11 @@
#include "lolgl.h"

#if __ANDROID__
# include "platform/android/androidapp.h"
# include "application/android-app.h"
#elif LOL_USE_SDL
# include "application/sdl-app.h"
#elif HAVE_GLES_2X
# include "eglapp.h"
# include "application/egl-app.h"
#endif

namespace lol


src/eglapp.cpp → src/application/egl-app.cpp Ver arquivo

@@ -27,11 +27,11 @@
#endif

#if LOL_USE_SDL
# include "input/sdl-input.h"
# include "ui/sdl-input.h"
#endif

#include "lolgl.h"
#include "eglapp.h"
#include "application/egl-app.h"

namespace lol
{

src/eglapp.h → src/application/egl-app.h Ver arquivo


+ 2
- 2
src/application/sdl-app.cpp Ver arquivo

@@ -22,9 +22,9 @@

#include "lolgl.h"
#include "application/sdl-app.h"
#include "input/sdl-input.h"
#include "ui/sdl-input.h"
#if LOL_USE_XINPUT
# include "platform/d3d9/d3d9input.h"
# include "ui/d3d9-input.h"
#endif

namespace lol


+ 18
- 18
src/lol-core.vcxproj Ver arquivo

@@ -81,6 +81,7 @@
<ClCompile Include="3rdparty\imgui\imgui_draw.cpp" />
<ClCompile Include="3rdparty\imgui\imgui_widgets.cpp" />
<ClCompile Include="application\application.cpp" />
<ClCompile Include="application\egl-app.cpp" />
<ClCompile Include="application\sdl-app.cpp">
<ExcludedFromBuild Condition="'$(enable_sdl)'=='no'">true</ExcludedFromBuild>
</ClCompile>
@@ -104,7 +105,6 @@
<ClCompile Include="easymesh\easymeshprimitive.cpp" />
<ClCompile Include="easymesh\easymeshrender.cpp" />
<ClCompile Include="easymesh\easymeshtransform.cpp" />
<ClCompile Include="eglapp.cpp" />
<ClCompile Include="engine\entity.cpp" />
<ClCompile Include="engine\ticker.cpp" />
<ClCompile Include="engine\world.cpp" />
@@ -149,13 +149,7 @@
<ClCompile Include="image\pixel.cpp" />
<ClCompile Include="image\resample.cpp" />
<ClCompile Include="image\resource.cpp" />
<ClCompile Include="input\controller.cpp" />
<ClCompile Include="input\input.cpp" />
<ClCompile Include="input\sdl-input.cpp">
<ExcludedFromBuild Condition="'$(enable_sdl)'=='no'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="light.cpp" />
<ClCompile Include="lolimgui.cpp" />
<ClCompile Include="lolua\baselua.cpp" />
<ClCompile Include="math\geometry.cpp" />
<ClCompile Include="math\half.cpp" />
@@ -167,7 +161,6 @@
<ClCompile Include="mesh\primitivemesh.cpp" />
<ClCompile Include="messageservice.cpp" />
<ClCompile Include="platform.cpp" />
<ClCompile Include="platform\d3d9\d3d9input.cpp" />
<ClCompile Include="profiler.cpp" />
<ClCompile Include="scene.cpp" />
<ClCompile Include="sprite.cpp" />
@@ -178,10 +171,18 @@
<ClCompile Include="text.cpp" />
<ClCompile Include="textureimage.cpp" />
<ClCompile Include="tileset.cpp" />
<ClCompile Include="ui\controller.cpp" />
<ClCompile Include="ui\d3d9-input.cpp" />
<ClCompile Include="ui\gui.cpp" />
<ClCompile Include="ui\input.cpp" />
<ClCompile Include="ui\sdl-input.cpp">
<ExcludedFromBuild Condition="'$(enable_sdl)'=='no'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="video.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="application\application.h" />
<ClInclude Include="application\egl-app.h" />
<ClInclude Include="application\sdl-app.h">
<ExcludedFromBuild Condition="'$(enable_sdl)'=='no'">true</ExcludedFromBuild>
</ClInclude>
@@ -195,7 +196,6 @@
<ClInclude Include="easymesh\easymeshbuild.h" />
<ClInclude Include="easymesh\easymeshlua.h" />
<ClInclude Include="easymesh\easymeshrender.h" />
<ClInclude Include="eglapp.h" />
<ClInclude Include="emitter.h" />
<ClInclude Include="engine\entity.h" />
<ClInclude Include="engine\ticker.h" />
@@ -205,17 +205,9 @@
<ClInclude Include="gradient.h" />
<ClInclude Include="image\image-private.h" />
<ClInclude Include="image\resource-private.h" />
<ClInclude Include="input\controller.h" />
<ClInclude Include="input\input.h" />
<ClInclude Include="input\input_internal.h" />
<ClInclude Include="input\keys.inc" />
<ClInclude Include="input\sdl-input.h">
<ExcludedFromBuild Condition="'$(enable_sdl)'=='no'">true</ExcludedFromBuild>
</ClInclude>
<ClInclude Include="light.h" />
<ClInclude Include="loldebug.h" />
<ClInclude Include="lolgl.h" />
<ClInclude Include="lolimgui.h" />
<ClInclude Include="lolua\baselua.h" />
<ClInclude Include="lol\algorithm\aabb_tree.h" />
<ClInclude Include="lol\algorithm\all.h" />
@@ -285,7 +277,6 @@
<ClInclude Include="messageservice.h" />
<ClInclude Include="numeric.h" />
<ClInclude Include="platform.h" />
<ClInclude Include="platform\d3d9\d3d9input.h" />
<ClInclude Include="profiler.h" />
<ClInclude Include="scene.h" />
<ClInclude Include="sprite.h" />
@@ -293,6 +284,15 @@
<ClInclude Include="textureimage-private.h" />
<ClInclude Include="textureimage.h" />
<ClInclude Include="tileset.h" />
<ClInclude Include="ui\controller.h" />
<ClInclude Include="ui\d3d9-input.h" />
<ClInclude Include="ui\gui.h" />
<ClInclude Include="ui\input.h" />
<ClInclude Include="ui\input_internal.h" />
<ClInclude Include="ui\keys.inc" />
<ClInclude Include="ui\sdl-input.h">
<ExcludedFromBuild Condition="'$(enable_sdl)'=='no'">true</ExcludedFromBuild>
</ClInclude>
<ClInclude Include="utils.h" />
<ClInclude Include="video.h" />
</ItemGroup>


+ 31
- 30
src/lol-core.vcxproj.filter Ver arquivo

@@ -22,7 +22,7 @@
<Filter Include="image\codec">
<UniqueIdentifier>{123803f1-1722-4421-8245-098667654cda}</UniqueIdentifier>
</Filter>
<Filter Include="input">
<Filter Include="ui">
<UniqueIdentifier>{94992c0e-ebc5-4185-b766-323b06547dcf}</UniqueIdentifier>
</Filter>
<Filter Include="lol">
@@ -76,9 +76,6 @@
<Filter Include="platform\xbox">
<UniqueIdentifier>{317cb5cc-5dcc-4e14-be90-40a125a2e2ec}</UniqueIdentifier>
</Filter>
<Filter Include="platform\d3d9">
<UniqueIdentifier>{a914e15d-3201-467a-a9c9-d7c5244b13ee}</UniqueIdentifier>
</Filter>
<Filter Include="image\dither">
<UniqueIdentifier>{63e63eea-c96e-4d37-81f6-f3f17e18b751}</UniqueIdentifier>
</Filter>
@@ -123,8 +120,8 @@
<ClCompile Include="application\sdl-app.cpp">
<Filter>application</Filter>
</ClCompile>
<ClCompile Include="input\sdl-input.cpp">
<Filter>input</Filter>
<ClCompile Include="ui\sdl-input.cpp">
<Filter>ui</Filter>
</ClCompile>
<ClCompile Include="math\half.cpp">
<Filter>math</Filter>
@@ -189,11 +186,11 @@
<ClCompile Include="gpu\indexbuffer.cpp">
<Filter>gpu</Filter>
</ClCompile>
<ClCompile Include="input\input.cpp">
<Filter>input</Filter>
<ClCompile Include="ui\input.cpp">
<Filter>ui</Filter>
</ClCompile>
<ClCompile Include="platform\d3d9\d3d9input.cpp">
<Filter>platform\d3d9</Filter>
<ClCompile Include="ui\d3d9-input.cpp">
<Filter>ui</Filter>
</ClCompile>
<ClCompile Include="audio\audio.cpp">
<Filter>audio</Filter>
@@ -204,8 +201,8 @@
<ClCompile Include="camera.cpp">
<Filter>...</Filter>
</ClCompile>
<ClCompile Include="eglapp.cpp">
<Filter>...</Filter>
<ClCompile Include="application\egl-app.cpp">
<Filter>application</Filter>
</ClCompile>
<ClCompile Include="emitter.cpp">
<Filter>...</Filter>
@@ -279,8 +276,8 @@
<ClCompile Include="debug\lines.cpp">
<Filter>debug</Filter>
</ClCompile>
<ClCompile Include="input\controller.cpp">
<Filter>input</Filter>
<ClCompile Include="ui\controller.cpp">
<Filter>ui</Filter>
</ClCompile>
<ClCompile Include="MessageService.cpp">
<Filter>...</Filter>
@@ -375,7 +372,9 @@
<ClCompile Include="textureimage.cpp">
<Filter>tileset</Filter>
</ClCompile>
<ClCompile Include="lolimgui.cpp" />
<ClCompile Include="ui\gui.cpp">
<Filter>ui</Filter>
</ClCompile>
<ClCompile Include="mesh\primitivemesh.cpp">
<Filter>mesh</Filter>
</ClCompile>
@@ -396,8 +395,8 @@
<ClInclude Include="debug\stats.h">
<Filter>debug</Filter>
</ClInclude>
<ClInclude Include="input\sdl-input.h">
<Filter>input</Filter>
<ClInclude Include="ui\sdl-input.h">
<Filter>ui</Filter>
</ClInclude>
<ClInclude Include="application\sdl-app.h">
<Filter>application</Filter>
@@ -486,17 +485,17 @@
<ClInclude Include="platform\xbox\xboxinput.h">
<Filter>platform\xbox</Filter>
</ClInclude>
<ClInclude Include="input\input.h">
<Filter>input</Filter>
<ClInclude Include="ui\input.h">
<Filter>ui</Filter>
</ClInclude>
<ClInclude Include="platform\d3d9\d3d9input.h">
<Filter>platform\d3d9</Filter>
<ClInclude Include="ui\d3d9-input.h">
<Filter>ui</Filter>
</ClInclude>
<ClInclude Include="camera.h">
<Filter>...</Filter>
</ClInclude>
<ClInclude Include="eglapp.h">
<Filter>...</Filter>
<ClInclude Include="application\egl-app.h">
<Filter>application</Filter>
</ClInclude>
<ClInclude Include="emitter.h">
<Filter>...</Filter>
@@ -666,14 +665,14 @@
<ClInclude Include="lol\image\movie.h">
<Filter>lol\image</Filter>
</ClInclude>
<ClInclude Include="input\keys.inc">
<Filter>input</Filter>
<ClInclude Include="ui\keys.inc">
<Filter>ui</Filter>
</ClInclude>
<ClInclude Include="input\controller.h">
<Filter>input</Filter>
<ClInclude Include="ui\controller.h">
<Filter>ui</Filter>
</ClInclude>
<ClInclude Include="input\input_internal.h">
<Filter>input</Filter>
<ClInclude Include="ui\input_internal.h">
<Filter>ui</Filter>
</ClInclude>
<ClInclude Include="utils.h">
<Filter>...</Filter>
@@ -721,7 +720,9 @@
<ClInclude Include="textureimage-private.h">
<Filter>tileset</Filter>
</ClInclude>
<ClInclude Include="lolimgui.h" />
<ClInclude Include="ui\gui.h">
<Filter>ui</Filter>
</ClInclude>
<ClInclude Include="mesh\primitivemesh.h">
<Filter>mesh</Filter>
</ClInclude>


+ 5
- 5
src/lol/extras.h Ver arquivo

@@ -27,10 +27,6 @@
#include <lol/../profiler.h>
#include <lol/../messageservice.h>

// Input
#include <lol/../input/input.h>
#include <lol/../input/controller.h>

// Engine
#include <lol/../engine/ticker.h>
#include <lol/../engine/world.h>
@@ -47,7 +43,11 @@
#include <lol/../text.h>
#include <lol/../textureimage.h>
#include <lol/../tileset.h>
#include <lol/../lolimgui.h>

// UI
#include <lol/../ui/input.h>
#include <lol/../ui/controller.h>
#include <lol/../ui/gui.h>

// Other objects
#include <lol/../mesh/mesh.h>


+ 0
- 187
src/platform/emscripten/lol_shell.html Ver arquivo

@@ -1,187 +0,0 @@
<!doctype html>
<html lang="en-us">
<head>
<meta charset="utf-8">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>YOUR PAGE NAME HERE</title>

<style>
.emscripten
{
padding-right: 0;
margin-left: auto;
margin-right: auto;
display: block;
}
textarea.emscripten
{
font-family: monospace;
width: 80%;
}
div.emscripten
{
text-align: center;
}
div.emscripten_border
{
border: 1px solid black;
position: absolute;
left: 0px;
top: 0px;
}
/* the canvas *must not* have any border or padding, or mouse coords will be wrong */
canvas.emscripten
{
border: 0px none;
}
</style>
</head>

<body>
<div class="emscripten_border" id="id_div_embed_data">
<canvas class="emscripten" id="id_cvas_render" oncontextmenu="event.preventDefault()"></canvas>
</div>

<!-- this part is a little weird, I don't really know what to do with it. -->
<div class="emscripten">
<input type="checkbox" id="id_ckbox_resize">Resize canvas
<input type="checkbox" id="id_ckbox_pointer_lock" checked>Lock/hide mouse pointer
&nbsp;&nbsp;&nbsp;
<input type="button" value="Fullscreen" onclick="ClickFullscreen()">
</div>
<textarea class="emscripten" id="id_txt_output" rows="8"> </textarea>

<script type='text/javascript'>
// connect to canvas
var Module =
{
output: document.getElementById('id_txt_output'),
canvas: document.getElementById('id_cvas_render'),
preRun: [],
postRun: [],
clickFullsreen: function()
{
Module.requestFullScreen(document.getElementById('id_ckbox_pointer_lock').checked,
document.getElementById('id_ckbox_resize').checked);
},
print: (function()
{
if (this.output)
{
this.output.value = ''; // clear browser cache
return function(text)
{
this.text = Array.prototype.slice.call(arguments).join(' ');
// These replacements are necessary if you render to raw HTML
/*
text = text.replace(/&/g, "&amp;");
text = text.replace(/</g, "&lt;");
text = text.replace(/ >/g, "&gt;");
text = text.replace('\n', '<br>', 'g');
*/
this.output.value += text + "\n";
this.output.scrollTop = 99999; // focus on bottom
};
}
else
return '';
})(),
printErr: function(text)
{
text = Array.prototype.slice.call(arguments).join(' ');
if (0) // XXX disabled for safety typeof dump == 'function')
dump(text + '\n'); // fast, straight to the real console
else
console.log(text);
},
//Load Status handling
setStatus: function(text, new_value, new_max)
{
var tmp_status = '';
var tmp_value = undefined;
var tmp_max = undefined;
var should_hide = false;

//Clear any interval put on this Status.
if (Module.setStatus.interval)
clearInterval(Module.setStatus.interval);
//If value and max have been set, directly go for the win.
if (new_value != undefined && new_max != undefined)
{
tmp_status = text;
tmp_value = new_value;
tmp_max = new_max;
}
else
//Else do the complicated stuff.
{
var m = text.match(/([^(]+)\((\d+(\.\d+)?)\/(\d+)\)/);
if (m)
{
text = m[1];
tmp_value = parseInt(m[2]) * 100;
tmp_max = parseInt(m[4]) * 100;
}
else
should_hide = true;
}
if (parent)
{
//parent.UpdateProgressBarValue(tmp_status, tmp_value, tmp_max);
//parent.HideProgressStatus(should_hide);
}
},
totalDependencies: 0,
monitorRunDependencies:
function(left)
{
this.totalDependencies = Math.max(this.totalDependencies, left);
if (left)
Module.setStatus('Downloading dependencies ', (this.totalDependencies - left), this.totalDependencies);
else
Module.setStatus('All downloads complete.', 1, 1);
},
//IMPORTANT : This is the C -> Javascript wraping, add your functions list here.
wrapup_list: [ {src_obj: null, func_name: 'DoSendMessage', c_func_name: 'C_Send', return_var: 'number', args: ['string'] } ],
do_wrapup: function()
{
for (var i = 0; i < this.wrapup_list.length; i++)
{
if (!this.wrapup_list[i].src_obj)
this.wrapup_list[i].src_obj = this;
this.wrapup_list[i].src_obj[this.wrapup_list[i].func_name] =
cwrap(this.wrapup_list[i].c_func_name,
this.wrapup_list[i].return_var,
this.wrapup_list[i].args);
}
},
//Module <-> Page communication setup
SendMessage:function(message)
{
this.DoSendMessage(message);
},
ModuleSendMessage:function(message)
{
alert(message);
}
};
</script>

<!-- Copy this HTML in your site folder and put your built program script in the src. -->
<!-- <script src="./my_program_script.js"></script> -->
<!-- -->

<script type='text/javascript'>
//This call NEEDS TO BE after the .js include, because "cwrap" is set in it.
Module.do_wrapup();

//Parent communication datas
function GetDivEmbed() { return document.getElementById('id_div_embed_data'); }
function GetEmbedModule() { return Module; }

parent.InitModuleVar();
Module.setStatus('Please wait, calculating load balance ...', 0, 1);
</script>

</body>
</html>

src/input/controller.cpp → src/ui/controller.cpp Ver arquivo

@@ -59,11 +59,6 @@ bool KeyBinding::Unbind(const std::string& device_name, const std::string& key_n
return false;
}

void KeyBinding::ClearBindings()
{
m_keybindings.clear();
}

///////////////////////////////////////////////////////////////////////////////
// AxisBinding

@@ -188,12 +183,6 @@ bool AxisBinding::UnbindKeys(const std::string& device_name, const std::string&

}

void AxisBinding::ClearBindings()
{
m_axisbindings.clear();
m_keybindings.clear();
}

float AxisBinding::RetrieveCurrentValue()
{
float max_positive = 0.0f;

src/input/controller.h → src/ui/controller.h Ver arquivo

@@ -53,10 +53,6 @@ public:
bool UnbindMouse(const std::string& key_name) { return Unbind(g_name_mouse, key_name); }
bool UnbindKeyboard(const std::string& key_name) { return Unbind(g_name_keyboard, key_name); }
bool UnbindJoystick(const uint64_t num, const std::string& key_name) { return Unbind(g_name_joystick(num), key_name); }
/** Clear current binding */
void ClearBindings();
/** Indicate wheither a physical device and key has been bound. Returns the number of bindings set. */
int IsBound() const { return m_keybindings.count(); }

protected:
/** Update the binding value. Called internally by the controller, once per frame */
@@ -110,29 +106,17 @@ public:
/** Unbind a previously bound physical device and axis. Returns true if the binding was existing. */
bool UnbindKeys(const std::string& device_name, const std::string& min_key_name, const std::string& max_key_name);
/* Small helpers */
void BindMouse(const std::string& axis_name) { Bind(g_name_mouse, axis_name); }
void BindMouseKey(const std::string& key_name) { BindKey(g_name_mouse, key_name); }
void BindMouseKeys(const std::string& min_key_name, const std::string& max_key_name) { BindKeys(g_name_mouse, min_key_name, max_key_name); }
bool UnbindMouse(const std::string& axis_name) { return Unbind(g_name_mouse, axis_name); }
bool UnbindMouseKey(const std::string& key_name) { return UnbindKey(g_name_mouse, key_name); }
bool UnbindMouseKeys(const std::string& min_key_name, const std::string& max_key_name){ return UnbindKeys(g_name_mouse, min_key_name, max_key_name); }
void BindMouse(const std::string& axis_name) { Bind(g_name_mouse, axis_name); }
bool UnbindMouse(const std::string& axis_name) { return Unbind(g_name_mouse, axis_name); }
/* */
void BindJoystick(const uint64_t num, const std::string& axis_name) { Bind(g_name_joystick(num), axis_name); }
void BindJoystickKey(const uint64_t num, const std::string& key_name) { BindKey(g_name_joystick(num), key_name); }
void BindJoystickKeys(const uint64_t num, const std::string& min_key_name, const std::string& max_key_name) { BindKeys(g_name_joystick(num), min_key_name, max_key_name); }
bool UnbindJoystick(const uint64_t num, const std::string& axis_name) { return Unbind(g_name_joystick(num), axis_name); }
bool UnbindJoystickKey(const uint64_t num, const std::string& key_name) { return UnbindKey(g_name_joystick(num), key_name); }
bool UnbindJoystickKeys(const uint64_t num, const std::string& min_key_name, const std::string& max_key_name){ return UnbindKeys(g_name_joystick(num), min_key_name, max_key_name); }
/** Clear current binding */
void ClearBindings();
/** Indicate wheither a physical device and axis has been bound. Returns the number of bindings set. */
int IsBound() const { return m_axisbindings.count() + m_keybindings.count(); }
void BindJoystick(const uint64_t num, const std::string& axis_name) { Bind(g_name_joystick(num), axis_name); }
bool UnbindJoystick(const uint64_t num, const std::string& axis_name) { return Unbind(g_name_joystick(num), axis_name); }

protected:
void Update()
{
m_previous = m_current;
m_current = IsBound() ? RetrieveCurrentValue() : 0.0f;
m_current = RetrieveCurrentValue();
}
float RetrieveCurrentValue();

@@ -321,7 +305,7 @@ public:
void register_default_keys()
{
#define _SC(id, str, name) *this << InputProfile::Keyboard(id, #name);
#include "input/keys.inc"
#include "ui/keys.inc"
}

private:

src/platform/d3d9/d3d9input.cpp → src/ui/d3d9-input.cpp Ver arquivo

@@ -20,13 +20,33 @@

#include <lol/engine-internal.h>

#include "d3d9input.h"

#include "input/input_internal.h"
#include "ui/d3d9-input.h"
#include "ui/input_internal.h"

namespace lol
{

static const std::string g_name_xbox_key_dpad_up("DPadUp");
static const std::string g_name_xbox_key_dpad_down("DPadDown");
static const std::string g_name_xbox_key_dpad_left("DPadLeft");
static const std::string g_name_xbox_key_dpad_right("DPadRight");
static const std::string g_name_xbox_key_left_thumb("LeftThumb");
static const std::string g_name_xbox_key_right_thumb("RightThumb");
static const std::string g_name_xbox_key_left_shoulder("LeftShoulder");
static const std::string g_name_xbox_key_right_shoulder("Rightshoulder");
static const std::string g_name_xbox_key_a("A");
static const std::string g_name_xbox_key_b("B");
static const std::string g_name_xbox_key_x("X");
static const std::string g_name_xbox_key_y("Y");
static const std::string g_name_xbox_key_start("Start");
static const std::string g_name_xbox_key_back("Back");
static const std::string g_name_xbox_axis_left_x("Axis1");
static const std::string g_name_xbox_axis_left_y("Axis2");
static const std::string g_name_xbox_axis_right_x("Axis3");
static const std::string g_name_xbox_axis_right_y("Axis4");
static const std::string g_name_xbox_axis_left_trigger("Axis5");
static const std::string g_name_xbox_axis_right_trigger("Axis6");

/*
* D3d9 Input implementation class
*/

src/platform/d3d9/d3d9input.h → src/ui/d3d9-input.h Ver arquivo


src/lolimgui.cpp → src/ui/gui.cpp Ver arquivo


src/lolimgui.h → src/ui/gui.h Ver arquivo


src/input/input.cpp → src/ui/input.cpp Ver arquivo

@@ -16,7 +16,7 @@
#include <string>
#include <map>

#include "input/input_internal.h"
#include "ui/input_internal.h"

namespace lol
{
@@ -25,19 +25,19 @@ namespace lol
static std::vector<input::key> g_all_keys
{
#define _SC(code, str, name) input::key::SC_##name,
#include "input/keys.inc"
#include "ui/keys.inc"
};

static std::map<input::key, std::string> g_key_to_name
{
#define _SC(code, str, name) { input::key::SC_##name, #name },
#include "input/keys.inc"
#include "ui/keys.inc"
};

static std::map<std::string, input::key> g_name_to_key
{
#define _SC(code, str, name) { #name, input::key::SC_##name },
#include "input/keys.inc"
#include "ui/keys.inc"
};

std::vector<input::key> const &input::all_keys()
@@ -136,7 +136,7 @@ InputDeviceInternal* InputDeviceInternal::CreateStandardKeyboard()

/* Register all scancodes known to SDL (from the USB standard) */
# define _SC(id, str, name) keyboard->AddKey(id, #name);
# include "input/keys.inc"
# include "ui/keys.inc"

return keyboard;
}

src/input/input.h → src/ui/input.h Ver arquivo

@@ -25,7 +25,7 @@ public:
enum class key : uint16_t
{
#define _SC(id, str, name) SC_##name = id,
#include "input/keys.inc"
#include "ui/keys.inc"
};

static std::vector<key> const &all_keys();
@@ -33,7 +33,6 @@ public:
static key name_to_key(std::string const &name);
};

const std::string g_name_max("MAX");
const std::string g_name_mouse("Mouse");
const std::string g_name_keyboard("Keyboard");

@@ -55,28 +54,6 @@ const std::string g_name_mouse_axis_ypixel("YPixel");
const std::string g_name_mouse_axis_scroll("Scroll");
const std::string g_name_mouse_cursor("Cursor");

// Xbox default buttons/axis
const std::string g_name_xbox_key_dpad_up("DPadUp");
const std::string g_name_xbox_key_dpad_down("DPadDown");
const std::string g_name_xbox_key_dpad_left("DPadLeft");
const std::string g_name_xbox_key_dpad_right("DPadRight");
const std::string g_name_xbox_key_left_thumb("LeftThumb");
const std::string g_name_xbox_key_right_thumb("RightThumb");
const std::string g_name_xbox_key_left_shoulder("LeftShoulder");
const std::string g_name_xbox_key_right_shoulder("Rightshoulder");
const std::string g_name_xbox_key_a("A");
const std::string g_name_xbox_key_b("B");
const std::string g_name_xbox_key_x("X");
const std::string g_name_xbox_key_y("Y");
const std::string g_name_xbox_key_start("Start");
const std::string g_name_xbox_key_back("Back");
const std::string g_name_xbox_axis_left_x("Axis1");
const std::string g_name_xbox_axis_left_y("Axis2");
const std::string g_name_xbox_axis_right_x("Axis3");
const std::string g_name_xbox_axis_right_y("Axis4");
const std::string g_name_xbox_axis_left_trigger("Axis5");
const std::string g_name_xbox_axis_right_trigger("Axis6");

class InputDevice
{
public:

src/input/input_internal.h → src/ui/input_internal.h Ver arquivo


src/input/keys.inc → src/ui/keys.inc Ver arquivo


src/input/sdl-input.cpp → src/ui/sdl-input.cpp Ver arquivo

@@ -23,8 +23,8 @@
# include <emscripten/html5.h>
#endif

#include "input/input_internal.h"
#include "input/sdl-input.h"
#include "ui/input_internal.h"
#include "ui/sdl-input.h"

/* We force joystick polling because no events are received when
* there is no SDL display (eg. on the Raspberry Pi). */
@@ -47,7 +47,7 @@ static String ScanCodeToText(int sc)
{
#define _SC(id, str, name) \
case id: return String(str);
#include "input/keys.inc"
#include "ui/keys.inc"
default:
msg::error("ScanCodeToText unknown scancode %0d\n", sc);
}
@@ -62,7 +62,7 @@ static String ScanCodeToName(int sc)
{
#define _SC(id, str, name) \
case id: return String(#name);
#include "input/keys.inc"
#include "ui/keys.inc"
default:
msg::error("ScanCodeToText unknown scancode %0d\n", sc);
}

src/input/sdl-input.h → src/ui/sdl-input.h Ver arquivo


Carregando…
Cancelar
Salvar