Skip to content

Commit

Permalink
add ability to change font size and background opacity (fixes #66)
Browse files Browse the repository at this point in the history
  • Loading branch information
Gargaj committed Jul 8, 2022
1 parent ffed482 commit 1514efe
Show file tree
Hide file tree
Showing 8 changed files with 140 additions and 53 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ Fresh builds of Bonzomatic will always be available at https://github.com/Gargaj
## Keys
- F2: toggle texture preview
- F5 or Ctrl-R: recompile shader
- Ctrl-[/]: adjust text background transparency
- F11 or Ctrl/Cmd-f: hide shader overlay
- Alt-F4 or Shift+Escape: exbobolate your planet

Expand Down
1 change: 1 addition & 0 deletions src/Renderer.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ enum MOUSEBUTTON
struct MouseEvent
{
MOUSEEVENTTYPE eventType;
bool ctrl;
float x;
float y;
MOUSEBUTTON button;
Expand Down
106 changes: 69 additions & 37 deletions src/ShaderEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,7 @@ void ShaderEditor::Initialise()

//WndProc( SCI_SETLEXERLANGUAGE, SCLEX_CPP, 0 );

SetAStyle( STYLE_DEFAULT, 0xFFFFFFFF, BACKGROUND( 0x000000 ), nFontSize, sFontFile.c_str() );
WndProc( SCI_STYLECLEARALL, 0, 0 );
SetAStyle( STYLE_LINENUMBER, 0xFFC0C0C0, BACKGROUND( 0x000000 ), nFontSize, sFontFile.c_str() );
SetAStyle( STYLE_BRACELIGHT, 0xFF00FF00, BACKGROUND( 0x000000 ), nFontSize, sFontFile.c_str() );
SetAStyle( STYLE_BRACEBAD, 0xFF0000FF, BACKGROUND( 0x000000 ), nFontSize, sFontFile.c_str() );
SetAStyle( STYLE_INDENTGUIDE, 0xFFC0C0C0, BACKGROUND( 0x000000 ), nFontSize, sFontFile.c_str() );
UpdateFont();

WndProc( SCI_SETFOLDMARGINCOLOUR, 1, BACKGROUND( 0x1A1A1A ) );
WndProc( SCI_SETFOLDMARGINHICOLOUR, 1, BACKGROUND( 0x1A1A1A ) );
Expand Down Expand Up @@ -137,37 +132,6 @@ void ShaderEditor::Initialise()
// Colorize the content of the #defines (thx @blackle for finding it)
lexState->PropSet( "styling.within.preprocessor", "1" );

SetAStyle( SCE_C_DEFAULT, theme.text, theme.bUseCharBackground ? theme.charBackground : BACKGROUND( 0x000000 ), nFontSize, sFontFile.c_str() );
SetAStyle( SCE_C_WORD, theme.keyword, theme.bUseCharBackground ? theme.charBackground : BACKGROUND( 0x000000 ) );
SetAStyle( SCE_C_WORD2, theme.type, theme.bUseCharBackground ? theme.charBackground : BACKGROUND( 0x000000 ) );
SetAStyle( SCE_C_GLOBALCLASS, theme.builtin, theme.bUseCharBackground ? theme.charBackground : BACKGROUND( 0x000000 ) );
SetAStyle( SCE_C_PREPROCESSOR, theme.preprocessor, theme.bUseCharBackground ? theme.charBackground : BACKGROUND( 0x000000 ) );
SetAStyle( SCE_C_NUMBER, theme.number, theme.bUseCharBackground ? theme.charBackground : BACKGROUND( 0x000000 ) );
SetAStyle( SCE_C_OPERATOR, theme.op, theme.bUseCharBackground ? theme.charBackground : BACKGROUND( 0x000000 ) );
SetAStyle( SCE_C_COMMENT, theme.comment, theme.bUseCharBackground ? theme.charBackground : BACKGROUND( 0x000000 ) );
SetAStyle( SCE_C_COMMENTLINE, theme.comment, theme.bUseCharBackground ? theme.charBackground : BACKGROUND( 0x000000 ) );

// Misc chars to cover for standard text
SetAStyle( SCE_C_COMMENTDOC, theme.text, theme.bUseCharBackground ? theme.charBackground : BACKGROUND( 0x000000 ) );
SetAStyle( SCE_C_STRING, theme.text, theme.bUseCharBackground ? theme.charBackground : BACKGROUND( 0x000000 ) );
SetAStyle( SCE_C_CHARACTER, theme.text, theme.bUseCharBackground ? theme.charBackground : BACKGROUND( 0x000000 ) );
SetAStyle( SCE_C_UUID, theme.text, theme.bUseCharBackground ? theme.charBackground : BACKGROUND( 0x000000 ) );
SetAStyle( SCE_C_IDENTIFIER, theme.text, theme.bUseCharBackground ? theme.charBackground : BACKGROUND( 0x000000 ) );
SetAStyle( SCE_C_STRINGEOL, theme.text, theme.bUseCharBackground ? theme.charBackground : BACKGROUND( 0x000000 ) );
SetAStyle( SCE_C_VERBATIM, theme.text, theme.bUseCharBackground ? theme.charBackground : BACKGROUND( 0x000000 ) );
SetAStyle( SCE_C_REGEX, theme.text, theme.bUseCharBackground ? theme.charBackground : BACKGROUND( 0x000000 ) );
SetAStyle( SCE_C_COMMENTLINEDOC, theme.text, theme.bUseCharBackground ? theme.charBackground : BACKGROUND( 0x000000 ) );
SetAStyle( SCE_C_COMMENTDOCKEYWORD, theme.text, theme.bUseCharBackground ? theme.charBackground : BACKGROUND( 0x000000 ) );
SetAStyle( SCE_C_COMMENTDOCKEYWORDERROR, theme.text, theme.bUseCharBackground ? theme.charBackground : BACKGROUND( 0x000000 ) );
SetAStyle( SCE_C_STRINGRAW, theme.text, theme.bUseCharBackground ? theme.charBackground : BACKGROUND( 0x000000 ) );
SetAStyle( SCE_C_TRIPLEVERBATIM, theme.text, theme.bUseCharBackground ? theme.charBackground : BACKGROUND( 0x000000 ) );
SetAStyle( SCE_C_HASHQUOTEDSTRING, theme.text, theme.bUseCharBackground ? theme.charBackground : BACKGROUND( 0x000000 ) );
SetAStyle( SCE_C_PREPROCESSORCOMMENT, theme.text, theme.bUseCharBackground ? theme.charBackground : BACKGROUND( 0x000000 ) );
SetAStyle( SCE_C_PREPROCESSORCOMMENTDOC, theme.text, theme.bUseCharBackground ? theme.charBackground : BACKGROUND( 0x000000 ) );
SetAStyle( SCE_C_USERLITERAL, theme.text, theme.bUseCharBackground ? theme.charBackground : BACKGROUND( 0x000000 ) );
SetAStyle( SCE_C_TASKMARKER, theme.text, theme.bUseCharBackground ? theme.charBackground : BACKGROUND( 0x000000 ) );
SetAStyle( SCE_C_ESCAPESEQUENCE, theme.text, theme.bUseCharBackground ? theme.charBackground : BACKGROUND( 0x000000 ) );

lexState->Colourise( 0, -1 );

//WndProc( SCI_COLOURISE, 0, 0 );
Expand Down Expand Up @@ -399,6 +363,30 @@ Font * ShaderEditor::GetTextFont()
return &vs.styles[ STYLE_DEFAULT ].font;
}

void ShaderEditor::SetFontSize( int newSize )
{
nFontSize = newSize;
if ( nFontSize < 1 )
{
nFontSize = 1;
}
UpdateFont();
}

void ShaderEditor::SetOpacity( int newOpacity )
{
if ( newOpacity < 0 )
{
newOpacity = 0;
}
if ( newOpacity > 255 )
{
newOpacity = 255;
}
nOpacity = newOpacity;
UpdateFont();
}

void ShaderEditor::SetPosition( Scintilla::PRectangle rect )
{
wMain.SetPosition( rect );
Expand Down Expand Up @@ -690,3 +678,47 @@ void ShaderEditor::AutomaticIndentation( char ch )
SetLineIndentation( curLine, indentBlock );
}
}

