Author Topic: sprite editor  (Read 51688 times)

0 Members and 1 Guest are viewing this topic.

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: sprite editor
« Reply #75 on: September 09, 2020, 01:31:10 am »
Yes. I can load files.... Cool...

Yeah! Yea to Steve there is allot of his influence in that code!

I know its annoying to have to press f to get the files list up. It was a way for mouse and keypresses to work on just one list at a time. I will work on that. I'll also have a look at the drawing circles and lines that you have penciled in.

Might try a fill like Paint? Have you any requests?
« Last Edit: September 10, 2020, 12:13:02 pm by bplus »

Offline johnno56

  • Forum Resident
  • Posts: 1270
  • Live long and prosper.
    • View Profile
Re: sprite editor
« Reply #76 on: September 09, 2020, 02:02:28 am »
Just need an editor to draw pixels, lines, circles(plus fill), rectangles(plus fill)
For sprites 16x16 and up... Maybe a texture fill. There was a really old Amstrad (8 bit) that used a user-made texture fill. Amstrad CPC464 did not have a paint or fill command. The standard 4-way fill routine would work but was painfully slow... I have pretty much all of Amstrads programs, games and magazines... I will begin a search... manually... yikes!
Logic is the beginning of wisdom.

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: sprite editor
« Reply #77 on: September 10, 2020, 12:07:34 pm »
@johnno56

Quick question, were the buttons setup to use the Lucon font? I ask because they are all aligned to top left corner and that would be what would happen if a bigger font were expected to be used. Are you using a Windows version of Lucon? I would like a copy if not. I am overhauling the code so I can add the drawing tools line, circle, fill, undo...

Also need more idea about what "textures" are, like checkerboards of colors or gradients of colors or...?

So far 469 LOC eliminated plus some more safety checks with LoadFile still far from idiot proof but at least you wont accidentally KILL QB64.exe ;-)) or any other files except png, jpg, bmp plus some save to file checks at newImage, Quit, LoadFile.
« Last Edit: September 10, 2020, 12:09:31 pm by bplus »

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: sprite editor
« Reply #78 on: September 10, 2020, 05:25:19 pm »
OK Line drawing working in overhauled SprDraw v04b2:

hmm... now I see a little misalignment, back to drawing board ;-) Lines sure look ragged!
Line drawing working.PNG
* Line drawing working.PNG (Filesize: 56.87 KB, Dimensions: 1285x672, Views: 266)
« Last Edit: September 10, 2020, 05:28:46 pm by bplus »

Offline johnno56

  • Forum Resident
  • Posts: 1270
  • Live long and prosper.
    • View Profile
Re: sprite editor
« Reply #79 on: September 11, 2020, 08:30:40 am »
In regards to the font placement... Pure guess work. Didn't like the idea of the text starting from the 'edge'... Simply added a few pixels to the x and y of the _printstring()... and that's it... The use of lucon was purely mathematical. Before being introduce to _printwidth() and _printheight(), I used Lucon to help calculate the length of the string in pixels. Size 14 is 8 pixels wide. Number of letters in a label... the rest is simple math... Also, placing the text in the middle of the button has in my opinion, been done to death... lol But no, Lucon no longer needs to be used. If you find a font that looks better, by all means, give a try... I'd use Klingon if I could read it... lol 

In reference to the 'jagged' line... Just the other day, while researching line drawing, I read something about how to 'neaten' the line.... I only wish I could remember where I read it. It was just a passing note and didn't give it much thought... Don't you just hate that?

I am going to assume that the "Get Hue" button implies that the "default" drawing colour is now White? Cool.

In regards to textures. Mainly "fill patterns". Cherry Paint was written to be used on the Amstrad... Ugly as... But that was the mid 80's... lol
See attached...
Cherry-Paint.png
* Cherry-Paint.png (Filesize: 4.47 KB, Dimensions: 768x540, Views: 258)
« Last Edit: September 11, 2020, 08:42:48 am by johnno56 »
Logic is the beginning of wisdom.

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: sprite editor
« Reply #80 on: September 11, 2020, 10:22:13 am »
Hey @johnno56

Here is something to make note of: the default font in QB64 is 8 pixels wide and 16 pixels high (you can specify _FONT 8 for drawing special ASCII Characters, those are 8x8 and switch back and forth with _FONT 16, did you see my ASCII dice game?). You need to know that often in QB64 unless in screen mode 0 or as you say using your own font. I've been partial to Arial for clean lines ttf. If you don't, you should keep notes to track QB64 and the other Basics you use, QB64 is the one with all the Type stuff :)

QB64 should do Font width and height like they do Image width and height because after all it is an image too.
And images could be concatenated like printing font so you can tile a whole background with a strings of tile numbers.

