Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

neoGFX animation is as simple as...

35 views
Skip to first unread message

Mr Flibble

unread,
May 11, 2020, 4:25:37 PM5/11/20
to
auto const explosionMaterial = ng::game::material
{
{}, {},
ecs.shared_component<ng::game::texture>().populate("explosion", ng::to_ecs_component(ng::image{ ":/test/resources/explosion.png" }))
};
auto const explosionAnimation = ng::game::animation_filter
{
ecs.shared_component<ng::game::animation>().populate("explosion", ng::game::regular_sprite_sheet_to_animation(explosionMaterial, ng::vec2u32{ 4u, 3u }, 0.1))
};
auto explosion = ecs.create_entity(archetypes::explosion, explosionMaterial, explosionAnimation);

/Flibble

--
"Snakes didn't evolve, instead talking snakes with legs changed into snakes." - Rick C. Hodgin

“You won’t burn in hell. But be nice anyway.” – Ricky Gervais

“I see Atheists are fighting and killing each other again, over who doesn’t believe in any God the most. Oh, no..wait.. that never happens.” – Ricky Gervais

"Suppose it's all true, and you walk up to the pearly gates, and are confronted by God," Byrne asked on his show The Meaning of Life. "What will Stephen Fry say to him, her, or it?"
"I'd say, bone cancer in children? What's that about?" Fry replied.
"How dare you? How dare you create a world to which there is such misery that is not our fault. It's not right, it's utterly, utterly evil."
"Why should I respect a capricious, mean-minded, stupid God who creates a world that is so full of injustice and pain. That's what I would say."

Christian Gollwitzer

unread,
May 13, 2020, 1:27:30 AM5/13/20
to
Am 11.05.20 um 22:25 schrieb Mr Flibble:
>     auto const explosionMaterial = ng::game::material
>     {
>         {}, {},
Wow. So simple. Why not add a few other braces here: {}, {}, {} ? Would
be even cooler!
>         ecs.shared_component<ng::game::texture>().populate("explosion",
> ng::to_ecs_component(ng::image{ ":/test/resources/explosion.png" }))
>     };
>     auto const explosionAnimation = ng::game::animation_filter
>     {
>
> ecs.shared_component<ng::game::animation>().populate("explosion",
> ng::game::regular_sprite_sheet_to_animation(explosionMaterial,
> ng::vec2u32{ 4u, 3u }, 0.1))
>     };
>     auto explosion = ecs.create_entity(archetypes::explosion,
> explosionMaterial, explosionAnimation);


IOW, to you it may seem simple, to me it is just gibberish. And the
nesting of different braces <({ sprinkled with names reminds me of LISP
code.

Christian

Bart

unread,
May 13, 2020, 6:47:59 AM5/13/20
to
Isn't this just normal C++ code? Just reams of auto, {}, <>, :: and
liberal sprinkling of 'const'.

Graphics programming like this really needs a clean scripting language.

Mr Flibble

unread,
May 13, 2020, 7:41:29 AM5/13/20
to
neoGFX will come with a scripting engine but I also provide the option to easily do stuff directly in C++.

Jorgen Grahn

unread,
May 13, 2020, 7:51:15 AM5/13/20
to
On Wed, 2020-05-13, Christian Gollwitzer wrote:
> Am 11.05.20 um 22:25 schrieb Mr Flibble:
>>     auto const explosionMaterial = ng::game::material
>>     {
>>         {}, {},
> Wow. So simple. Why not add a few other braces here: {}, {}, {} ? Would
> be even cooler!
>>         ecs.shared_component<ng::game::texture>().populate("explosion",
>> ng::to_ecs_component(ng::image{ ":/test/resources/explosion.png" }))
>>     };
>>     auto const explosionAnimation = ng::game::animation_filter
>>     {
>>
>> ecs.shared_component<ng::game::animation>().populate("explosion",
>> ng::game::regular_sprite_sheet_to_animation(explosionMaterial,
>> ng::vec2u32{ 4u, 3u }, 0.1))
>>     };
>>     auto explosion = ecs.create_entity(archetypes::explosion,
>> explosionMaterial, explosionAnimation);
>
>
> IOW, to you it may seem simple, to me it is just gibberish.

I guess C++ isn't for everyone.

/Jorgen

--
// Jorgen Grahn <grahn@ Oo o. . .
\X/ snipabacken.se> O o .

Mr Flibble

unread,
May 13, 2020, 12:29:23 PM5/13/20
to
On 13/05/2020 06:27, Christian Gollwitzer wrote:
That was an example of how clean using neoGFX is even before further functional decomposition; I have since added more helper functions so the equiavalent code is now:

auto const explosionAnimation = ng::regular_sprite_sheet_to_renderable_animation(ecs, "explosion", ":/test/resources/explosion.png", ng::vec2u32{ 4u, 4u }, 0.05);
auto const testExplosion = ecs.create_entity(archetypes::explosion, explosionAnimation.material, explosionAnimation.filter);

I suggest you stop being such an negative egregious cockwomble and/or learn to use C++ properly.

Bart

unread,
May 13, 2020, 1:04:16 PM5/13/20
to
Even this is too long-winded to grok in one glance. It is basically
doing something like this:

expAnim = rss2ra(ecs, "explosion", "expl.png", (4,4), 0.05)
testExp = create_entity(explosion, expAnim.material, expAnim.filter)


0 new messages