void ShaderEditor::UpdateFont()
{
SetAStyle( STYLE_DEFAULT, 0xFFFFFFFF, BACKGROUND( 0x000000 ), nFontSize, sFontFile.c_str() );
WndProc( SCI_STYLECLEARALL, 0, 0 );

SetAStyle( STYLE_LINENUMBER, 0xFFC0C0C0, BACKGROUND( 0x000000 ), nFontSize, sFontFile.c_str() );
SetAStyle( STYLE_BRACELIGHT, 0xFF00FF00, BACKGROUND( 0x000000 ), nFontSize, sFontFile.c_str() );
SetAStyle( STYLE_BRACEBAD, 0xFF0000FF, BACKGROUND( 0x000000 ), nFontSize, sFontFile.c_str() );
SetAStyle( STYLE_INDENTGUIDE, 0xFFC0C0C0, BACKGROUND( 0x000000 ), nFontSize, sFontFile.c_str() );

SetAStyle( SCE_C_DEFAULT, theme.text, theme.bUseCharBackground ? theme.charBackground : BACKGROUND( 0x000000 ), nFontSize, sFontFile.c_str() );
SetAStyle( SCE_C_WORD, theme.keyword, theme.bUseCharBackground ? theme.charBackground : BACKGROUND( 0x000000 ) );
SetAStyle( SCE_C_WORD2, theme.type, theme.bUseCharBackground ? theme.charBackground : BACKGROUND( 0x000000 ) );
SetAStyle( SCE_C_GLOBALCLASS, theme.builtin, theme.bUseCharBackground ? theme.charBackground : BACKGROUND( 0x000000 ) );
SetAStyle( SCE_C_PREPROCESSOR, theme.preprocessor, theme.bUseCharBackground ? theme.charBackground : BACKGROUND( 0x000000 ) );
SetAStyle( SCE_C_NUMBER, theme.number, theme.bUseCharBackground ? theme.charBackground : BACKGROUND( 0x000000 ) );
SetAStyle( SCE_C_OPERATOR, theme.op, theme.bUseCharBackground ? theme.charBackground : BACKGROUND( 0x000000 ) );
SetAStyle( SCE_C_COMMENT, theme.comment, theme.bUseCharBackground ? theme.charBackground : BACKGROUND( 0x000000 ) );
SetAStyle( SCE_C_COMMENTLINE, theme.comment, theme.bUseCharBackground ? theme.charBackground : BACKGROUND( 0x000000 ) );

// Misc chars to cover for standard text
SetAStyle( SCE_C_COMMENTDOC, theme.text, theme.bUseCharBackground ? theme.charBackground : BACKGROUND( 0x000000 ) );
SetAStyle( SCE_C_STRING, theme.text, theme.bUseCharBackground ? theme.charBackground : BACKGROUND( 0x000000 ) );
SetAStyle( SCE_C_CHARACTER, theme.text, theme.bUseCharBackground ? theme.charBackground : BACKGROUND( 0x000000 ) );
SetAStyle( SCE_C_UUID, theme.text, theme.bUseCharBackground ? theme.charBackground : BACKGROUND( 0x000000 ) );
SetAStyle( SCE_C_IDENTIFIER, theme.text, theme.bUseCharBackground ? theme.charBackground : BACKGROUND( 0x000000 ) );
SetAStyle( SCE_C_STRINGEOL, theme.text, theme.bUseCharBackground ? theme.charBackground : BACKGROUND( 0x000000 ) );
SetAStyle( SCE_C_VERBATIM, theme.text, theme.bUseCharBackground ? theme.charBackground : BACKGROUND( 0x000000 ) );
SetAStyle( SCE_C_REGEX, theme.text, theme.bUseCharBackground ? theme.charBackground : BACKGROUND( 0x000000 ) );
SetAStyle( SCE_C_COMMENTLINEDOC, theme.text, theme.bUseCharBackground ? theme.charBackground : BACKGROUND( 0x000000 ) );
SetAStyle( SCE_C_COMMENTDOCKEYWORD, theme.text, theme.bUseCharBackground ? theme.charBackground : BACKGROUND( 0x000000 ) );
SetAStyle( SCE_C_COMMENTDOCKEYWORDERROR, theme.text, theme.bUseCharBackground ? theme.charBackground : BACKGROUND( 0x000000 ) );
SetAStyle( SCE_C_STRINGRAW, theme.text, theme.bUseCharBackground ? theme.charBackground : BACKGROUND( 0x000000 ) );
SetAStyle( SCE_C_TRIPLEVERBATIM, theme.text, theme.bUseCharBackground ? theme.charBackground : BACKGROUND( 0x000000 ) );
SetAStyle( SCE_C_HASHQUOTEDSTRING, theme.text, theme.bUseCharBackground ? theme.charBackground : BACKGROUND( 0x000000 ) );
SetAStyle( SCE_C_PREPROCESSORCOMMENT, theme.text, theme.bUseCharBackground ? theme.charBackground : BACKGROUND( 0x000000 ) );
SetAStyle( SCE_C_PREPROCESSORCOMMENTDOC, theme.text, theme.bUseCharBackground ? theme.charBackground : BACKGROUND( 0x000000 ) );
SetAStyle( SCE_C_USERLITERAL, theme.text, theme.bUseCharBackground ? theme.charBackground : BACKGROUND( 0x000000 ) );
SetAStyle( SCE_C_TASKMARKER, theme.text, theme.bUseCharBackground ? theme.charBackground : BACKGROUND( 0x000000 ) );
SetAStyle( SCE_C_ESCAPESEQUENCE, theme.text, theme.bUseCharBackground ? theme.charBackground : BACKGROUND( 0x000000 ) );

lexState->Colourise( 0, -1 );
}
7 changes: 7 additions & 0 deletions src/ShaderEditor.h
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,11 @@ class ShaderEditor : public Scintilla::Editor
void SetReadOnly( bool );
Scintilla::Font * GetTextFont();