Anyway, Get Hue is my name for what you called "Eye dropper". I didn't think "eye dropper" is too common but maybe "Get Hue" is obscure too, just remember Hue is the guy with all the colors in the grid ;-)) I didn't think it was really a drawing tool but you have to deactivate all the others so your mouse click on the grid picks up the color. So I put it 1st under drawing tools. For Mirror, not a drawing tool but an drawing tool enhancement is just a flag you toggle on and off. 

I got rid of zones and tools and track drawing mode with a letter and zone click is handled right there in main loop with left mouse button on, jobbed out to a sub if code is longer than a dozen lines. BTW what is difference between your right click "erase" and just setting color to background? None, I think, so no right mouse click stuff at moment but might be changed for popup menu for file stuff of maybe cherry picking color patterns like in your snapshot. That snapshot is loaded with ideas!

Yeah, icons for drawing tools much better than words! I am thinking your message box might be helpful for tool tips and helping instruct for more complicated too operations.


RE: Real Sprites!

So far what we are making are really tiles and restricted to square ones @64x64 eh...

I have been wondering how to do transparent color for real sprites, no background, just the object image like I did with Templar Cross. PNG files dont work well there is always background black when you take a point reading to save an image.

I am thinking a new extension .trn for transparent or .clr for clear so we can just layer an object image over everything behind it. Will need our own loadimage say loadSprite, easy enough I think.

What do you all think? Am I reinventing a wheel here?

Hmm... on second thought just make an image, load it into program then clearcolor the black, probably a lot less trouble.

RE: ICO files
Now I am wondering how an ico image is made. I tried to make one for Sudoku and going On-line to convert the PNG but the shrink always distorted the image beyond recognition. So I am wondering if we can make .ico images with this Editor.
« Last Edit: September 11, 2020, 10:40:56 am by bplus »

Offline johnno56

  • Forum Resident
  • Posts: 1270
  • Live long and prosper.
    • View Profile
Re: sprite editor
« Reply #81 on: September 11, 2020, 06:18:39 pm »
Ok. Where to start... Someone has been busy! At least one of us knows what we are doing... lol

I'm still getting used to QB64. I thought that _font 8 etc where used for text only screen... Obviously I'm not ready enough of the help file...

Eyedropper was the first word I thought of... In most image editors the colour picker is an eyedropper. If you look in the assets folder there is a toolbox folder within it. I had whipped up a bunch of images to use in stead of using text. After all, most users, expect icons... I suppose I can make them into buttons.... That would take care of any font issues and or text placement. What do you think? I happy to go either way...

I figured the messagebox could be used not only as warning and errors. Oh... maybe a little humour in the messages? Like if you try to draw on the main grid... "Really? Without colour?" (I know. With a default colour this won't apply) It's just an idea. 'normal' messages are so... dull.

Transparencies... I have seen in the past when images were made, a specific colour - usually magenta - was used as the 'transparent' colour. The game editor would set that colour to be transparent. I don't know if QB64 can do that. I know Naalaa and SDLBasic can... Other than that, I have no idea how to achieve transparency, using QB64. That is probably why I chose right mouse click to erase using black. Logic: The mouse pointer is already on the pixel in error. Much more efficient to right click than mouse travel to the erase icon and back and when done mouse travel to change colour and back... Without transparency, right click, for me, works best. But that may change... To achieve transparency, a little mouse travel, could be an acceptable sacrifice...

Icon files. I have no idea as to the difference between ICO and any other image. I know that Linux will use just about 'any' image as a traditional ICO file. eg: When I right click on a Desktop application icon I can examine the 'properties' and can change that application icon to any image type (obviously of similar size) that I want. I can even use one that I made myself. I don't know if Windows can do that, but if it can, then ICO isn't really needed if it can you can use 'any' type of image. If any image can be used then we don't need to convert an ICO file... But, I suppose, we will have to cater for our Windows purists... lol  This may help. https://en.wikipedia.org/wiki/ICO_(file_format)
Logic is the beginning of wisdom.

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: sprite editor
« Reply #82 on: September 11, 2020, 06:47:53 pm »
Definitely images for tools! so eyedropper is standard thing :)

Well I have frame and boxes working but a little difficulty getting ellipses symmetric (including circles), no, big problem! ;-))

Yeah, right mouse click way more convenient for erasing. That's easy and might be needed for fixing ellipses.
« Last Edit: September 11, 2020, 06:51:24 pm by bplus »

Offline johnno56

  • Forum Resident
  • Posts: 1270
  • Live long and prosper.
    • View Profile
Re: sprite editor
« Reply #83 on: September 11, 2020, 07:34:02 pm »
Gimp and MsPaint online... See attached.

I will work on the images. Draw the button and display the image or make the whole button an image? Either way is fine by me...

