Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - Hemlos

#1
This is for win32 only.
You can control most of the aspects of a windows message box with these defined flags.
I included the return code definitions too.  :rtfm:

Notes:
A) The help button doesn't return anything in GLBasic.
B) You can use your own icon, however, i'm not sure how to define it.

Code (glbasic) Select
// --------------------------------- //
// Project: MessageBoxA function (winuser.h) - win32
// Start: Wednesday, June 14, 2023
// IDE Version: 15.238
// Coded by: Neil Silver AKA Hemlos
//
// ----------------------
//
// Resource:
// https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-messageboxa
//
//  Displays a modal dialog box that contains a system icon,
//  a set of buttons, and a brief application-specific message,
//  such as status or error information.
//  The message box returns an integer value that indicates which button the user clicked.
//
// ----------------------
//
// Note:
// There is an L (long) appended at the end of each code constant on this webpage.
// Omitting L gets it working in GLBasic. :D
//
// ----------------------
//
// Note:
// On the webpage example, you will notice the '|' indicator between the flag codes.
// This is a concatenation in C++
// In GLBasic use '+' to concatenate the flags, see example below.
//
// ----------------------
//
// Note:
// The dialog can disappear behind the main program window if you do not specify modality.
// All modalities require the dialog be responded to in order for the program to continue.
// Append MB_TASKMODAL or MB_SYSTEMMODAL or MB_TOPMOST to the flags to prevent this dialog from losing focus.
//
// ----------------------
//
// Example:
//
//    LOCAL Title$ = "Test Title"
//    LOCAL Body$  = "Test Body"
//    LOCAL Flags% = MB_ICONEXCLAMATION + MB_CANCELTRYCONTINUE + MB_DEFBUTTON2 + MB_TASKMODAL
//    LOCAL MessageOutput% = MessageBoxA(0, Body$, Title$, Flags )
//
//    SELECT MessageOutput%
//        CASE IDABORT; // Add code
//        CASE IDCANCEL;; // Add code
//        CASE IDCONTINUE;; // Add code
//        CASE IDIGNORE;; // Add code
//        CASE IDNO;; // Add code
//        CASE IDOK;; // Add code
//        CASE IDRETRY;; // Add code
//        CASE IDTRYAGAIN;; // Add code
//        CASE IDABORT;; // Add code
//        DEFAULT; // 0 = IDFAILED
//    ENDSELECT

    // ====================================================== //
    // MessageBoxA function (winuser.h) - win32
    IMPORT "C" int __stdcall MessageBoxA(int hwnd, const char* text, char* caption, int flags );
   
    // To indicate the buttons displayed in the message box, specify one of the following values.
    CONSTANT MB_ABORTRETRYIGNORE     = 0x00000002
    CONSTANT MB_CANCELTRYCONTINUE    = 0x00000006
    CONSTANT MB_HELP                 = 0x00004000 // This button doesn't seem to work in GLBasic, it shows, yet no return.
    CONSTANT MB_OK                   = 0x00000000
    CONSTANT MB_OKCANCEL             = 0x00000001
    CONSTANT MB_RETRYCANCEL          = 0x00000005
    CONSTANT MB_YESNO                = 0x00000004
    CONSTANT MB_YESNOCANCEL          = 0x00000003

    // To display an icon in the message box, specify one of the following values.
    CONSTANT MB_ICONEXCLAMATION      = 0x00000030 //  /!\
    CONSTANT MB_ICONINFORMATION      = 0x00000040 //  (i)
    CONSTANT MB_ICONQUESTION         = 0x00000020 //  (?)
    CONSTANT MB_ICONSTOP             = 0x00000010 //  (X)
    CONSTANT MB_USERICON             = 0x00000080 // user icon, unused
   
    // To indicate the default button, specify one of the following values.
    CONSTANT MB_DEFBUTTON1           = 0x00000000
    CONSTANT MB_DEFBUTTON2           = 0x00000100
    CONSTANT MB_DEFBUTTON3           = 0x00000200
    CONSTANT MB_DEFBUTTON4           = 0x00000300
   
    // To indicate the modality of the dialog box, specify one of the following values.
    CONSTANT MB_APPLMODAL            = 0x00000000
    CONSTANT MB_SYSTEMMODAL          = 0x00001000
    CONSTANT MB_TASKMODAL            = 0x00002000
   
    // To specify other options, use one or more of the following values.
    CONSTANT MB_DEFAULT_DESKTOP_ONLY = 0x00020000
    CONSTANT MB_RIGHT                = 0x00080000
    CONSTANT MB_RTLREADING           = 0x00100000
    CONSTANT MB_SETFOREGROUND        = 0x00010000
    CONSTANT MB_TOPMOST              = 0x00040000

    //Return:
    CONSTANT IDFAILED   = 0    // Function Failed
    CONSTANT IDABORT    = 3    // The Abort button was selected.
    CONSTANT IDCANCEL   = 2    // The Cancel button was selected.
    CONSTANT IDCONTINUE = 11   // The CONTINUE button was selected.
    CONSTANT IDIGNORE   = 5    // The Ignore button was selected.
    CONSTANT IDNO       = 7    // The No button was selected.
    CONSTANT IDOK       = 1    // The OK button was selected.
    CONSTANT IDRETRY    = 4    // The Retry button was selected.
    CONSTANT IDTRYAGAIN = 10   // The TRY Again button was selected.
    CONSTANT IDYES      = 6    // The YES button was selected..
    CONSTANT IDHELP     = 9    // Help Button pushed. Not GLBasic. \o/

