diff --git a/blooblib/include/game.h b/blooblib/include/game.h index 7156e38..e671b8c 100644 --- a/blooblib/include/game.h +++ b/blooblib/include/game.h @@ -8,4 +8,8 @@ struct game { virtual void init(settings& settings); virtual void render(image& target); virtual void update(); +protected: + vec2i const& mouse_pos() const; +private: + vec2i _mouse_pos; }; diff --git a/blooblib/src/game.cpp b/blooblib/src/game.cpp index c75a1c6..1a883be 100644 --- a/blooblib/src/game.cpp +++ b/blooblib/src/game.cpp @@ -3,7 +3,6 @@ #include #include #include -#define WIN32_LEAN_AND_MEAN #include #include #include "image.h" @@ -47,6 +46,7 @@ void game::run() { ); ShowWindow(window, SW_SHOWNORMAL); + ShowCursor(FALSE); auto window_image = image(settings.size * settings.scale); auto screen = image(settings.size); @@ -70,6 +70,10 @@ void game::run() { case WM_QUIT: running = false; break; + case WM_MOUSEMOVE: + _mouse_pos.x = LOWORD(msg.lParam) / settings.scale; + _mouse_pos.y = HIWORD(msg.lParam) / settings.scale; + break; } } @@ -184,3 +188,7 @@ void game::render(image& target) { void game::update() { } + +vec2i const& game::mouse_pos() const { + return _mouse_pos; +} diff --git a/test/habbo.png b/test/habbo.png index ee3d8f3..aef1f6d 100644 Binary files a/test/habbo.png and b/test/habbo.png differ diff --git a/test/test.cpp b/test/test.cpp index 584374e..0a64fb3 100644 --- a/test/test.cpp +++ b/test/test.cpp @@ -35,6 +35,7 @@ void my_game::render(image& target) { //target.draw(img, vec2i(320, 180) + pos); //target.draw(tileset[0xda], vec2i(320, 180) + pos, 0xff00ff); target.draw("hello world!", vec2i(320, 180) + pos, font, 0xffffff, 0); + target.draw("\\", mouse_pos(), font, 0xffffff, 0); } int main(int argc, char* argv[]) {