Skip to content

Commit

Permalink
Resolve merge conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
timothyschoen committed Sep 26, 2024
2 parents 868250d + 07200b0 commit 06deee4
Show file tree
Hide file tree
Showing 42 changed files with 1,559 additions and 616 deletions.
12 changes: 4 additions & 8 deletions .github/workflows/makefile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ jobs:
# Big thanks to @tomara-x and @timothyschoen for showing me how to do this! -ag

github-release:
if: startsWith(github.ref, 'refs/tags/')
if: github.ref_type == 'tag'
runs-on: ubuntu-latest
needs: [ubuntu-build, macos-build, windows-build]

Expand Down Expand Up @@ -157,13 +157,11 @@ jobs:
- name: check deken package
shell: bash
run: |
SHORT=${GITHUB_REF:10}
VERSION=${SHORT//\//_}
echo "## ${{ matrix.os }}" | tee -a $GITHUB_STEP_SUMMARY
mkdir -p package-${{ matrix.os }}
docker run --rm --user $(id -u) --volume ./pdlua-${{ matrix.os }}:/pdlua \
--volume ./package-${{ matrix.os }}:/package registry.git.iem.at/pd/deken \
deken package --output-dir /package -v "${VERSION}" /pdlua
deken package --output-dir /package -v "${{ github.ref_name }}" /pdlua
dek_files=$(ls package-${{ matrix.os }}/*.dek)
for dek_file in $dek_files; do
Expand Down Expand Up @@ -204,13 +202,11 @@ jobs:
DEKEN_USERNAME: ${{ secrets.DEKEN_USERNAME }}
DEKEN_PASSWORD: ${{ secrets.DEKEN_PASSWORD }}
run: |
SHORT=${GITHUB_REF:10}
VERSION=${SHORT//\//_}
for os in ubuntu macos windows; do
docker run --rm -e DEKEN_USERNAME -e DEKEN_PASSWORD \
--volume ./pdlua-${os}:/pdlua registry.git.iem.at/pd/deken \
deken upload --no-source-error -v "${VERSION}" /pdlua
deken upload --no-source-error -v "${{ github.ref_name }}" /pdlua
done
docker run --rm -e DEKEN_USERNAME -e DEKEN_PASSWORD \
--volume ./pdlua-src:/pdlua registry.git.iem.at/pd/deken \
deken upload -v "${VERSION}" /pdlua
deken upload -v "${{ github.ref_name }}" /pdlua
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,5 @@ pdx_files = $(addprefix ./pdlua/tutorial/examples/, pdx.lua pd-remote.el pd-remo
installplus:
$(INSTALL_DIR) -v "$(installpath)"
cp -r ./pdlua/ "${installpath}"/pdlua
cp pdlua-meta.pd "${installpath}"
cp $(pdx_files) "${installpath}"
32 changes: 22 additions & 10 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ corresponding subdirectories). Originally written by Claude Heiland-Allen,
pdlua has gone through the hands of a few people over the years, including
mrpeach (maintainer since 2011), zmoelnig a.k.a. umlaeute (loader update,
Debian package), and myself (Arch package, Lua 5.3+ support, Purr Data and
plugdata support, tutorial). Please also check my brief account on the history
of pd-lua below.
plugdata support, pdx.lua live-coding extension, tutorial). Please also check
my brief account on the history of pd-lua below.

Lua 5.4 is highly recommended with the latest version, Lua 5.3 works as
well. Reportedly, Lua 5.2 and even 5.1 still work (at least to some extent),
Expand Down Expand Up @@ -85,19 +85,16 @@ on https://github.com/agraef/pd-lua (but see below for the Deken package).
Also, both Purr Data and plugdata ship with pdlua, and have it enabled by
default, so no 3rd party package is needed in those environments.

For vanilla, we recommend installing the Deken package (named `pdlua`),
For vanilla Pd, we recommend installing the Deken package (named `pdlua`),
readily available using Pd's `Find externals` menu option. This package was
originally uploaded by Alexandre Porres, but Ben Wesch recently added Deken
tests and uploads to our GitHub workflow, so that the Deken releases are now
automatized and always in sync with the GitHub releases. Thanks, Ben!

The latest release is also in the Arch repositories (maintained by dvzrv,
thanks David!), and in the Debian repositories (maintained by IOhannes
Zmölnig, thanks umlaeute!).

To enable the pdlua loader in Pd after installation, just add `pdlua` to your
startup libraries (after adding its parent directory to Pd's search path if
necessary) and you should be set.
pd-lua is also in the Arch repositories (maintained by dvzrv, thanks David!),
and in the Debian repositories (maintained by IOhannes Zmölnig, thanks
umlaeute!). (During busy times, these may trail our releases for a little bit,
but most of the time they will the latest version.)

Mac users please note that the packages I distribute aren't notarized, so on
recent macOS versions you'll have to jump through the usual hoops to make them
Expand All @@ -106,6 +103,21 @@ usually do the trick, but check the internet for up-to-date information on
Gatekeeper for details.


Enabling pdlua:

Again, this step is only necessary with vanilla Pd; both Purr Data and
plugdata have the pdlua loader enabled by default, so it should be ready to go
immediately.

With vanilla Pd, after installing pdlua, the pdlua loader also needs to be
added to your startup libraries, before Pd will recognize any Lua object in
your patches. This only needs to be done once. (Alternatively, you can also
use the `-lib pdlua` option on the Pd command line, or a `declare -lib pdlua`
object in a patch with Lua objects.) To make any of this work, you may also
have to add the parent directory of the `pdlua` folder to Pd's search path if
pdlua was installed in an unusual location.


Compilation Instructions:

You can also compile pdlua yourself from source, which isn't hard to do.
Expand Down
75 changes: 41 additions & 34 deletions doc/graphics.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,47 +28,54 @@ end

API overview
--------------
-- Callback functions you can define

pd:Class:mouse_down(x, y) -- Mouse down callback, called when the mouse is clicked
pd:Class:mouse_up(x, y) -- Mouse up callback, called when the mouse button is released
pd:Class:mouse_move(x, y) -- Mouse move callback, called when the mouse is moved while not being down
pd:Class:mouse_drag(x, y) -- Mouse drag callback, called when the mouse is moved while also being down
-- Callback functions you can define
pd:Class:mouse_down(x, y) -- Mouse down callback, called when the mouse is clicked
pd:Class:mouse_up(x, y) -- Mouse up callback, called when the mouse button is released
pd:Class:mouse_move(x, y) -- Mouse move callback, called when the mouse is moved while not being down
pd:Class:mouse_drag(x, y) -- Mouse drag callback, called when the mouse is moved while also being down

-- Functions you can call
pd:Class:repaint() -- Request a repaint, after this the "paint" callback will occur
pd:Class:paint(g) -- Paint callback, returns a graphics_context object (commonly called g) that you can call these drawing functions on:
g:set_size(w, h) -- Sets the size of the object.
width, height = g:get_size(w, h) -- Gets the size of the object.
pd:Class:repaint() -- Request a repaint, after this the "paint" callback will occur
pd:Class:paint(g) -- Paint callback, returns a graphics_context object (commonly called g) that you can call these drawing functions on:

g:set_size(w, h) -- Sets the size of the object
width, height = g:get_size(w, h) -- Gets the size of the object

g:set_color(r, g, b, a=1.0) -- Sets the color for the next drawing operation.
g:set_color(r, g, b, a=1.0) -- Sets the color for the next drawing operation

g:fill_ellipse(x, y, w, h) -- Draws a filled ellipse at the specified position and size.
g:stroke_ellipse(x, y, w, h, line_width) -- Draws the outline of an ellipse at the specified position and size.
g:fill_ellipse(x, y, w, h) -- Draws a filled ellipse at the specified position and size
g:stroke_ellipse(x, y, w, h, line_width) -- Draws the outline of an ellipse at the specified position and size

g:fill_rect(x, y, w, h) -- Draws a filled rectangle at the specified position and size.
g:stroke_rect(x, y, w, h, line_width) -- Draws the outline of a rectangle at the specified position and size.
g:fill_rect(x, y, w, h) -- Draws a filled rectangle at the specified position and size
g:stroke_rect(x, y, w, h, line_width) -- Draws the outline of a rectangle at the specified position and size

g:fill_rounded_rect(x, y, w, h, corner_radius) -- Draws a filled rounded rectangle at the specified position and size.
g:stroke_rounded_rect(x, y, w, h, corner_radius, line_width) -- Draws the outline of a rounded rectangle at the specified position and size.
g:fill_rounded_rect(x, y, w, h, corner_radius) -- Draws a filled rounded rectangle at the specified position and size
g:stroke_rounded_rect(x, y, w, h, corner_radius, line_width) -- Draws the outline of a rounded rectangle at the specified position and size

g:draw_line(x1, y1, x2, y2) -- Draws a line between two points.
g:draw_text(text, x, y, w, fontsize) -- Draws text at the specified position and size.
g:draw_line(x1, y1, x2, y2) -- Draws a line between two points
g:draw_text(text, x, y, w, fontsize) -- Draws text at the specified position and size

g:fill_all() -- Fills the entire drawing area with the current color. Also will draw an object outline in the style of the host (ie. pure-data or plugdata)
g:fill_all() -- Fills the entire drawing area with the current color. Also will draw an object outline in the style of the host (ie. pure-data or plugdata)

g:translate(tx, ty) -- Translates the coordinate system by the specified amounts.
g:scale(sx, sy) -- Scales the coordinate system by the specified factors. This will always happen after the translation
g:reset_transform() -- Resets current scale and translation
g:translate(tx, ty) -- Translates the coordinate system by the specified amounts
g:scale(sx, sy) -- Scales the coordinate system by the specified factors. This will always happen after the translation
g:reset_transform() -- Resets current scale and translation

p = Path(x, y) -- Initiates a new path at the specified point
p:line_to(x, y) -- Adds a line segment to the path.
p:quad_to(x1, y1, x2, y2) -- Adds a quadratic Bezier curve to the path.
p:cubic_to(x1, y1, x2, y2, x3, y) -- Adds a cubic Bezier curve to the path.
p:close_path() -- Closes the path.
p = Path(x, y) -- Initiates a new path at the specified point
p:line_to(x, y) -- Adds a line segment to the path
p:quad_to(x1, y1, x2, y2) -- Adds a quadratic Bezier curve to the path
p:cubic_to(x1, y1, x2, y2, x3, y) -- Adds a cubic Bezier curve to the path
p:close_path() -- Closes the path

g:stroke_path(p, line_width) -- Draws the outline of the path with the specified line width
g:fill_path(p) -- Fills the current path

-- Additional functions
expandedsymbol = pd:Class:canvas_realizedollar(s) -- Expand dollar symbols in patch canvas context
pd:Class:set_args(args) -- Set the object arguments to be saved in the patch file
pd:Class:get_args() -- Get the object arguments to be saved in the patch file

g:stroke_path(p, line_width) -- Draws the outline of the path with the specified line width.
g:fill_path(p) -- Fills the current path.

Basic example
---------------------
Expand All @@ -94,12 +101,12 @@ function example:mouse_drag(x, y)
self:repaint()
end

function example:paint()
function example:paint(g)
-- Fill background with color
gfx.set_color(255, 0, 0, 1)
gfx.fill_all()
g:set_color(255, 0, 0, 1)
g:fill_all()

-- Draw an ellipse
gfx.set_color(0, 255, 0, 1)
gfx.fill_ellipse(self.circle_x, self.circle_y, 30, 30)
g:set_color(0, 255, 0, 1)
g:fill_ellipse(self.circle_x, self.circle_y, 30, 30)
end
Loading

0 comments on commit 06deee4

Please sign in to comment.