Hadn't thought of using the right mouse button for anchoring circles and ellipses (and other shapes).... I wasn't sure of getting that far with the editor... lol

Got to go shopping... Maybe back in a hour or so...
gimp.png
* gimp.png (Filesize: 32.45 KB, Dimensions: 306x239, Views: 241)
msPaint-online.png
* msPaint-online.png (Filesize: 3.44 KB, Dimensions: 128x246, Views: 241)
Logic is the beginning of wisdom.

Offline johnno56

  • Forum Resident
  • Posts: 1270
  • Live long and prosper.
    • View Profile
Re: sprite editor
« Reply #84 on: September 11, 2020, 10:02:36 pm »
First attempt "toolbox".

Two sets of images, colour and minimal. Button "selected" images not done yet... If either of these, or if you have any images that you would prefer, let me know? Th finished buttons will have a transparent background.

These we just a simple copy, paste and recolour of the "toolbox" icons... The eyedropper is new.
* toolbox.zip (Filesize: 7.96 KB, Downloads: 225)
Logic is the beginning of wisdom.

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: sprite editor
« Reply #85 on: September 11, 2020, 10:23:50 pm »
OK finally got the symmetry worked out for ellipse / oval then everything came together after that. Back to calling it eyedropper and right click erases, it will erase Mirror also if that is still on = flagged.

Here I drew a sample of everything over a sample image mostly with Mirror toggled on.
 
Spr Draw v04b2 bplus overhaul.PNG


A master piece ;-))

OK @johnno56  back to you for comments :)


* SprDraw v04b2.zip (Filesize: 414.06 KB, Downloads: 185)
« Last Edit: September 11, 2020, 10:26:40 pm by bplus »

Offline johnno56

  • Forum Resident
  • Posts: 1270
  • Live long and prosper.
    • View Profile
Re: sprite editor
« Reply #86 on: September 11, 2020, 11:24:18 pm »
Cool !!!  Nothing short of brilliant!

Minor suggestion: You have 'Oval' and 'Oval Fill'... Perhaps, if you prefer text buttons, instead of 'Frame', 'Box' and 'Box Fill'
What did you do to my mushroom? Looks like a rainbow threw up on him... lol

I think our next challenge: Sprite size. 8x8, 16x16 and 32x32... I only wished that I had not lost the early version that had various grid sizes.... The boxes and circles may not work so well on 8x8 and possibly the 16x16... The 8x8 is handy for "old school" games but I won't complain if we leave it out... lol  I'm going to go over my discs and archives to at least find a working prototype of grid changes. As you suggested before... there is no point re-inventing the wheel.... I will keep you posted.

Again. Brilliant job!!
Logic is the beginning of wisdom.

Offline johnno56

  • Forum Resident
  • Posts: 1270
  • Live long and prosper.
    • View Profile
Re: sprite editor
« Reply #87 on: September 11, 2020, 11:33:41 pm »
I found a disk that has individual editors for 8x8, 16x16 and 32x32. They were all written with sdlbasic and 'prior' to the 'various' version. I will keep looking...
Logic is the beginning of wisdom.

Offline johnno56

  • Forum Resident
  • Posts: 1270
  • Live long and prosper.
    • View Profile
Re: sprite editor
« Reply #88 on: September 11, 2020, 11:48:33 pm »
Version 2 and 3 were written using Naalaa. Both had the physical size change buttons coded but nothing else... Where's Sherlock when you need him?
Logic is the beginning of wisdom.

Offline johnno56

  • Forum Resident
  • Posts: 1270
  • Live long and prosper.
    • View Profile
Re: sprite editor
« Reply #89 on: September 12, 2020, 01:12:24 am »
Performed an experiment... To draw a grid of 64x64 the gsize is set to 10 (64X10 =gridwidth). Likewise setting gsize to 20 etc etc.

In the plot() routine the 'size' is hard coded to 10 (64x64). Changed '10's to gsize. Hard coded gsize to 20 and a 32x32 grid was drawn... Hard coded to 40 - 16x16 grid. Coded to 80 - 8x8 grid.

Checked all the tools. Pencil, Line, Frame and Box performed correctly. Ovals (also fill)... Not so much. The other tools took advantage of plot(), which resized exactly, but the ellipses are drawn with the line()-() command. Single sized line. Ovals and filled ovals will still draw on all grid sizes, but because the line is a single thickness, the lines do not match the grid. See attached

The attached was hard coded to a gsize of 40 (16x16)

Another issue are the preview boxes. They also would need 'scaling'.  64x64 and 32x32 seem to be ok. The smaller grids seem to be an issue.
Screenshot at 2020-09-12 15-06-34.png
* Screenshot at 2020-09-12 15-06-34.png (Filesize: 34.38 KB, Dimensions: 1302x684, Views: 275)
Logic is the beginning of wisdom.