![]() |
![]() |
#1 |
Phone Homer
Join Date: Jun 2006
Location: 5150
Posts: 5,887
|
Blitz Basic 2 basics
This thread is for questions on the very basics.
|
![]() |
![]() |
#2 |
Phone Homer
Join Date: Jun 2006
Location: 5150
Posts: 5,887
|
First questions using Inkey$ with raw key codes How?
|
![]() |
![]() |
#3 |
Registered User
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 6,416
|
Inkey$ is used to take input from the current input stream, but it won't work in the Shell if that's what you're trying to do? Edit$ is used instead for taking a whole line. Also, from memory, Inkey$ gives you a cooked key, nor a rawkey, though I don't think that would make much of a difference.
What exactly are you trying to do? |
![]() |
![]() |
#4 |
Phone Homer
Join Date: Jun 2006
Location: 5150
Posts: 5,887
|
So im in Blitz mode and want to control my objects from keyboard instead of joystick
A$=inkey If a$="a" print " a" End if Repeat but instead of a$="a" I want to use the Raw keycodes |
![]() |
![]() |
#5 |
Registered User
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 6,416
|
Ah, ok. Well then Inkey$ probably isn't what you want then. You'll need to use the RawStatus() function and provide it with the rawkey code you're looking for. For example:
Code:
If RawStatus($45) Print "Escape pressed!" End If Edit: Rawkey codes are laid out on a page at the back of the Blitz manual, but appear to be missing from the online manual. The codes can be found here in the first column. |
![]() |
![]() |
#6 |
Phone Homer
Join Date: Jun 2006
Location: 5150
Posts: 5,887
|
Brilliant ill try it out
|
![]() |
![]() |
#7 |
Registered User
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 6,416
|
Cool. Apparently you also need to have the command
Blitzkeys On after you go into Blitz mode to enable reading of the keyboard... |
![]() |
![]() |
#8 |
Phone Homer
Join Date: Jun 2006
Location: 5150
Posts: 5,887
|
Excellent
|
![]() |
![]() |
#9 |
Phone Homer
Join Date: Jun 2006
Location: 5150
Posts: 5,887
|
We have a palette
0=Purple 1=Black 2=White 3=Orange Cls 3 - an Orange Screen Using Print Command Change the Colour of the Text to White 2 and the border around the text to Black 1? |
![]() |
![]() |
#10 |
Registered User
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 6,416
|
Use the Colour command before the Print command:
Colour 2, 1 should work... You don't have to provide the second parameter, in which case the background will be whatever the background colour is on the bitmap. |
![]() |
![]() |
#11 | |
Phone Homer
Join Date: Jun 2006
Location: 5150
Posts: 5,887
|
Quote:
I hope this thread will be helpful for other people as well. |
|
![]() |
![]() |
#12 |
Registered User
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 6,416
|
Yep, it's only for when you're outputting text to a bitmap specifically.
|
![]() |
![]() |
#13 |
Phone Homer
Join Date: Jun 2006
Location: 5150
Posts: 5,887
|
Thanks again - now what question next
![]() ![]() |
![]() |
![]() |
#14 |
Registered User
Join Date: Oct 2008
Location: Finland
Posts: 643
|
I have a question, what is the fastest method of using blockscroll without getting flicker? Now I use double buffering and BitMapCopy but is there a better way? This is probably a very stupid way of doing it
Last edited by MickGyver; 17 March 2017 at 15:24. |
![]() |
![]() |
#15 |
Registered User
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 6,416
|
Hmmm, I don't really know about blockscrolling as I haven't really used it... Are you sure you're synchronising with the vertical blank though? What part of the display flickers?
|
![]() |
![]() |
#16 |
Registered User
Join Date: Oct 2008
Location: Finland
Posts: 643
|
The whole screen flickers if I don't use double buffering, but the way I do double buffering now is probably very inefficient. I'm trying to figure out how to do 8way scrolling with a large tilemap, I haven't found any example how to do this. I was thinking of using blockscroll and drawing only blocks coming in. It's working in one direction now but probably very inefficient. This is my code:
Code:
; TILEMAP TEST #bm_map_width = 22 #bm_map_height = 14 ; Set default type to word DEFTYPE .w BitMap 0,352,224,4 ; Create bitmap1 BitMap 1,352,224,4 ; Create bitmap2 BitMap 2,192,128,4 ; Bitmap for tiles, create and set as used LoadBitMap 2,"set.iff" LoadPalette 0,"set.iff" ; Get shapes from the bitmap containing tiles (increase the max number of shapes in compiler options to 200) i = 0 For y = 0 To 7 For x = 0 To 11 GetaShape i, x LSL 4, y LSL 4, 16, 16 i = i + 1 Next Next ; Free the shapes bitmap Free BitMap 2 ; Use bitmap 0 (shown on screen) Use BitMap 0 ; Read the tile map map_xmax = 0 map_ymax = 0 If ReadFile(0,"tilemap102x74.map") ReadMem 0, &map_xmax, 2 ; width in tiles ReadMem 0, &map_ymax, 2 ; height in tiles map_xmax-1 ; same as map_xmax = map_xmax - 1; map_ymax-1 Dim mapa.b(map_xmax, map_ymax) ReadMem 0, &mapa.b(0,0), (map_xmax+1)*(map_ymax+1) CloseFile 0 EndIf BLITZ ; Go into blitz mode ;Mouse On ; Turn on mouse ; Create the main slice (the bitmap width must be a multiple of 16, otherwise the graphics becomes scrambled) ; slice#, ypos, width, height, flags, bitplanes, sprites, colors, bitmap1_width, bitmap2_width Slice 0,44,320,192,$fff8,4,8,16,352,352 Use Palette 0 ; Draw tiles to fill the whole bitmap For y = 0 to #bm_map_height-1 For x = 0 to #bm_map_width-1 ; Map is exported from Tiled, there 0 means no tile, because of that the tile value is reduced by one Block mapa(x,y)-1, x LSL 4, y LSL 4 Next Next x_map = 1 y_map = 1 x_slice = 16 y_slice = 16 db = 0 ; } Repeat VWait Show db, x_slice, y_slice ; Show the slice CopyBitMap db, 1-db db = 1-db Use BitMap db If Joyx(1) = 1 x_slice + 1 If x_slice MOD 16 = 0 BlockScroll 32,16,320,192,16,16 For y = 1 to #bm_map_height-2 Block mapa(mapposx+#bm_map_width,y)-1, 336, y LSL 4 Next mapposx + 1 x_slice = 16 EndIf End If Until Joyb(1) > 0 |
![]() |
![]() |
#17 |
Registered User
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 6,416
|
Hmmm... You're copying the whole bitmap every frame? I don't think you would need to do that - just do the blocks that need to be redrawn on each bitmap as needed and swap it out. Copy the bitmap at the start before you enter the main loop and you should be fine. Other than that it looks ok to me, but I haven't tested it...
|
![]() |
![]() |
#18 |
Phone Homer
Join Date: Jun 2006
Location: 5150
Posts: 5,887
|
Next Question What does Blockscroll do?
Full hardware scrolling was done like this http://eab.abime.net/showthread.php?t=80646 or/and http://eab.abime.net/showthread.php?t=81634 or a large screen but this is a whole other thread ![]() You can use DisplayBitMap to scroll the screen. Last edited by Retro1234; 17 March 2017 at 18:10. |
![]() |
![]() |
#19 |
Registered User
Join Date: Oct 2008
Location: Finland
Posts: 643
|
Ok thanks, so I need to handle the scrolling for both bitmaps separately somehow since they get "out of sync" every frame if scrolling.
|
![]() |
![]() |
#20 | |
Registered User
Join Date: Oct 2008
Location: Finland
Posts: 643
|
Quote:
I have been looking at the full hardware scrolling and have managed to do horisontal scrolling in both directions using corkscew with a 100 screen wide tilemap. First I did it with DisplayBitMap and copperlists but there seems to be a bug in DisplayBitMap, setting an x-value over 8191 ($1fff) will offset and garble the screen (so max 26 screens possible). When I switched to using slices it worked for at least 100 screens, didn't try anything bigger. Doing 8way hardware scrolling is more complicated though. |
|
![]() |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
[blitz basic] How much amiga-blitz friendly is this? | saimon69 | Coders. Blitz Basic | 105 | 21 April 2022 19:45 |
Blitz Basic (1) | Retro1234 | Coders. Blitz Basic | 9 | 18 February 2016 17:54 |
Blitz basic 2 Help | Havie | Coders. Blitz Basic | 30 | 08 September 2013 09:15 |
Blitz Basic 2 anyone? | jobro | request.Apps | 12 | 28 November 2005 18:15 |
Blitz Basic 2 | LaundroMat | Retrogaming General Discussion | 5 | 24 July 2001 08:10 |
|
|