|
Post by bigbass on Nov 9, 2017 16:21:29 GMT 1
Hey vovchik
I want to confirm again that your code compiles and runs correctly but had given a warning when using 64 bit
It seems that by changing these three lines it compiles cleanly no warning however only you could verify if all the code does work correctly on 32 bit also note the extra long cast and int changed to long
DEF FN CALLBACKX(arg1,arg2,arg3)= arg1->callback(arg2, (void*)(long) arg3)
CALLBACKX(words, SCORE_WORD_CB, (void*)(long)i)
widx = (long)iddx
P.S just a hack but I will wait for Peter to solve the why or do it a better way (or the correct way)when using 64 bits
Joe
|
|
|
Post by vovchik on Nov 9, 2017 16:34:42 GMT 1
Dear Joe, Thanks a million. I figured you would come up with the fix. It also works perfectly in 32-bit. Only the words var needs to be words[i] in the CALLBACKX line. I'm glad we now have a clean compile. I have posted the version with your fix in the earlier post with the sources. With kind regards, vovchik
|
|
|
Post by Pjot on Nov 9, 2017 19:32:40 GMT 1
Hi all, The CALLBACKX is created as an alias to the widget->callback method. This method takes a 'long' type as a second argument. The problem now is that 'long' type needs 4 bytes in 32 bit environments, but 8 bytes in 64bit environments. That is why there is a difference in compile results. As the g++ compiler seems to be very picky when the casting is not correct, the error pops up. The solution shown by Joe works fine, and I would expect it works in 32bit also. Unfortunately, the g++ compiler seems to require to such strict casting for correct compilation. I had to implement similar changes in the BaCon source code in order to let it compile by g++ correctly. Best regards Peter
|
|
|
Post by vovchik on Nov 9, 2017 21:47:44 GMT 1
Dear Peter,
Thanks for the explanation. Joe's fix also works for me in 32-bit Mint. Is it fine the way it is, since it seems to work in 32 and 64-bit systems, or would you code it a bit differently in my little app?
With kind regards, vovchik
|
|
|
Post by bigbass on Nov 10, 2017 19:09:49 GMT 1
Hello Guys
On the very first page of this thread Jul 26, 2017 at 9:06pm vovchik you did a slider demo
I tried to compile it and had this error
' line 84:
s[i]->callback(SLIDER, (void*) i)
Cause: cast from 'void*' to 'int' loses precision [-fpermissive]
line 54:
myidx = (int)idx
Cause: cast from 'void*' to 'int' loses precision [-fpermissive]
I went back to walk over the examples and now it works with this small change because all this fltk code is very interesting and I can see how many things you can do with it !
line 84:
s->callback(SLIDER, (void*)(long) i)
line 54:
myidx = (long)idx
P.S vovchik thanks for all your cool stuff in this thread *and everywhere else these very small compiler things can all be fixed its still very new /experimental using g++ plus having to make 32bit and 64bit code compatible is an extra challenge
I am very happy you are taking the challenge to port and code fltk widgets and games for bacon
Joe
|
|
|
Post by vovchik on Nov 10, 2017 21:32:34 GMT 1
Dear Joe, Thanks for that universal CALLBACKX fix. It works on my 32-bit machine just fine, too. Does my little scrabble game play OK? It is not so easy to get a score higher than 50 using the English dictionary. I have tried. With kind regards, vovchik
|
|
|
Post by Pjot on Nov 11, 2017 13:04:40 GMT 1
Is it fine the way it is, since it seems to work in 32 and 64-bit systems, or would you code it a bit differently in my little app? I think it is fine like this. The explicit casting may look ugly, but I have no better idea to make it work properly with the g++ compiler. BR Peter
|
|
|
Post by alexfish on Nov 11, 2017 21:30:54 GMT 1
would this something like this help
#define GCALLBACK (long)idx or #define GCALLBACK (void*)(long)
CALLBACK(button, GCALLBACK test_but, blagh,blagh)
Ahh, just had another look
Vovchik , can u post the actual code of the function been called
BR Alex
|
|
|
Post by vovchik on Nov 11, 2017 21:45:02 GMT 1
Dear Alex, Thanks. Your solution does produce nicer looking code. I will try it now. The function is in the bac file in this archive: ftklk-issThere is a DEF FN for CALLBACKX and the CALLBACKX invocation is towards the end of SUB MK_GUI. With kind regards, vovchik PS. fltk-iss works nicely on my RPI3.
|
|
|
Post by vovchik on Dec 5, 2017 22:17:07 GMT 1
Dear all, Here is a new and improved version of my instant solo scrabble program. Most of the changes are cosmetic, but I have added a text edit widget to enable modification of word lists. Please let me know hoiw it works on your platform. Unarchive the source and compile and then unpack the dicts archive within the source folder (the wordlists should be in the dict dir. Thanks. With kind regards, vovchik UPDATED: Added dynamic full filespec so dictionaries get found if there is a dict folder containing the word lists in the same dir as the executable. Thanks to Peter. Attachments:dict.tar.gz (1004.23 KB)
fltk-iss-edit-src.tar.gz (109.49 KB)
|
|
|
Post by Pjot on Dec 6, 2017 9:05:39 GMT 1
Thanks vovchik, Nice idea and very well worked out, all compiles without a single problem on my Mint 64bit. Your graphics are stunning as usual, you did a smart job with those nifty SVG code definitions Some remarks: - the program could not find the dictionary file(s) when executed from the BaCon GUI or from a different working directory. This is not necessarily a problem in your program, I ran into this issue myself several times as well. I will add a function like a "ME$" which simply will return the location on the disk of the current program. - the dictionary file for Dutch lacks quite a few (short) words, commonly used in crossword puzzles (not your fault either).... A very nice game and the graphics are candy to the eyes! Thanks, Peter
|
|
|
Post by vovchik on Dec 6, 2017 14:03:33 GMT 1
Dear Peter, Thanks. Now that I have the mechanics of the program in place I can go look for better dictionaries. For languages with declension and complicated conjugation (Slavics, Latin, Greek etc.), I need "lemmatized" lists, so all forms of a word are accepted as valid. In the case of Dutch, I also need to find something more solid and complete. Some of those lists are proprietary and the shrewd compilers want you to pay, so I am searching for open source solutions that might already be in some word games posted, for example, on github or sourceforge. Any pointers will be appreciated. And you are right about the need to fix the game's executable location in the code itself, so that the dictionaries can always be found. I will use ME$ as soon as you implement it but could grab $PWD or DIRNAME$(REALPATH$(argv[0])) in the meantime. With kind regards, vovchik PS. I see that you've already implemented ME$. That was fast. Thanks!
|
|
|
Post by bigbass on Dec 6, 2017 15:58:28 GMT 1
Hey vovchik
It is amazing when you mix creativity with fltk and bacon you can produce anything you set out to do and have excellent results!
All these types of games are a showcase and a motivation well ,I will speak for myself after I saw all that could be done with fltk I wanted to get in on it too and continue as my usual making simple widget demos
but I believe with fluid/fltk and bacon I may have a go with some thing more challenging for fun
Joe
|
|
|
Post by Pjot on Dec 6, 2017 18:40:12 GMT 1
PS. I see that you've already implemented ME$. That was fast. Thanks! Yes, it is in there now. To execute from one of the GUI's, also define the TEMP directory in the GUI as '.' or leave the field empty altogether. For the Dutch language list, you can use the OpenTaal list (OpenTaal = Open Language) which comes in either BSD or Creative Commons license. Regards Peter
|
|
|
Post by vovchik on Dec 6, 2017 19:05:26 GMT 1
Dear Peter, Thanks. I got the OpenTaal list and will have to massage it a bit - since our limit is 7 letters per word, so it will shrink considerably (and we will lose my favourite word: arbeidsongeschiktheidsverzekeringsmaatschappij). . In Dutch, the apostrophe seems essential, but it is not in the tile list I got from Wikipedia. Do you think that is OK? Apparently, the Dutch Scrabble version does not include the apostrophe. With kind regards, vovchik
|
|