Build on new PC, fix wheel not scrolling
This commit is contained in:
23
build.bat
23
build.bat
@@ -1,14 +1,29 @@
|
|||||||
@echo off
|
@echo off
|
||||||
|
|
||||||
|
if not exist "src\external\SDL" (
|
||||||
|
pushd src\external
|
||||||
|
git clone https://github.com/libsdl-org/SDL.git
|
||||||
|
pushd SDL
|
||||||
|
cmake -S . -B build_win32_static -DCMAKE_BUILD_TYPE=Release -DSDL_STATIC=ON
|
||||||
|
pushd build_win32_static
|
||||||
|
msbuild SDL3.sln
|
||||||
|
popd
|
||||||
|
popd
|
||||||
|
popd
|
||||||
|
)
|
||||||
|
set sdl=..\src\external\SDL
|
||||||
|
set sdllib=%sdl%\build_win32_static\Debug
|
||||||
|
|
||||||
mkdir build
|
mkdir build
|
||||||
cd build
|
pushd build
|
||||||
|
|
||||||
set flags=/EHsc- /MD /Zi /FC /nologo /WX /W3 /wd4200 /wd4334 /diagnostics:column -DDEBUG_BUILD=1
|
set flags=/EHsc- /MD /Zi /FC /nologo /WX /W3 /wd4200 /wd4334 /diagnostics:column -DDEBUG_BUILD=1
|
||||||
set libs=../src/external/SDL/win32-static/SDL3-static.lib ../src/external/SDL/win32-static/SDL_uclibc.lib kernel32.lib gdi32.lib user32.lib Imm32.lib ole32.lib Shell32.lib OleAut32.lib Cfgmgr32.lib Setupapi.lib Advapi32.lib version.lib winmm.lib
|
set libs=%sdllib%/SDL3-static.lib %sdllib%/SDL_uclibc.lib kernel32.lib gdi32.lib user32.lib Imm32.lib ole32.lib Shell32.lib OleAut32.lib Cfgmgr32.lib Setupapi.lib Advapi32.lib version.lib winmm.lib
|
||||||
cl %flags% ../src/text_editor/text_editor.cpp -Fe:te.exe -I../src/external/SDL/include -I../src/external/lua/src -I../src/external/glad -I../src/ %libs% -link /SUBSYSTEM:WINDOWS /NODEFAULTLIB:LIBCMT /NODEFAULTLIB:MSVCRTD
|
cl %flags% ../src/text_editor/text_editor.cpp -Fe:te.exe -I%sdl%/include -I../src/external/glad -I../src/ %libs% -link /SUBSYSTEM:WINDOWS /NODEFAULTLIB:LIBCMT /NODEFAULTLIB:MSVCRTD
|
||||||
|
|
||||||
copy te.exe ..\data\te.exe
|
copy te.exe ..\data\te.exe
|
||||||
copy te.pdb ..\data\te.pdb
|
copy te.pdb ..\data\te.pdb
|
||||||
echo written ..\data\te.exe
|
echo written ..\data\te.exe
|
||||||
cd ..
|
|
||||||
|
popd
|
||||||
rem /fsanitize=address
|
rem /fsanitize=address
|
||||||
@@ -7,6 +7,7 @@
|
|||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
|
||||||
#if defined(__APPLE__) && defined(__MACH__)
|
#if defined(__APPLE__) && defined(__MACH__)
|
||||||
|
|||||||
@@ -431,8 +431,8 @@ Event TranslateSDLEvent(SDL_Event *input_event) {
|
|||||||
case SDL_EVENT_MOUSE_WHEEL: {
|
case SDL_EVENT_MOUSE_WHEEL: {
|
||||||
event.kind = EVENT_MOUSE_WHEEL;
|
event.kind = EVENT_MOUSE_WHEEL;
|
||||||
SDL_MouseWheelEvent &b = input_event->wheel;
|
SDL_MouseWheelEvent &b = input_event->wheel;
|
||||||
event.xmouse = (int16_t)roundf(DPIScale * b.x);
|
event.xmouse = (int16_t)roundf(DPIScale * b.mouse_x);
|
||||||
event.ymouse = (int16_t)roundf(DPIScale * b.y);
|
event.ymouse = (int16_t)roundf(DPIScale * b.mouse_y);
|
||||||
event.xwheel = b.x;
|
event.xwheel = b.x;
|
||||||
event.ywheel = b.y;
|
event.ywheel = b.y;
|
||||||
} break;
|
} break;
|
||||||
|
|||||||
@@ -179,14 +179,15 @@ void OnCommand(Event event) {
|
|||||||
Vec2I mouse = MouseVec2I();
|
Vec2I mouse = MouseVec2I();
|
||||||
|
|
||||||
For (order) {
|
For (order) {
|
||||||
if (!it->visible) continue;
|
if (!it->visible) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
bool mouse_in_window = AreOverlapping(mouse, it->total_rect);
|
bool mouse_in_window = AreOverlapping(mouse, it->total_rect);
|
||||||
if (mouse_in_window) {
|
if (mouse_in_window) {
|
||||||
View *view = GetView(it->active_view);
|
View *view = GetView(it->active_view);
|
||||||
view->scroll.y -= (Int)(event.ywheel * 48);
|
view->scroll.y -= (Int)(event.ywheel * 48);
|
||||||
view->scroll.x += (Int)(event.xwheel * 48);
|
view->scroll.x += (Int)(event.xwheel * 48);
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user