Forum Replies Created
-
AuthorPosts
-
I don’t see an issue with a very limited set of codecs (even just one) being supported, as long as those few codecs are available on all platforms. Any videos I want to include in a game I can easily convert to a format that is supported. I don’t see any mileage in you spending time trying to support a hundred different codecs when just one that works everywhere would be perfectly acceptable (and probably a lot easier to support and make 100% bug-free). We are (mostly) writing games, not multimedia apps. One rock-solid supported codec is way better than multiple flakey ones.
Do people have a preferred format? Is there any one format that is entirely free of patent issues? I would have thought Ogg Theora would fit the bill, wouldn’t it? Or have I read that there is a potential patent issue lurking round the corner? [edit : looks like no – http://en.swpat.org/wiki/Theora ]
I am far from expert with multimedia frameworks but you may want to look into gstreamer as a possible alternative. It is a higher-level module-based system which will be more complex to integrate, but more powerful and flexible in the longrun (it can use ffmpeg as a backend). It is (afaik) written in C (using GObjects for OO), so should be easy to port?
Documentation is here :
https://gstreamer.freedesktop.org/documentation/frequently-asked-questions/index.html
I have googled for gstreamer with SDL and not found any useful leads, although people do seem to be doing it.
Equally, ffmpeg is also very highly regarded at least in the Linux world. I would have no objection to either.
As for VLC, I have always found its playback quality to be not great (funny interlacing effects on some videos), however I believe their decoders are considered to be amongst the fastest out there.
Just out of interest, I have just checked which apps here in the Linux world use which libraries. ffmpeg and gstreamer are both required by a lot of packages. Of note, though, ffmpeg is the video library of choice for firefox, chromium (that’s chrome stripped of any licencing issues), mplayer and blender. GStreamer is used by handbrake (handbrake.fr), Totem (Gnome’s standard video player) and Shotwell. Based on that comparison, I’d say ffmpeg is probably a good way to go.
@immutableoctet thanks for the heads-up. How did you spot that commit so fast? I can’t see a way to get github to notify me of commits so either you were watching the repo like a hawk or you have Mark’s mobile number…?
@nerobot if we do find any bugs in ted2go (I’m sure there aren’t any!) or have feature requests, where should we post them?
Okay, I’ve rebuilt from scratch and get the same issue… but it does seem to be related to nerobot’s numlock issue.
With numlock on (this is the default setting for me) :
– the only function key that has any effect is F11, which opens a ‘parseinfo’ popup.
– Ctrl-Z, Ctrl-X, Ctrl-C and Ctrl-V work for undo, cut, copy and paste.
– Ctrl-A works for select all.
– Ctrl-O, Ctrl-S, Ctrl-N have no effect. All other key combinations I tried have no effect (I didn’t test them all).With numlock off, all keys appear to function as expected.
In all other software, these keyboard shortcuts and function keys are unaffected by the numlock state. And as far as I understand, this is the way it should be. Numlock should only affect numpad keys, shouldn’t it?
I didn’t have this problem before pulling the latest git commits a few days ago. Previous versions of Ted2Go/Monkey worked as expected with numlock on (I never turn it off so can’t say if there was the opposite issue before). What has changed?
I’m on a laptop (is that relevant?). I will try to replicate it on my desktop tomorrow (exactly the same OS etc).
Is there any useful testing I can do to help solve this? Not that it needs an urgent fix; I can live with having to toggle numlock, now that I know!
Well, if you two don’t know, what chance have the rest of us! I’ll try rebuilding everything in a clean folder this evening. Hopefully that will fix it.
Sorry, @Mark, I’m removing the super from my last comment, thus demoting you to ‘star’ until you get round to making this work when the Classes in question are in different source files (see below). Tested with a namespace declaration, too, with the same results. On the other hand, if you were to implement a dedicated Mixin/Traits syntax then I would have to promote you to ‘demigod’!
File test.monkey2 :
Monkey12345678910#Import "testmixin"Class ThingEnd ClassClass ThingList Extends TestMixin<Thing>End ClassFunction Main()End FunctionFile testmixin.monkey2 :
Monkey1234567Class TestMixin<T> Extends TPublicMethod New()End MethodEnd ClassCompilation error :
Mx2cc version 1.1.02
***** Building app ‘/home/arpie/Projects/BiaB/MazeM2/test.monkey2’ *****
Parsing…
Semanting…
Translating…
Compiling…
Build error: System command ‘g++ -I”/home/arpie/Coding/Monkey/Monkey2/modules/” -I”/home/arpie/Coding/Monkey/Monkey2/modules/monkey/native” -I”/home/arpie/Projects/BiaB/MazeM2/” -std=c++11 -c -o “/home/arpie/Projects/BiaB/MazeM2/test.buildv1.1.02/linux_debug/build/_1src_2test_0testmixin.cpp.o” “/home/arpie/Projects/BiaB/MazeM2/test.buildv1.1.02/linux_debug/src/test_testmixin.cpp”‘ failed.g++ -I”/home/arpie/Coding/Monkey/Monkey2/modules/” -I”/home/arpie/Coding/Monkey/Monkey2/modules/monkey/native” -I”/home/arpie/Projects/BiaB/MazeM2/” -std=c++11 -c -o “/home/arpie/Projects/BiaB/MazeM2/test.buildv1.1.02/linux_debug/build/_1src_2test_0testmixin.cpp.o” “/home/arpie/Projects/BiaB/MazeM2/test.buildv1.1.02/linux_debug/src/test_testmixin.cpp”
In file included from /home/arpie/Projects/BiaB/MazeM2/test.buildv1.1.02/linux_debug/src/../include/test_testmixin.h:12:0,
from /home/arpie/Projects/BiaB/MazeM2/test.buildv1.1.02/linux_debug/src/test_testmixin.cpp:2:
/home/arpie/Projects/BiaB/MazeM2/test.buildv1.1.02/linux_debug/src/../include/test_test.h:40:37: error: invalid use of incomplete type ‘struct t_default_TestMixin_1Tt_default_Thing_2’
struct t_default_ThingList : public t_default_TestMixin_1Tt_default_Thing_2{
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /home/arpie/Projects/BiaB/MazeM2/test.buildv1.1.02/linux_debug/src/test_testmixin.cpp:2:0:
/home/arpie/Projects/BiaB/MazeM2/test.buildv1.1.02/linux_debug/src/../include/test_testmixin.h:7:8: note: forward declaration of ‘struct t_default_TestMixin_1Tt_default_Thing_2’
struct t_default_TestMixin_1Tt_default_Thing_2;
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
***** Fatal mx2cc error *****Internal mx2cc build error
Woohoo! Mark, you are a superstar.
It looks like that solution for you is using
Class Container<I> Where I Implements IWidget
So you can add any widget into container (they all implement IWidget), and you also can add frames into container (it implements IWidget too).
That’s not really the same thing. In a way it’s the opposite of what I am trying to achieve. I want the Container class to be as generic and reusable as possible. What I am trying to avoid is having to re-implement the Container interface in the Frame class. I want to inherit the implementations (not just the interfaces) of Widget and Container into one Frame class. I don’t want a Container into which I can put Frames and Widgets. I want a Frame that IS a container (into which I can put Frames, Widgets, etc…)
Of course, I could achieve what I want by avoiding the Container class completely – just implement the IContainer interface in the Frame class but…
I also want to be able to reuse the Container class/mixin elsewhere, for example, for a Phrase composite that can contain Word components (or other Phrases). Or a Task class that can be extended into a Project container, allowing a heirarchy of Projects, Subprojects and Tasks….. all using the same Container Mixin to implement a generic heirarchy of objects.
Your suggestions help to enforce the relationship between the interfaces but they don’t avoid the problem of having to rewrite the implementations of those interfaces in many places. I hate having to rewrite the same code twice!
The ideal solution to all this would be for Mark to implement Mixins (or Traits, or whatever you want to call them).
Where is Where documented?
I don’t use T directly inside Container, no, but used as I have, it allows me to turn any class into a Container without having to rewrite the Container methods. It allows me to use Container as a mixin with any other class. The key point is that in my example Frame extends both Container and Widget – it inherits all methods from both classes. I guess you could call it multiple inheritance but that has a bad reputation so it’s a term I prefer to avoid.
Here is a Monkey1 implementation of the ‘composte‘ pattern (commonly used for GUI widgets, amongst other things). The classes here have a bare minimum of functionality – the Container class needs Remove(), Sort(), etc… and the Widget() probably wants some coordinates, size, etc. but that’s not the point. What I am trying to demonstrate is that the Container Class is basically a mixin and can turn any class into a container for itself (it turns a component into a composite). I could have missed out the Interface but I think it adds to the usefulness of the concept by not forcing components to inherit from the Widget class.
I haven’t yet used this in any real apps so I may have missed some fundamental issue that renders it useless… let me know if you spot something!
Monkey123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869StrictInterface IWidgetMethod Render:Void()End InterfaceClass Widget Implements IWidgetField _id:StringMethod Render:Void() AbstractEnd ClassClass Container<T, I> Extends TField _items := New Stack<I>()Method Add:Void(item:I)_items.Push(item)End MethodMethod ObjectEnumerator:stack.Enumerator<I>()Return _items.ObjectEnumerator()End MethodEnd ClassClass Frame Extends Container<Widget, IWidget> Implements IWidgetMethod New(id:String)_id = idEnd MethodMethod Render:Void()Print("Frame " + _id + " contains :")For Local w:IWidget = Eachin Selfw.Render()NextEnd MethodEnd ClassClass Button Extends WidgetMethod New(id:String)_id = idEnd MethodMethod Render:Void()Print("A Button with id " + _id)End MethodEnd ClassFunction Main:Int()Local frame := New Frame("F1")Local frame2 := New Frame("F2")'Put some button widgets into a frame widgetframe.Add(New Button("B1"))frame.Add(New Button("B2"))frame.Add(New Button("B3"))frame.Add(New Button("B4"))'Render the frameframe.Render()'Now, since the Frame class indirectly extends the Widget class (through the'use of the Container generic), we can also treat the frame as a widget and'place it inside a second frame.frame2.Add(frame)'And render it allframe2.Render()Return TrueEndI’ll try to put together a trivial example. While you’re waiting, could I ask you to explain what you mean in your last sentence? As far as I can see, ‘Where’ isn’t a keyword in Monkey1 or 2. What do you mean by refine T?
Finally, here are some results on a 2-year-old lenovo yoga B8000 android tablet. Not sure why the last line is missing.
Monkey1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859Initialising test using 100 array members. Please wait...Testing rate of linear access of all array members.Linear ClassArray1 access took 124msLinear ClassArray2 access took 129msLinear ClassArray3 access took 110msLinear StructArray access took 91msTesting rate of random access of array members.Random ClassArray1 access took 118msRandom ClassArray2 access took 140msRandom ClassArray3 access took 111msRandom StructArray access took 84msInitialising test using 1000 array members. Please wait...Testing rate of linear access of all array members.Linear ClassArray1 access took 122msLinear ClassArray2 access took 322msLinear ClassArray3 access took 180msLinear StructArray access took 86msTesting rate of random access of array members.Random ClassArray1 access took 129msRandom ClassArray2 access took 262msRandom ClassArray3 access took 181msRandom StructArray access took 86msInitialising test using 9999 array members. Please wait...Testing rate of linear access of all array members.Linear ClassArray1 access took 240msLinear ClassArray2 access took 1452msLinear ClassArray3 access took 388msLinear StructArray access took 94msTesting rate of random access of array members.Random ClassArray1 access took 359msRandom ClassArray2 access took 537msRandom ClassArray3 access took 365msRandom StructArray access took 121msInitialising test using 100000 array members. Please wait...Testing rate of linear access of all array members.Linear ClassArray1 access took 495msLinear ClassArray2 access took 1753msLinear ClassArray3 access took 1522msLinear StructArray access took 144msTesting rate of random access of array members.Random ClassArray1 access took 2166msRandom ClassArray2 access took 2673msRandom ClassArray3 access took 2533msRandom StructArray access took 285msInitialising test using 999999 array members. Please wait...Testing rate of linear access of all array members.Linear ClassArray1 access took 736msLinear ClassArray2 access took 1974msLinear ClassArray3 access took 1981msLinear StructArray access took 284msTesting rate of random access of array members.Random ClassArray1 access took 3813msRandom ClassArray2 access took 3969msRandom ClassArray3 access took 4201msAnd on my Sony Xperia D5803 running Android 6.0.1 the results aren’t too shabby either :
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859Initialising test using 100 array members. Please wait...Testing rate of linear access of all array members.Linear ClassArray1 access took 74msLinear ClassArray2 access took 67msLinear ClassArray3 access took 50msLinear StructArray access took 38msTesting rate of random access of array members.Random ClassArray1 access took 69msRandom ClassArray2 access took 74msRandom ClassArray3 access took 47msRandom StructArray access took 27msInitialising test using 1000 array members. Please wait...Testing rate of linear access of all array members.Linear ClassArray1 access took 106msLinear ClassArray2 access took 320msLinear ClassArray3 access took 105msLinear StructArray access took 38msTesting rate of random access of array members.Random ClassArray1 access took 99msRandom ClassArray2 access took 351msRandom ClassArray3 access took 102msRandom StructArray access took 28msInitialising test using 10000 array members. Please wait...Testing rate of linear access of all array members.Linear ClassArray1 access took 85msLinear ClassArray2 access took 418msLinear ClassArray3 access took 121msLinear StructArray access took 50msTesting rate of random access of array members.Random ClassArray1 access took 260msRandom ClassArray2 access took 673msRandom ClassArray3 access took 232msRandom StructArray access took 108msInitialising test using 100000 array members. Please wait...Testing rate of linear access of all array members.Linear ClassArray1 access took 166msLinear ClassArray2 access took 746msLinear ClassArray3 access took 603msLinear StructArray access took 51msTesting rate of random access of array members.Random ClassArray1 access took 983msRandom ClassArray2 access took 1218msRandom ClassArray3 access took 1257msRandom StructArray access took 154msInitialising test using 1000000 array members. Please wait...Testing rate of linear access of all array members.Linear ClassArray1 access took 295msLinear ClassArray2 access took 832msLinear ClassArray3 access took 819msLinear StructArray access took 57msTesting rate of random access of array members.Random ClassArray1 access took 1886msRandom ClassArray2 access took 1923msRandom ClassArray3 access took 1964msRandom StructArray access took 688msMark, would you mind quickly clarifying why this would be very unsafe? Is it for the usual reasons that pointers are unsafe or is there something more dangerous about Varptr and Ptr in Monkey?
Woah, somone’s actually *using* the android target?!?
Isn’t that why you made it? Am I the only one?
New build of openal.so is up now. …does it work?
I thought no, then I tried again and it looks like yes. Android Studio is the most unintuitive piece of cr#p software I’ve ever seen and it seems to intentionally screw up its own automaticly generated Gradle configuration files just for fun, in a different way every time I run it.
But basically, I think it is working.
Have I understood correctly that it was only openal.so that needed the targetSdkVersion etc. set to 19 and I can use a later version number (currently 24) to build my project? That is what I think I’ve done with lightsparks and it is now happily running on my Android 4.4.2 tablet.
In case it is of any interest, I also tried rebuilding all modules using CrystaX NDK. It adds an extra library to the project (libcrystax.so), and also works perfectly on all my devices. It claims a number of advantages over the Google NDK : it allows Boost libraries to be used, provides better locale support and wide character support, and apparently irons out all differences between different Android versions… see https://www.crystax.net/en/android/ndk for a more indepth comparison (it will probably be more meaningful to you than to me!). The .so file weighs in at only 574k here, which seems pretty lightweight to me considering all its advantages. (Just to be clear; I have no affiliation of any sort with the CrystaX project and had never heard of it until a few days ago)
Anyway, thanks for your help again. Sorry this reply was slow coming.
-
AuthorPosts