Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Undefined references (Linux) #148

Closed
Pulfer opened this issue Sep 30, 2019 · 2 comments
Closed

Undefined references (Linux) #148

Pulfer opened this issue Sep 30, 2019 · 2 comments

Comments

@Pulfer
Copy link

Pulfer commented Sep 30, 2019

CMakeFiles/Milton.dir/src/unity.cc.o: In function drag_brush_size_start(Milton*, Vector2<int>)': unity.cc:(.text+0x25512): undefined reference to platform_cursor_get_position'
CMakeFiles/Milton.dir/src/unity.cc.o: In function drag_brush_size_stop(Milton*)': unity.cc:(.text+0x25623): undefined reference to platform_cursor_set_position'
CMakeFiles/Milton.dir/src/unity.cc.o: In function binding_dispatch_action(BindableAction, MiltonInput*, Milton*, Vector2<int>)': unity.cc:(.text+0x5d8a4): undefined reference to platform_cursor_set_position'
CMakeFiles/Milton.dir/src/unity.cc.o: In function milton_update_and_render(Milton*, MiltonInput const*)': unity.cc:(.text+0x686cb): undefined reference to platform_cursor_get_position'

These functions are defined for Mac and Windows but not for Linux (platform_linux.cc).

@danfe
Copy link

danfe commented Sep 30, 2019

Two functions are missing from src/platform_linux.cc as shown below:

v2i
platform_cursor_get_position(PlatformState* platform)
{
    v2i pos;

    SDL_GetMouseState(&pos.x, &pos.y);
    return pos;
}

void
platform_cursor_set_position(PlatformState* platform, v2i pos)
{
    SDL_WarpMouseInWindow(platform->window, pos.x, pos.y);
    // Pending mouse move events will have the cursor close
    // to where it was before we set it.
    SDL_FlushEvent(SDL_MOUSEMOTION);
    SDL_FlushEvent(SDL_SYSWMEVENT);
}

Tested under FreeBSD, seems to DTRT.

@serge-rgb
Copy link
Owner

Thanks for the bug report and fixes!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants