Linking programs to other ones
BlitzMax Forums/BlitzMax Beginners Area/Linking programs to other ones
| ||
Ok, I've looked over Include, Incbin, and couple other similar functions and am uncertain whether or not I could put multiple programs into one. I have a menu example (which I found on this site) which I'm thinking could put multiple programs into. Menu: So could I just put a Goto function in there to go and start the program if the user clicks enter or is there some other way this is accomplished. |
| ||
I'm not sure what you want to do. Start another compiled program, like .exe? Then you could use openurl "nameoffile.exe" But linking compiled programs together is not possible with Blitzmax (except mods). You can split your sourcode over several files -> include. Incbin is just for including binary files. With goto you can just jump to a point in your sourcecode, not to a point in a compiled file. I would avoid goto as far as possible for the beginning. Use functions and methods instead of goto. |
| ||
Well do you know when you build a .bmx file/code? I want a program to include different .bmx files and when you click on one, that one is loaded. I would maybe include it in the menu example up above, (I don't know how to though...) |
| ||
Quick bit of p-code:-Include "game1.bmx" Include "game2.bmx" include "game3.bmx" local gameType:int = 2 select gameType case 1 PlayGameOne() 'Located in the game1.bmx file case 2 PlayGameTwo() 'located in the game2.bmx file case 3 PlayGameThree() ;located in the game3.bmx file end select Dabz |
| ||
Ok, but do you need Local gameType:int = 2 Do you need the = 2 part And also this part select gameType case 1 PlayGameOne() 'Located in the game1.bmx file case 2 PlayGameTwo() 'located in the game2.bmx file case 3 PlayGameThree() ;located in the game3.bmx file end select PlayGameOne() isn't a function. |
| ||
i think that you were supposed to create the functions yourself, and he was just giving you an outline. notice how he said: PlayGameOne() 'Located in the game1.bmx file you are to have that function as the first game which you included as your other .bmx sourcecode files. |
| ||
Oh, so in my first .bmx file I would have the function named "PlayGameOne()" in the game loop, so when I call it, it plays that game. Gotcha! |
| ||
Zacho - basicly what the compiler does when you put include "yourfile.bmx" is its is copy and pasting that entire file you included right where the include line is. Now do you get it? |
| ||
Ya, I guess so |