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

Doodling on sheets like a map #61

Open
Saborknight opened this issue Aug 16, 2019 · 2 comments
Open

Doodling on sheets like a map #61

Saborknight opened this issue Aug 16, 2019 · 2 comments

Comments

@Saborknight
Copy link
Owner

Would it be possible to have similar drawing functionality from the map, be implemented for our notepad sheets?

@pixlcrashr
Copy link
Collaborator

pixlcrashr commented Aug 16, 2019

Well, it is possible and it isn't even that hard to accomplish that at all.

But how would drawing work then?
That is an easy question. We have to think of a virtual grid for "painted points", we need mouse down, move & up events and we need a static area where it is possible to draw.

For example, I've included an example of a highlighted grid:

preview_grid

Of course, this grid resolution is not that satisfying at all, but thats only the general idea.

/*
	example of the virtual grid to get the points to draw from
	fired when the mouse moves.
 */

/* now, this configuration is the whole visible screen */
nln_someInitialGridXPos = 0;
nln_someInitialGridYPos = 0;
nln_someInitialGridWidth = 1;
nln_someInitialGridHeight = 1;

nln_gridSize = 100; // think of an 100x100 grid

params [
	"_mouseX",
	"_mouseY"
];

if (_mouseX < nln_someInitialGridXPos || _mouseX > nln_someInitialGridXPos + nln_someInitialGridWidth) exitWith {}; // out of X boundaries of the grid
if (_mouseY < nln_someInitialGridYPos || _mouseY > nln_someInitialGridYPos + nln_someInitialGridHeight) exitWith {}; // out of Y boundaries of the grid

private _gridFieldWidth = nln_someInitialGridWidth / nln_gridSize;
private _gridFieldHeight = nln_someInitialGridHeight / nln_gridSize;

private _gridFieldXPos = floor (_mouseX / _gridFieldWidth);
private _gridFieldYPos = floor (_mouseY / _gridFieldHeight);

// from now on, we know in which grid field the mouse pointer is in.

// if the mouse pointer is down, then set the field as colored or marked (the point now is drawn)

This code does not consider the rectangles for each grid field to be aligned to the aspect ratio of the screen.

This would be some example code for getting the correct grid coordinate for drawing a point.

I guess, that the resolution for pixels should not be used since it is too detailed and so it will used more resources for computing each colored point.

These are just my initial thoughts on that one.

@Saborknight
Copy link
Owner Author

Fascinating. I do feel it's secondary from the rest of bugs and enhancements outstanding for 1.0 though, so I'll stick this in 1.1 for now. Definitely something that should be done though.

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

No branches or pull requests

2 participants