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

Some wxGraphicsContext methods accept Lua table as an array of wxPoint2DDoubles #53

Merged
merged 4 commits into from
Jan 21, 2020

Conversation

toshinagata
Copy link
Contributor

DrawLines(), StrokeLines() (two variants) need an array of wxPoint2DDoubles, just like wxDC:DrawLines() needs an array of wxPoints. The arguments of these methods are modified so that they work similarly as in wxDC:DrawLines(). One of the variants of StrokeLines() needs an override, because it accepts only one 'n' (= the number of wxPoint2DDoubles) argument but two arrays of wxPoint2DDoubles.

@pkulchenko pkulchenko self-assigned this Jan 19, 2020
@pkulchenko
Copy link
Owner

@toshinagata, looks good, thank you for the patch!

I have couple of questions/suggestions:

  • wxPolygonFillMode fillStyle = wxODDEVEN_RULE parameter got lost from DrawLines. Shouldn't it be added back?

  • (int)(points ? points->size() uses int, but shouldn't it be size_t instead?

@toshinagata
Copy link
Contributor Author

@pkulchenko, you're right. I have just pushed one more commit. Is that all right?

@toshinagata
Copy link
Contributor Author

Sorry, one more commit. I overlooked the overridden StrokeLines().

@pkulchenko
Copy link
Owner

@toshinagata, the changes look good, but I get compilation errors on Windows (gcc version 9.2.0 (Rev2, Built by MSYS2 project)):

Scanning dependencies of target wxLuaModule
[  2%] Building CXX object modules/luamodule/CMakeFiles/wxLuaModule.dir/luamodule.cpp.obj
In file included from .../wxlua/wxLua/modules/wxlua/wxlstate.h:14,
                 from .../wxlua/wxLua/modules/luamodule/luamodule.cpp:35:
.../wxlua/wxLua/modules/wxlua/wxllua.h:556:46: error: 'wxPoint2DDouble' was not declared in this scope
  556 | WXDLLIMPEXP_WXLUA wxLuaSharedPtr<std::vector<wxPoint2DDouble> > LUACALL wxlua_getwxPoint2DDoubleArray(lua_State* L, int stack_idx);
      |                                              ^~~~~~~~~~~~~~~
.../wxlua/wxLua/modules/wxlua/wxllua.h:556:61: error: template argument 1 is invalid
  556 | WXDLLIMPEXP_WXLUA wxLuaSharedPtr<std::vector<wxPoint2DDouble> > LUACALL wxlua_getwxPoint2DDoubleArray(lua_State* L, int stack_idx);
      |                                                             ^
.../wxlua/wxLua/modules/wxlua/wxllua.h:556:61: error: template argument 2 is invalid
.../wxlua/wxLua/modules/wxlua/wxllua.h:556:63: error: template argument 1 is invalid
  556 | WXDLLIMPEXP_WXLUA wxLuaSharedPtr<std::vector<wxPoint2DDouble> > LUACALL wxlua_getwxPoint2DDoubleArray(lua_State* L, int stack_idx);
      |                                                               ^
make[2]: *** [modules/luamodule/CMakeFiles/wxLuaModule.dir/build.make:63: modules/luamodule/CMakeFiles/wxLuaModule.dir/luamodule.cpp.obj] Error 1
make[1]: *** [CMakeFiles/Makefile2:328: modules/luamodule/CMakeFiles/wxLuaModule.dir/all] Error 2
make: *** [Makefile:152: all] Error 2
Error: failed to build wxLua

Do you know what may be missing?

@toshinagata
Copy link
Contributor Author

toshinagata commented Jan 21, 2020

It looks like we need #include <wx/geometry.h> somewhere. Does this patch work?

@pkulchenko pkulchenko merged commit 045ff9f into pkulchenko:master Jan 21, 2020
@pkulchenko
Copy link
Owner

Yes, the patched worked; thank you.

@toshinagata toshinagata deleted the wxpoint2ddouble branch January 22, 2020 12:56
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

Successfully merging this pull request may close these issues.

2 participants