Log In  

Cart #pointsketch-13 | 2022-02-27 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
7


Pointsketch is a simple art tool based on points with three parameters: x, y and color. These points can be easily edited, and all of them are connected by lines in the order that they were created.

There are several things that can be done in Pointsketch, so here's a little guide:


Overview

  • Section A - insert/delete/edit points
  • Section B - select/customize colors (alternate colors are marked with ◆)
  • Section C - save sketch (⬇️) / load sketch (⬆️)
  • Section D - change mode (draw/edit)

Controls

General use

  • Arrow keys - scroll
  • O/Z, X - zoom

Section A

  • Left click (draw mode) - insert point
  • Right click (draw mode) - undo
  • middle (wheel) click (draw mode) - clear
  • Left click (edit mode) - grab/release point

Section B

  • left click on a color - select color
  • right click on a color - change color (alternate palette)
  • right click on B button - change background color (alternate palette)

Section C

  • left click on "Pointsketch" (between ⬇️ and ⬆️) - turn on/off coordinate lines
  • left click on ⬇️ button - save sketch
  • left click on ⬆️ button - load sketch (to load a sketch copied outside of PICO-8, press ctrl+v before clicking)

Section D

  • left click - switch mode

Saving/Loading

When the ⬇️ button is clicked the parameters of each point will be encoded and the sketch will be saved as a string (if the tool is used on the BBS, press ctrl+c to copy the string, otherwise it will be copied automatically). This string has a very simple to understand format ('pointsketch_sketch',x,y,color,x,y,color,x,y,color...) and can be pasted anywhere else since it's copied to the clipboard. This can be specially useful to share sketches. To load a sketch string found outside of PICO-8, copy it, then in Pointsketch press ctrl+v. Once these keys have been pressed, right click the ⬆️ button.


Sketch Renderer

Additionnally, here's a function that can render a sketch without needing to use Pointsketch. This can be useful for implementation in other PICO-8 carts. It's recommended to call this function inside of function _draw().

sketch={paste your sketch here}

function render_sketch()
 if sketch[1]=='pointsketch_sketch' and (#sketch-1)/3==flr((#sketch-1)/3) then
  for i=2,#sketch,3 do
   if i<#sketch-2 then
    line(sketch[i],sketch[i+1],sketch[i+3],sketch[i+4],sketch[i+5])
   end
   circfill(sketch[i],sketch[i+1],1,sketch[i+2])
  end
 end
end

Thanks to the PICO-8 discord server for all of the help and feedback!

P#106768 2022-02-12 05:25 ( Edited 2022-02-27 22:35)

1

Good, @megasparkmaster. I would add it so if you hold down the left button you get to see the vector it draws but it does not drop it yet, and you can swing it around to see what it looks like before you drop it by releasing the left mouse button.

I would also add soft-coordinates. That is for every point drawn two darker (color #5) lines are drawn. For instance, let's say you lit up point 50,40.

So a darker line would be drawn from 50,0,50,127, 0,40,127,40.

This would help people align coordinates. It could be turned on and off with one of the remaining arrow keys.

P#106786 2022-02-12 15:31 ( Edited 2022-02-12 15:49)

Thanks, @dw817! This soft-coordinate thing seems preety interesting and complex. However, I don't think I'd need something to make it easier to align coordinates, since the points already snap within a 6px area. Regarding the next point preview, I released an update where a line is always drawn from the last point to the cursor unless the cursor is outside the drawing area. It might seem awkward at first, but it can be really useful because it allows you to see where the next point will be drawn.

P#106787 2022-02-12 16:06 ( Edited 2022-02-13 00:48)
2

It's not that so much, @megasparkmaster. It's for instance if you are drawing a square. Here:

You can see this 4th coordinate I want to align with the 1st coordinate perfectly, but I'm not sure how far across I need to go on the 3rd coordinate for a vertical alignment before I left click and then go up.

Here is the same with enhanced coordinates. In this illustration they are on all the time, in your code you could turn them on and off, and of course have the real coordinates appearing on top of the align markers.

P#106807 2022-02-13 00:57

Thanks for the suggestion @dw817, I have implemented it into the tool.

P#106810 2022-02-13 01:34
1

Very good, thanks, @megasparkmaster. I've got shaky hands on a mouse so this helps me at least. Well done. Gold star achievement.

P#106813 2022-02-13 02:07 ( Edited 2022-02-13 02:10)

You're welcome, and thanks for the feedback, @dw817!

P#106814 2022-02-13 02:14

[Please log in to post a comment]

Follow Lexaloffle:          
Generated 2024-03-29 10:03:18 | 0.104s | Q:27