Commit 6e417229 authored by Gargaj's avatar Gargaj
Browse files

Merge branch 'master' of github.com:Gargaj/Bonzomatic

parents e7a7ed2e 0ae2e1f3
......@@ -224,6 +224,7 @@
<ClCompile Include="main.cpp" />
<ClCompile Include="Platform.cpp" />
<ClCompile Include="platform_w32_common\MIDI.cpp" />
<ClCompile Include="platform_w32_common\Misc.cpp" />
<ClCompile Include="platform_w32_dx11\Renderer.cpp" />
<ClCompile Include="platform_w32_common\Clipboard.cpp" />
<ClCompile Include="platform_w32_common\FFT.cpp" />
......
......@@ -433,6 +433,7 @@
<ClCompile Include="Platform.cpp" />
<ClCompile Include="platform_w32_common\Platform_DynamicLoad.cpp" />
<ClCompile Include="platform_w32_common\MIDI.cpp" />
<ClCompile Include="platform_w32_common\Misc.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="external\scintilla\src\AutoComplete.h">
......
......@@ -224,6 +224,7 @@
<ClCompile Include="main.cpp" />
<ClCompile Include="Platform.cpp" />
<ClCompile Include="platform_w32_common\MIDI.cpp" />
<ClCompile Include="platform_w32_common\Misc.cpp" />
<ClCompile Include="platform_w32_dx9\Renderer.cpp" />
<ClCompile Include="platform_w32_common\Clipboard.cpp" />
<ClCompile Include="platform_w32_common\FFT.cpp" />
......
......@@ -433,6 +433,7 @@
<ClCompile Include="Platform.cpp" />
<ClCompile Include="platform_w32_common\Platform_DynamicLoad.cpp" />
<ClCompile Include="platform_w32_common\MIDI.cpp" />
<ClCompile Include="platform_w32_common\Misc.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="external\scintilla\src\AutoComplete.h">
......
......@@ -228,6 +228,7 @@
<ClCompile Include="platform_w32_common\Clipboard.cpp" />
<ClCompile Include="platform_w32_common\FFT.cpp" />
<ClCompile Include="platform_w32_common\MIDI.cpp" />
<ClCompile Include="platform_w32_common\Misc.cpp" />
<ClCompile Include="platform_w32_common\Platform_DynamicLoad.cpp" />
<ClCompile Include="platform_w32_common\SetupDialog.cpp" />
<ClCompile Include="platform_w32_common\Timer.cpp" />
......
......@@ -439,6 +439,7 @@
<ClCompile Include="Platform.cpp" />
<ClCompile Include="platform_w32_common\Platform_DynamicLoad.cpp" />
<ClCompile Include="platform_w32_common\MIDI.cpp" />
<ClCompile Include="platform_w32_common\Misc.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="external\scintilla\src\AutoComplete.h">
......
......@@ -149,6 +149,8 @@ SOURCES_CPP := \
Platform.cpp \
ShaderEditor.cpp \
platform_sdl/Renderer.cpp \
platform_x11/MIDI.cpp \
platform_x11/Misc.cpp \
platform_x11/Clipboard.cpp \
platform_x11/FFT.cpp \
platform_x11/SetupDialog.cpp \
......@@ -167,7 +169,7 @@ INCLUDEPATHS := \
CXX ?= cpp
OBJDIR ?= .obj
CXXFLAGS := -std=c++11 -Os -Wall -DSCI_LEXER -DSCI_NAMESPACE -DGTK `pkg-config --cflags sdl`
CXXFLAGS := -std=c++11 -g -Os -Wall -DSCI_LEXER -DSCI_NAMESPACE -DGTK `pkg-config --cflags sdl`
CXXFLAGS += $(foreach p,$(INCLUDEPATHS),$(addprefix -I,$p))
#CXXFLAGS += -Werror
LDFLAGS := -lGL `pkg-config --libs sdl`
......
#include <string>
namespace Misc
{
void InitKeymaps();
void GetKeymapName( char * sz);
}
\ No newline at end of file
......@@ -381,6 +381,8 @@ void SurfaceImpl::DrawTextBase(PRectangle rc, Font &font, float ybase, const cha
c = 0;
UTF16FromUTF8( str, charLength, (wchar_t*)&c, sizeof(unsigned int) );
}
if (c >= CHARACTER_COUNT)
c = '?';
stbtt_aligned_quad quad;
stbtt_GetBakedQuad( realFont->cdata, realFont->texture->width, realFont->texture->height, c, &x, &y, &quad, 1 );
......@@ -428,6 +430,8 @@ void SurfaceImpl::MeasureWidths(Font & font, const char *str, int len, float *po
c = 0;
UTF16FromUTF8( str, charLength, (wchar_t*)&c, sizeof(unsigned int) );
}
if (c >= CHARACTER_COUNT)
c = '?';
int advance = 0, leftBearing = 0;
......@@ -456,6 +460,9 @@ float SurfaceImpl::WidthText(Font & font, const char *str, int len)
c = 0;
UTF16FromUTF8( str, charLength, (wchar_t*)&c, sizeof(unsigned int) );
}
if (c >= CHARACTER_COUNT)
c = '?';
int advance = 0, leftBearing = 0;
stbtt_GetCodepointHMetrics(&realFont->fontinfo, c, &advance, &leftBearing);
position += advance*realFont->scale;//TODO: +Kerning
......
......@@ -45,9 +45,6 @@ Create a ```config.json``` with e.g. the following contents: (all fields are opt
## Building
Please use Visual C++ 2010 - nothing else is needed right now.
## Future features / todo / etc.
- Option for tab sizes / spaces
## Credits and acknowledgements
### Original / parent project authors
- "ScintillaGL" project by Mykhailo Parfeniuk (https://github.com/sopyer/ScintillaGL)
......
......@@ -7,6 +7,7 @@
#include "FFT.h"
#include "MIDI.h"
#include "Timer.h"
#include "Misc.h"
#include "external/scintilla/src/UniConversion.h"
#include "external/jsonxx/jsonxx.h"
......@@ -205,6 +206,8 @@ int main()
}
}
Misc::InitKeymaps();
#ifdef SCI_LEXER
Scintilla_LinkLexers();
#endif
......@@ -384,8 +387,11 @@ int main()
}
}
char szHelp[] = "F2 - toggle texture preview F5 - recompile shader F11 - hide GUI";
surface->DrawTextNoClip( Scintilla::PRectangle(20,Renderer::nHeight - 20,100,Renderer::nHeight), *mShaderEditor.GetTextFont(), Renderer::nHeight - 5.0, szHelp, strlen(szHelp), 0x80FFFFFF, 0x00000000);
char szLayout[255];
Misc::GetKeymapName(szLayout);
std::string sHelp = "F2 - toggle texture preview F5 - recompile shader F11 - hide GUI Current keymap: ";
sHelp += szLayout;
surface->DrawTextNoClip( Scintilla::PRectangle(20,Renderer::nHeight - 20,100,Renderer::nHeight), *mShaderEditor.GetTextFont(), Renderer::nHeight - 5.0, sHelp.c_str(), sHelp.length(), 0x80FFFFFF, 0x00000000);
}
......
......@@ -187,8 +187,10 @@ namespace Renderer
SDL_EnableUNICODE(true);
SDL_EnableKeyRepeat(250, 20);
#ifdef _WIN32
if (settings->bVsync)
wglSwapIntervalEXT(1);
#endif
run = true;
......
#include <string>
#include <Windows.h>
#include <tchar.h>
#include <map>
namespace Misc
{
std::map<std::string,std::string> keymaps;
void InitKeymaps()
{
HKEY hk = NULL;
RegOpenKeyExA( HKEY_LOCAL_MACHINE, "SYSTEM\\CurrentControlSet\\Control\\Keyboard Layouts", NULL, KEY_READ, &hk );
LONG result = NULL;
int idx = 0;
while ( result != ERROR_NO_MORE_ITEMS )
{
char szKeyName[255];
ZeroMemory(szKeyName,255);
DWORD nKeyName = 255;
result = RegEnumKeyExA( hk, idx, szKeyName, &nKeyName, NULL, NULL, NULL, NULL);
if (result == ERROR_SUCCESS)
{
HKEY hkSub = NULL;
RegOpenKeyExA( hk, szKeyName, NULL, KEY_READ, &hkSub );
BYTE szValue[255];
ZeroMemory(szValue,255);
DWORD nValue = 255;
DWORD type = REG_SZ;
LONG resultKey = RegQueryValueExA( hkSub, "Layout Text", NULL, &type, szValue, &nValue );
CharLowerA( szKeyName );
keymaps.insert( std::make_pair( szKeyName, (char*)szValue ) );
}
idx++;
}
}
void GetKeymapName( char * sz )
{
char szCode[KL_NAMELENGTH];
::GetKeyboardLayoutNameA(szCode);
CharLowerA( szCode );
strncpy( sz, keymaps.count(szCode) ? keymaps[szCode].c_str() : "<unknown>" ,255);
}
}
\ No newline at end of file
// Dummy midi implementation, just to make sure bonzomatic compiles.
#include "../MIDI.h"
bool MIDI::Open() {
return false;
}
bool MIDI::Close() {
return false;
}
float MIDI::GetCCValue( unsigned char cc) {
return 0.f;
}
// Dummy Keymap functions that don't actually map anything,
// just to fix the SDL build.
#include <string.h>
#include "../Misc.h"
void Misc::InitKeymaps() {
return;
}
void Misc::GetKeymapName(char* sz) {
strncpy(sz,"<native>",7);
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment