-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Quitting with ESC key #4
Comments
Just for completeness, I have attached a tar ball (test_case.tar.gz) with a test case in In comment there is the command line used for the build. The compiler is |
I wonder if a library as In this page Interoperability of derived types, under point 4, and (here) one can read: No Fortran type is interoperable with a Maybe, for confirmation, we need to ask Fortran people... BTW, just found this discussion. |
The following code lets you quit the game with the Escape key:
Yes, the Fortran standard does not define any unions. But you can use |
@interkosmos wrote:
Hmm... if
WHY then
prints always I tried also
but does not work, prints always 768.. |
@interkosmos wrote:
Who is Just for completeness, compiling with the
I think
|
OK, I think the code you propose for quitting should be
Notice,
an association not an assignement:
This change suppress also the warning:
|
Sorry for the incomplete example. The complete one:
The issue with |
I’m still looking for the reason why |
@interkosmos, last you code still gives warnings when compiled with
Maybe I am wrong, but I think my proposal
is the right... (See this at section 11.9) Any way, may you elaborate about this OOps, just seen your answer, thanks. |
Yes, I go d’accord with you. Your proposal seems to be better. See #4 (comment), I’m still clueless. |
After last change I had to change this code:
in
The new code build without warnings but does not work, typing Are you sure that in `sdl2_aliases' (why another module and not using the existing sdl2_consts?)
is the right thing? If I remember rightly, Fortran for In other words, Just this
fixes the issue, and maybe also |
Thank you very much for all the hints. They have been committed. |
Sorry but there are still some issue. From the SDL2 Wiki:
but now I find in your code:
which causes
If I remember, the previous implementation didn't use the wrapper and maybe it was better. I think the best should be not to use the wrapper
I understand you intent (avoid the explicit conversion by the user), but sometime it would be better to reduce the |
But how do you want to store an integer like 255 in Without a wrapper function, the programmer always has to do the type conversion manually. Boy, that would be annoying. |
@interkosmos wrote:
Have you tried? Why it worked in your previous implementation? In my test case I have color defined with BTW, I interfaced (most) Windows itself this way without issue.. I think it is how ISO C BINDING works. Maybe we have to ask Fortran people...
No No.. It is not annoying if you can save the cost of calling function, subroutine... Instead that code not only has the cost of conversion ( And... hem hem with last your commit there is this failure:
|
Please see the following example:
IMHO the correct type is therefore |
Also this work (a solution adopted in 2006 interfacing for the first time BGI aka WinBGIm v. 3):
What I don't like is that c_int16_t is 2 byte while in the original C routine the data passed is 1 byte... The C routine takes only the firs byte of it, but I wonder if this is the main street to adopt for this kind of data. I have asked to Fortran people. Anyway now your example builds fine.. thanks. |
The first assignment in this chapter is easy: create a program with a main function and a separate subfunction called hello, which when called prints "Hello there!". The subfunction does not take any parameters or return any value, just prints the line. Then, to the main function, add a call to the subfunction and two print commands, the first one before the call which says "Lets call the subfunction:", and one after the subfunction call, a print command which prints "Quitting.". If implemented correctly, the program will print the following: |
I tried to write a function to quit an SDL2 Fortran app with
ESC
key beside the usual quitting,but it does not work for
ESC
key: thePRINT
statement prints always0
(zero
) regardless of the character pressed, soquit()
is.true.
only when one clicks the upper rightX
button.I suspect a bug here...
The text was updated successfully, but these errors were encountered: