03-09-2020, 04:12 AM
(This post was last modified: 03-09-2020, 04:21 AM by JaumeAlcazo.)
Thanks megamarc.
After all I ended drawing the hand compass animation frame by frame on top of the compass drawn by the artist and flipping the animation X, Y and X-Y and I only needed two animations: north-west and west-south (and the flips). And it's looking very cool, but I still wan't to unveil it until video2 cames out, or at least the next promo screenshot.
We will post another promo screenshot soon, hopefuly, and it will feature the compass.
Meanwhile I was suggested and asked by a friend to add graphical corruption glitches as sanity drops and it's a very nice idea. I stumbled upon this great tutorial:
So I asked myself how this could be achieved with Tilengine and would like to ask you for more ideas on how to achieve it.
You know my current aproach is using Sprite's everywhere to build the scene, except for a few static backgrounds. So distorting it in the way the tutorial suggest would be difficult at Tilengine's level, I mean, at Sprite level, as for instance there's no current way to slice the sprite in horizontal strips as the "Horizontal displacement" suggests.
Then you think: well, then do an animation, as it is done in the tutorial, you just draw several frames of the same sprite and apply the distortions and treat it like an animation.
Yes, but remember my viewport is made of several sprites, and so is the GUI made. So it would be impossible to hand drawn all the animations in all the possible sprites and trigger them at the same time, I think that is a dead way that leads nowhere.
Then it comes to my mind the Layer struct and all the raster effects you applied using the layers. So maybe one idea is to port the entire game to layers, altough I'm not sure if I'm able to do that or how to exactly do that, and then apply the effect to several layers at the same time.
It seems that the tutorial is asking for Tilengine's Layers, but it seems very difficult if not impossible to port the whole game to Layers instead of Sprites at this point, and maybe that's not possible even if I try it.
Another option would be, as we talked some time ago, to take a screenshot (by code) then reading it back from the hard drive, applying the distortion, feature it on screen for some miliseconds and then move it to 2000,2000 (as I usually do to hide sprites).
But maybe that's expensive, altough remember my text system creates images from ttf on the fly and reads back from hard drive in no time, so maybe it's feasible.
Then another option came to my mind, to work at SDL level and somehow get the pixels of the frame before the frame is rendered, and distort them, just before the frame is rendered, just inside this in the main loop:
I searched your code and found:
So, maybe I can do custom TLN_DrawFrame2(frame) and then mess around with the pixels inside TLN_DrawNextScanline(void) before
Any hints on this approach megamarc? It is feasible? Or better I seek another way?
After all I ended drawing the hand compass animation frame by frame on top of the compass drawn by the artist and flipping the animation X, Y and X-Y and I only needed two animations: north-west and west-south (and the flips). And it's looking very cool, but I still wan't to unveil it until video2 cames out, or at least the next promo screenshot.
We will post another promo screenshot soon, hopefuly, and it will feature the compass.
Meanwhile I was suggested and asked by a friend to add graphical corruption glitches as sanity drops and it's a very nice idea. I stumbled upon this great tutorial:
So I asked myself how this could be achieved with Tilengine and would like to ask you for more ideas on how to achieve it.
You know my current aproach is using Sprite's everywhere to build the scene, except for a few static backgrounds. So distorting it in the way the tutorial suggest would be difficult at Tilengine's level, I mean, at Sprite level, as for instance there's no current way to slice the sprite in horizontal strips as the "Horizontal displacement" suggests.
Then you think: well, then do an animation, as it is done in the tutorial, you just draw several frames of the same sprite and apply the distortions and treat it like an animation.
Yes, but remember my viewport is made of several sprites, and so is the GUI made. So it would be impossible to hand drawn all the animations in all the possible sprites and trigger them at the same time, I think that is a dead way that leads nowhere.
Then it comes to my mind the Layer struct and all the raster effects you applied using the layers. So maybe one idea is to port the entire game to layers, altough I'm not sure if I'm able to do that or how to exactly do that, and then apply the effect to several layers at the same time.
It seems that the tutorial is asking for Tilengine's Layers, but it seems very difficult if not impossible to port the whole game to Layers instead of Sprites at this point, and maybe that's not possible even if I try it.
Another option would be, as we talked some time ago, to take a screenshot (by code) then reading it back from the hard drive, applying the distortion, feature it on screen for some miliseconds and then move it to 2000,2000 (as I usually do to hide sprites).
But maybe that's expensive, altough remember my text system creates images from ttf on the fly and reads back from hard drive in no time, so maybe it's feasible.
Then another option came to my mind, to work at SDL level and somehow get the pixels of the frame before the frame is rendered, and distort them, just before the frame is rendered, just inside this in the main loop:
Code:
TLN_DrawFrame(frame);
I searched your code and found:
Code:
void TLN_DrawFrame (int time){
TLN_BeginWindowFrame (time);
while (TLN_DrawNextScanline ()){}
TLN_EndWindowFrame ();
}
So, maybe I can do custom TLN_DrawFrame2(frame) and then mess around with the pixels inside TLN_DrawNextScanline(void) before
Code:
/* next scanline */
engine->line++;
return engine->line < engine->framebuffer.height;
}
Any hints on this approach megamarc? It is feasible? Or better I seek another way?