const int GetFontSize() const { return nFontSize; }
void SetFontSize( int newSize );
const int GetOpacity() const { return nOpacity; }
void SetOpacity( int newOpacity );

private:
enum IndentationStatus
{
Expand All @@ -178,4 +183,6 @@ class ShaderEditor : public Scintilla::Editor
int IndentOfBlock( int line );
bool RangeIsAllWhitespace( int start, int end );
void AutomaticIndentation( char ch );

void UpdateFont();
};
27 changes: 23 additions & 4 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,15 @@ int main( int argc, const char * argv[] )
mShaderEditor.ButtonUp( Scintilla::Point( Renderer::mouseEventBuffer[ i ].x, Renderer::mouseEventBuffer[ i ].y ), time * 1000, false );
break;
case Renderer::MOUSEEVENTTYPE_SCROLL:
mShaderEditor.WndProc( SCI_LINESCROLL, (int) ( -Renderer::mouseEventBuffer[ i ].x * fScrollXFactor ), (int) ( -Renderer::mouseEventBuffer[ i ].y * fScrollYFactor ) );
if ( Renderer::mouseEventBuffer[ i ].ctrl )
{
int newFontSize = mShaderEditor.GetFontSize() + (int) Renderer::mouseEventBuffer[ i ].y;
mShaderEditor.SetFontSize( newFontSize );
}
else
{
mShaderEditor.WndProc( SCI_LINESCROLL, (int) ( -Renderer::mouseEventBuffer[ i ].x * fScrollXFactor ), (int) ( -Renderer::mouseEventBuffer[ i ].y * fScrollYFactor ) );
}
break;
}
}
Expand All @@ -436,7 +444,8 @@ int main( int argc, const char * argv[] )