#2
Tutorials / Re: Chat.GPT
2023-Jun-11
Chatgpt is my buddy  :booze:

Note, it even gave example  :nw:
Me to ChatGPT:
QuoteI need a math formula, GLBasic TYPE coding, planet orbit physics, for finding the Orbital Semi-Major Axis.


Code (glbasic) Select
TYPE Orbit
    average_distance%  // Average distance between the planet and its central body
    eccentricity%     // Eccentricity of the orbit

    FUNCTION CalculateSemiMajorAxis: ()
        LOCAL semi_major_axis
        semi_major_axis = (2 * average_distance%) / (1 - POW(eccentricity%, 2))
        RETURN semi_major_axis
    ENDFUNCTION
ENDTYPE

// Usage example
GLOBAL Orbit AS Orbit
Orbit.average_distance = 10  // Example value for average_distance
Orbit.eccentricity = 0.5    // Example value for eccentricity

LOCAL semi_major_axis
semi_major_axis = Orbit.CalculateSemiMajorAxis()
PRINT "Semi-Major Axis: " + semi_major_axis


This is wrong, FUNCTION CalculateSemiMajorAxis: ()
But ill let it slide by this time.

#3
Bug Reports / X_PRINT
2023-May-21
QuoteX_PRINT text#$, x#, y#, z#, scale#, kerning%=FALSE

"Gravity2023.gbas"(754) error : GPC0006 wrong number of aguments : "X_PRINT" called with 6 args. Required: 5 to 5
#4
Activision games were fun!
When i was in middle school, the kid that lived at the end of the block had one.
It was the first machine i ever played a game on, with a TV.
Bravo, nice project!




#5
how did you do it?

i think i have this.
do you need the beziers library?
#6
 :booze:
#7
Quote from: hardyx on 2021-Jun-30
WOW, you simulator is amazing!! Your work is enormous and very useful to study the gravity in the Universe.
Thanks for the good work and long life to GLBasic.  :booze:

Thank you, i'm glad you like it and find it useful.
Yes, it can be used to study motion of objects in space.
At its core, it is using this formula from Newton: F = GMm / R2
#8
Thanks Snoop, i appreciate that, i worked on this for a long time.
I updated it today, there was a few wonky things i needed to iron out.
#9
Thanks Qedo!

As time progresses, planets merge, and less is rendered, thus increasing the fps.
Eventually it reaches 60 fps.
#10
Galactic Formation Simulator 2021, inspired by Sir Isaac Newton.
Version 2.10418a (April 18,2021)

This is the entire library. Just compile and run, Enjoy!

If you have questions, ill answer them here.
I do not plan on doing many updates, yet, i will do one once in a while.
Feel free to use the SVS library and Galactic Formation Simulator application in any way you see fit.
- Neil



--------------------------------
Screenshots:

No star in this one, just matter in a circular field crashing and starting a planet / moon system.
https://siasky.net/fANKk3t6ag14HbuBE1ufPwILQnXfm3O_ZGPVa4T5KOubow

This shot shows gravitational fields from the largest objects, and has vector direction.
https://siasky.net/fAJpyrh8ulsa9nFUCguPWXLmu_KEx0LatZGwg0daIrD-PQ

This shot shows the gravity fields of the ring simulation:
https://siasky.net/_AxFaA4W0WQvHdwyh9yAQisewq_Lg-As9HTshDtieI1rjw
Note: the lines represent only nearby actors, all objects affect all other objects motion, especially the star.

The 2 arm simulation, with gravity fields:
https://siasky.net/fAMzZPelCERvZokYgSHjMxpv_DNUU6tvc3tH6r98ElUNEg

This is a saturn-like ring formation simulation, it ends with a handful of stable planets possibly with moons:
https://siasky.net/fAR3iWQLQILwPZJjVG7aCdpzlw1YPWSXLQtDO2qpmqVMmg

--------------------------------
DOWNLOADS:

Download from Google Drive :
https://drive.google.com/file/d/1tTTwZmQuEcUuln2PLTPhuUmHH3xQtY4I/view?usp=sharing

Download from SIA Skynet :
https://siasky.net/AAB8DBMu1cNgXAii3u9GUOMOPyuGh8wkcp7YOHWkZv7T4g

#11
 :giveup:
#12
strange those all seem to be there for me.
if you have issue within a thread please post it there, so the author can see it, thanks.
#13
I updated and tested this on win7 ide15.238 successfully.
Updated attachment is in the first message at the top of this thread.
#14
SnooPI your attachment is dead (corrupted)
This subject is solved.
Locking.
#15
GLBasic has had a server change in the past.
Resulting from the server switch, many attachments across the forums are dead linked.
Most of the dead attachments are still relevant, as most are working samples, algorithms, and/or libraries.

Speaking for myself here, I will update any attachments that are dead links.
I will try to update all of them as I come across them, and as they're reported dead.

If you come across dead links, please report them within the thread that they are found, for these forum threads are linked to the creators emails.