Browsing for sprites
Moderators: Bob the Hamster, marionline, SDHawk
- Bob the Hamster
- Lord of the Slimes
- Posts: 7660
- Joined: Tue Oct 16, 2007 2:34 pm
- Location: Hamster Republic (Ontario Enclave)
- Contact:
Browsing for sprites
Coming in tomorrow's wip builds, it is now possible to browse for sprites rather than typing in their ID numbers
Hero and portrait browsing:
Attack browsing... may cause seizures?
Is exploiting the "Shrink" Dissolve type in Custom going to come back to bite me on the bum?
Hero and portrait browsing:
Attack browsing... may cause seizures?
Is exploiting the "Shrink" Dissolve type in Custom going to come back to bite me on the bum?
Wasn't expecting this; nice! I'm planning a tiled interface for the new spriteset editor too.
Oh is that what you did? Ah, that explains why the browser runs at 1.3 fps on my netbook :P I had assumed that you'd used the routine I wrote for scaling a surface (scale_surface()). But I guess I didn't merge any of the branches where I actually use it, for you to use as an example.Is exploiting the "Shrink" Dissolve type in Custom going to come back to bite me on the bum?
- Bob the Hamster
- Lord of the Slimes
- Posts: 7660
- Joined: Tue Oct 16, 2007 2:34 pm
- Location: Hamster Republic (Ontario Enclave)
- Contact:
The way to use surface_scale is entirely non-obvious. I think you'll be surprised at what's going on!
Hmm, we actually have three different ways to scale a sprite. And all of them have major problems/shortcomings. Even though it feels messy, I guess I'll pick surface_scale and build sprite scaling into the slice system for convenience, although it means it can't be exposed to users, yet, due to bitdepth thing.
Hmm, we actually have three different ways to scale a sprite. And all of them have major problems/shortcomings. Even though it feels messy, I guess I'll pick surface_scale and build sprite scaling into the slice system for convenience, although it means it can't be exposed to users, yet, due to bitdepth thing.
Last edited by TMC on Wed Sep 13, 2017 2:46 pm, edited 2 times in total.
- Bob the Hamster
- Lord of the Slimes
- Posts: 7660
- Joined: Tue Oct 16, 2007 2:34 pm
- Location: Hamster Republic (Ontario Enclave)
- Contact:
I was looking at surface_scale's usage in browse.bas, and yes, that is a doozy!
But it seems like there is no reason we couldn't have a convenience wrapper overload that ends up being used like:
Code: Select all
DIM as Surface ptr temp = surface_import_bmp(filepath, YES) 'always_32bit=YES
'? "import32 in " & (TIMER - t)
't = TIMER
DIM ratio as double = 1.0
WITH br.preview_panel_size
IF temp->width > 0 THEN ratio = small(1.0, small(.w / temp->width, .h / temp->height))
END WITH
surface_assign @temp, surface_scale(temp, temp->width * ratio, temp->height * ratio)
'? "shrink in " & (TIMER - t)
br.image_preview = frame_with_surface(temp)
gfx_surfaceDestroy(@temp)
Code: Select all
br.image_preview = surface_scale(surface_import_bmp(filepath, YES), ratio)
- Spoonweaver
- Liquid Metal King Slime
- Posts: 6467
- Joined: Mon Dec 08, 2008 7:07 am
- Contact:
- FnrrfYgmSchnish
- Metal Slime
- Posts: 741
- Joined: Thu Jun 18, 2009 4:37 am
- Location: Middle of Nowhere