for ( int i = 0; i < Renderer::keyEventBufferCount; i++ )
{
if ( Renderer::keyEventBuffer[ i ].scanCode == 283 ) // F2
#define FKEY(x) ((x)+281)
if ( Renderer::keyEventBuffer[ i ].scanCode == FKEY( 2 ) ) // F2
{
if ( bTexPreviewVisible )
{
Expand All @@ -451,7 +460,7 @@ int main( int argc, const char * argv[] )
bTexPreviewVisible = true;
}
}
else if ( Renderer::keyEventBuffer[ i ].scanCode == 286 || ( Renderer::keyEventBuffer[ i ].ctrl && Renderer::keyEventBuffer[ i ].scanCode == 'r' ) ) // F5
else if ( Renderer::keyEventBuffer[ i ].scanCode == FKEY( 5 ) || ( Renderer::keyEventBuffer[ i ].ctrl && Renderer::keyEventBuffer[ i ].scanCode == 'r' ) ) // F5
{
mShaderEditor.GetText( szShader, 65535 );
if ( Renderer::ReloadShader( szShader, (int) strlen( szShader ), szError, 4096 ) )
Expand All @@ -465,7 +474,17 @@ int main( int argc, const char * argv[] )
mDebugOutput.SetText( szError );
}
}
else if ( Renderer::keyEventBuffer[ i ].scanCode == 292 || ( Renderer::keyEventBuffer[ i ].ctrl && Renderer::keyEventBuffer[ i ].scanCode == 'f' ) ) // F11 or Ctrl/Cmd-f
else if ( Renderer::keyEventBuffer[ i ].ctrl && Renderer::keyEventBuffer[ i ].scanCode == '[' ) // ctrl-[
{
mShaderEditor.SetOpacity( mShaderEditor.GetOpacity() - 10 );
mDebugOutput.SetOpacity( mDebugOutput.GetOpacity() - 10 );
}
else if ( Renderer::keyEventBuffer[ i ].ctrl && Renderer::keyEventBuffer[ i ].scanCode == ']' ) // ctrl-]
{
mShaderEditor.SetOpacity( mShaderEditor.GetOpacity() + 10 );
mDebugOutput.SetOpacity( mDebugOutput.GetOpacity() + 10 );
}
else if ( Renderer::keyEventBuffer[ i ].scanCode == FKEY( 11 ) || ( Renderer::keyEventBuffer[ i ].ctrl && Renderer::keyEventBuffer[ i ].scanCode == 'f' ) ) // F11 or Ctrl/Cmd-f
{
bShowGui = !bShowGui;
}
Expand Down
5 changes: 3 additions & 2 deletions src/platform_glfw/Renderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -487,9 +487,9 @@ void key_callback( GLFWwindow * window, int key, int scancode, int action, int m
case GLFW_KEY_MENU: sciKey = SCK_MENU; break;
// case GLFW_KEY_SLASH: sciKey = '/'; break;
// case GLFW_KEY_ASTERISK: sciKey = '`'; break;
// case GLFW_KEY_LEFTBRACKET: sciKey = '['; break;
// case GLFW_KEY_BACKSLASH: sciKey = '\\'; break;
// case GLFW_KEY_RIGHTBRACKET: sciKey = ']'; break;
case GLFW_KEY_LEFT_BRACKET: sciKey = '['; break;
case GLFW_KEY_RIGHT_BRACKET:sciKey = ']'; break;
case GLFW_KEY_F1: sciKey = 282; break;
case GLFW_KEY_F2: sciKey = 283; break;
case GLFW_KEY_F3: sciKey = 284; break;
Expand Down Expand Up @@ -581,6 +581,7 @@ void mouse_button_callback( GLFWwindow * window, int button, int action, int mod
void scroll_callback( GLFWwindow * window, double xoffset, double yoffset )
{
mouseEventBuffer[ mouseEventBufferCount ].eventType = MOUSEEVENTTYPE_SCROLL;
mouseEventBuffer[ mouseEventBufferCount ].ctrl = glfwGetKey( window, GLFW_KEY_LEFT_CONTROL ) || glfwGetKey( window, GLFW_KEY_RIGHT_CONTROL );
mouseEventBuffer[ mouseEventBufferCount ].x = (float)xoffset;
mouseEventBuffer[ mouseEventBufferCount ].y = (float)yoffset;
mouseEventBufferCount++;
Expand Down
23 changes: 18 additions & 5 deletions src/platform_w32_dx11/Renderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -217,12 +217,23 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam )
case VK_MENU: sciKey = SCK_MENU; break;
// case VK_SLASH: sciKey = '/'; break;
// case VK_ASTERISK: sciKey = '`'; break;
// case VK_LEFTBRACKET: sciKey = '['; break;
// case VK_BACKSLASH: sciKey = '\\'; break;
// case VK_RIGHTBRACKET: sciKey = ']'; break;
case VK_F2: sciKey = 283; break;
case VK_F5: sciKey = 286; break;
case VK_F11: sciKey = 292; break;
case VK_OEM_4: sciKey = '['; break;
case VK_OEM_6: sciKey = ']'; break;
case VK_F1:
case VK_F2:
case VK_F3:
case VK_F4:
case VK_F5:
case VK_F6:
case VK_F7:
case VK_F8:
case VK_F9:
case VK_F10:
case VK_F11:
case VK_F12:
sciKey = wParam - VK_F1 + 282;
break;
case VK_SHIFT:
case VK_LSHIFT:
case VK_RSHIFT:
Expand Down Expand Up @@ -295,6 +306,7 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam )
case WM_MOUSEWHEEL:
{
mouseEventBuffer[ mouseEventBufferCount ].eventType = MOUSEEVENTTYPE_SCROLL;
mouseEventBuffer[ mouseEventBufferCount ].ctrl = ( GetAsyncKeyState( VK_LCONTROL ) & 0x8000 ) || ( GetAsyncKeyState( VK_RCONTROL ) & 0x8000 );
mouseEventBuffer[ mouseEventBufferCount ].x = 0.0f;
mouseEventBuffer[ mouseEventBufferCount ].y = GET_WHEEL_DELTA_WPARAM( wParam ) / (float) WHEEL_DELTA;
mouseEventBufferCount++;
Expand All @@ -303,6 +315,7 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam )
case WM_MOUSEHWHEEL:
{
mouseEventBuffer[ mouseEventBufferCount ].eventType = MOUSEEVENTTYPE_SCROLL;
mouseEventBuffer[ mouseEventBufferCount ].ctrl = ( GetAsyncKeyState( VK_LCONTROL ) & 0x8000 ) || ( GetAsyncKeyState( VK_RCONTROL ) & 0x8000 );
mouseEventBuffer[ mouseEventBufferCount ].x = -GET_WHEEL_DELTA_WPARAM( wParam ) / (float) WHEEL_DELTA;
mouseEventBuffer[ mouseEventBufferCount ].y = 0.0f;
mouseEventBufferCount++;
Expand Down
23 changes: 18 additions & 5 deletions src/platform_w32_dx9/Renderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -219,12 +219,23 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam )
case VK_MENU: sciKey = SCK_MENU; break;
// case VK_SLASH: sciKey = '/'; break;
// case VK_ASTERISK: sciKey = '`'; break;
// case VK_LEFTBRACKET: sciKey = '['; break;
// case VK_BACKSLASH: sciKey = '\\'; break;
// case VK_RIGHTBRACKET: sciKey = ']'; break;
case VK_F2: sciKey = 283; break;
case VK_F5: sciKey = 286; break;
case VK_F11: sciKey = 292; break;
case VK_OEM_4: sciKey = '['; break;
case VK_OEM_6: sciKey = ']'; break;
case VK_F1:
case VK_F2:
case VK_F3:
case VK_F4:
case VK_F5:
case VK_F6:
case VK_F7:
case VK_F8:
case VK_F9:
case VK_F10:
case VK_F11:
case VK_F12:
sciKey = wParam - VK_F1 + 282;
break;
case VK_SHIFT:
case VK_LSHIFT:
case VK_RSHIFT:
Expand Down Expand Up @@ -297,6 +308,7 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam )
case WM_MOUSEWHEEL:
{
mouseEventBuffer[ mouseEventBufferCount ].eventType = MOUSEEVENTTYPE_SCROLL;
mouseEventBuffer[ mouseEventBufferCount ].ctrl = ( GetAsyncKeyState( VK_LCONTROL ) & 0x8000 ) || ( GetAsyncKeyState( VK_RCONTROL ) & 0x8000 );
mouseEventBuffer[ mouseEventBufferCount ].x = 0.0f;
mouseEventBuffer[ mouseEventBufferCount ].y = GET_WHEEL_DELTA_WPARAM( wParam ) / (float) WHEEL_DELTA;
mouseEventBufferCount++;
Expand All @@ -305,6 +317,7 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam )
case WM_MOUSEHWHEEL:
{
mouseEventBuffer[ mouseEventBufferCount ].eventType = MOUSEEVENTTYPE_SCROLL;
mouseEventBuffer[ mouseEventBufferCount ].ctrl = ( GetAsyncKeyState( VK_LCONTROL ) & 0x8000 ) || ( GetAsyncKeyState( VK_RCONTROL ) & 0x8000 );
mouseEventBuffer[ mouseEventBufferCount ].x = -GET_WHEEL_DELTA_WPARAM( wParam ) / (float) WHEEL_DELTA;
mouseEventBuffer[ mouseEventBufferCount ].y = 0.0f;
mouseEventBufferCount++;
Expand Down

0 comments on commit 1514efe

Please sign in to comment.