08 January 2021, 16:02 | #1 |
Registered User
Join Date: May 2001
Location: ?
Posts: 19,645
|
Including graphics?
Forgive me for i am a complete and total blitz 2 neophyte, and I have been reading through the manual (though not entirely, who does that? :P), but I couldn't find a way to include my graphic assets into the code.
I don't want the program to load graphic files externally at runtime, I want to do what on other languages would be like an "incbin" so the graphic assets are compiled into the executable. Is this possible? I read references in these forums to INCLUDE, it is in the index page of this site: http://docs.amiblitz.de/blitzprogrammers/0001.html ,but I really cannot see how it works in the manual. |
08 January 2021, 16:05 | #2 |
move.l #$c0ff33,throat
Join Date: Dec 2005
Location: Berlin/Joymoney
Posts: 6,863
|
I think Blitz Basic 2 supports "INCBIN" which can be used to include any binary files. I may be wrong though.
|
08 January 2021, 16:35 | #3 | |
Registered User
Join Date: May 2001
Location: ?
Posts: 19,645
|
Quote:
Blitz seems to have two commands, INCLUDE and XINCLUDE, according to the index of that manual I linked to above, that I am *guessing* would do what I want, but I can't find where they are mentioned because the index does not link to the rest of the manual, just has page numbers (but the online manual has no page numbers :/) |
|
08 January 2021, 16:42 | #4 |
move.l #$c0ff33,throat
Join Date: Dec 2005
Location: Berlin/Joymoney
Posts: 6,863
|
INCBIN is a native BB2 directive if memory serves me right. INCLUDE is for including sources (i.e. text files), XINCLUDE can be used to include a file only one (exlusive).
|
08 January 2021, 16:44 | #5 | |
Registered User
Join Date: May 2001
Location: ?
Posts: 19,645
|
Quote:
http://docs.amiblitz.de/blitzprogrammers/0154.html Thanks a lot, I feel like a right twat for not finding this before. I guess I needed some hand holding. I guess my trouble now is figuring out where this is put and how to access it. Maybe it's not worth the trouble but I rather produce a single executable to be distributed than a bunch of files. |
|
08 January 2021, 18:13 | #6 |
Registered User
Join Date: Sep 2007
Location: Stockholm
Posts: 4,334
|
You can make use of the INCBINed assets using the Decode range of commands, pointing them at a label at the line where you INCBIN a given asset using ?label.
|
08 January 2021, 19:54 | #7 | |
Jackie Chan
Join Date: Mar 2012
Location: Ireland
Age: 46
Posts: 986
|
Quote:
|
|
09 January 2021, 06:10 | #8 | |
Registered User
Join Date: May 2001
Location: ?
Posts: 19,645
|
Quote:
Does that matter at all? If that's because you wonder if I am making an OS friendly program, the answer is no. Last edited by lilalurl; 09 January 2021 at 09:56. |
|
09 January 2021, 15:08 | #9 |
Registered User
Join Date: May 2001
Location: ?
Posts: 19,645
|
So far Blitz has proved to be a little confusing and weird compared to more modern languages. I also realized the hard way, that some things don't work depending on where you put them. Like, procedures you want to use during BLITZ mode, need to be declared inside BLITZ mode
Also am I missing something or can I not send as argument to a procedure a reference to an object? This really grinds my gears. It wouldn't be such a probelm if I could make functions that return newtypes, but seems like this is not possible or I am unable to find how. Mainly wish the manual was a lot better... |
09 January 2021, 17:31 | #10 | |
Registered User
Join Date: Sep 2007
Location: Stockholm
Posts: 4,334
|
Quote:
Me, I’ve just mashed together a lot of Amigaguide files in one file which I search. |
|
09 January 2021, 17:39 | #11 | ||
Registered User
Join Date: Sep 2007
Location: Stockholm
Posts: 4,334
|
Quote:
Quote:
You can pass newtypes into procedures using a declaration like: Code:
Statement MoveEnemy{*enemy.Enemy} Code:
MoveEnemy{enemy} |
||
09 January 2021, 18:22 | #12 | |
Registered User
Join Date: Nov 2015
Location: Vaasa, Finland
Posts: 525
|
Quote:
https://archive.org/details/bb21manual It has all the commands of the classic Blitz Basic 2.1, as well as reference cards for the rawkey codes, and also you can search for certain words in the PDF. |
|
11 January 2021, 16:32 | #13 | |
Registered User
Join Date: May 2001
Location: ?
Posts: 19,645
|
Quote:
Code:
Statement.MyNewType {} Again I found no such info in the manual or Amigacoding. With "object" I meant any data structure I create. I'm used in things like C# that I can just reference an object (pointer to the data structure?) and modify it. As for the manual, I'll give a look at these suggestions. I'd prefer something online I can search through, but at this point, anything helps. |
|
11 January 2021, 22:26 | #14 | |||||
Registered User
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 6,343
|
Quote:
Quote:
Quote:
The * denotes a pointer, similarly to C. Pointers are a bit of a broad subject and aren't strictly an object, but you can sort of treat them as one in this instance. They carry the address in memory of a struct / Newtype, so are simply a number (long type) with a special meaning. With that in mind, it's possible to pass them to or from procedures if necessary. Idrougge's method should let you modify the data directly without having to actually return anything ans is probably the most elegant solution, but if necessary you can also do it using a return value: You can receive a pointer from a function that returns it as a long value, but you have to be careful: if the pointer is to a local variable or struct in the function, the data will no longer exist once the function exits, so the pointer will point to garbage. For this reason, you could use global variables (primitive or Newtype) and return a pointer to one of them if needed, and that will work as expected: Code:
Deftype .mytype var Function.l myFunction{value.w} Shared var var\count + value Function Return &var End Function [...] *myStruct.mytype = myFunction{3} NPrint *myStruct\count Quote:
Quote:
But even in Blitz2, typing a command and pressing Help with the cursor on the command will give you a quick syntax reference in the screen bar. |
|||||
11 January 2021, 23:24 | #15 |
Registered User
Join Date: May 2001
Location: ?
Posts: 19,645
|
Thanks for your help guys. I'm using Blitz 2.1 to compile, but Notepad++ to make the code in, I have no interest in using the Amiga editors of BB2 or AB3.
So the asterisk is a pointer! good to know. Yeah what idrougge described is exactly what I wanted to do. I was trying to make a procedure to initialize my newtype elements, and doing it that way is maybe the best way. As it is, I had already used the SHARED keyword, even if it is a little confusing. Sorry I have dragged this so off topic. I'll get back to including graphics in my code. I need to test this as I haven't yet. Besides wanting to produce what I am working of as a single executable file, I also have a little secret part in it that I don't want spoiled by having files outside that would reveal it |
12 January 2021, 10:24 | #16 |
Registered User
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 6,343
|
Cool beans. Even if not using the editor for the actual code though, the AmigaGuide documentation might be worth having. The Decode commands live in the sections of the manual for what you're actually decoding - DecodeILBM is what you need for decoding a bitmap, and is in the Bitmaps chapter of the manual.
Include and XInclude are both for including additional source files, like #include in C. IncBin on the other hand is for embedding an actual chunk of binary data in the executable. Putting a label directly before it will allow you to find the address location to decode, but you need to make sure you don't actually execute the IncBin'd data. Code:
Bitmap 0, 320, 256, 4 DecodeILBM 0, ?image1 [ rest of main program ] End .image1 IncBin "Data:image.iff" Last edited by Daedalus; 13 January 2021 at 16:56. Reason: Fixed error in code |
12 January 2021, 17:05 | #17 | |||
Registered User
Join Date: May 2001
Location: ?
Posts: 19,645
|
Quote:
Quote:
Quote:
|
|||
12 January 2021, 17:13 | #18 | |
Registered User
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 6,343
|
Yep, either that or jumping over it with a Goto. You just don't want the CPU to ever reach that part of the program and try and execute it, or it's an instant crash.
Quote:
Last edited by Daedalus; 13 January 2021 at 16:49. |
|
13 January 2021, 16:22 | #19 |
Registered User
Join Date: May 2001
Location: ?
Posts: 19,645
|
What about the palette then? Fuck me, I can;'t even find LoadPalette in this manual
Is there a way to pinch the palette from the incbin'd file or a bitmap object already in memory? [edit] I just tried using DecodeILBM, and I get an error "Can't find IFF 'BMHD'", what does this even mean? [edit 2] Fuck me, the way you reference the label is ?label, not &label. That was the error. Thanks idrougge for pointing it out before and thanks me for blatantly ignoring it like a moron [edit 3] Sorry for all the edits. Found DecodePalette in the manual, but when I use it, the program takes FOREVER to run/compile. I don't know why this is, but it's weird. For the time being, I am loading the palette externally, I cut a 1x1px brush with the palette I need and that's it. Last edited by Amiga1992; 13 January 2021 at 16:47. |
13 January 2021, 16:52 | #20 |
Banana
Join Date: Jul 2016
Location: Darmstadt
Posts: 1,214
|
If it was easy it wouldn't be nearly as much fun
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Gobliins 3 M5 including spanish version | Sandro | project.TOSEC (amiga only) | 13 | 09 April 2014 17:43 |
Since 2.4.0 including 2.4.1b7 little display corruption | Ridrok | support.WinUAE | 3 | 19 April 2012 11:45 |
Lots of games for sale including some Amiga. | Big-Byte | MarketPlace | 0 | 29 December 2005 17:38 |
Amiga Pyromania CLOSEOUT for only $18.95 including shipping. | Pyromania | MarketPlace | 0 | 28 June 2003 06:38 |
|
|