English Amiga Board


Go Back   English Amiga Board > Coders > Coders. Language > Coders. Blitz Basic

 
 
Thread Tools
Old 23 January 2019, 23:19   #1
Salome
Registered User

 
Join Date: Nov 2018
Location: Paris
Posts: 9
Displaying images when hitting keys

Hi fellows!

I'm starting to use BB3 and i'm a bit stuck.
What i want to do is showing images in fullscreen mode and change them when i press some keys (1=foo1.iff, 2=foo2.iff and so).
I don't know if i should use Blitz Mode or not (but i think i shouldn't, i want to add later a MIDI input). I tried a lot of things but the image loading doesn't seem to work when i press keys.
I tried Inkey$ but it only allows inputs in Blitz Mode

Thanks for your help !
Salome is offline  
Old 24 January 2019, 00:14   #2
Daedalus
Registered User

Daedalus's Avatar
 
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 3,671
If you're looking to keep it system-friendly, you should probably use a window to display the image and then look for events triggered by a keypress. The keycode should then be returned by EventCode. But try just loading the image first without looking for keyboard input to make sure that much of the code works.
Daedalus is offline  
Old 24 January 2019, 01:15   #3
Salome
Registered User

 
Join Date: Nov 2018
Location: Paris
Posts: 9
Thanks for the reply.
I already tried to load the image and my code is ok. And i don't want it to be system-friendly, i want a fullscreen display and i think EventCode won't work as it seems to be limited to windows.
Salome is offline  
Old 24 January 2019, 01:19   #4
Salome
Registered User

 
Join Date: Nov 2018
Location: Paris
Posts: 9
I tried this but that doesn't work...

ev=WaitEvent
key$=Hex$(RawKey)
If key$ = "00000035"
LoadBitMap 0,"Work:foo.iff"
Use Palette 0
End If
Salome is offline  
Old 24 January 2019, 01:59   #5
idrougge
Registered User
 
Join Date: Sep 2007
Location: Stockholm
Posts: 3,738
You can have a system-friendly fullscreen display. On the other hand, you can't WaitEvent without being system-friendly.
idrougge is offline  
Old 24 January 2019, 02:37   #6
Salome
Registered User

 
Join Date: Nov 2018
Location: Paris
Posts: 9
I'm in Amiga mode, so I guess it's system-friendly. Anyway, i can show my pic, i can get my keystrokes in a window, but i can't trigger the image loading pressing a key :\
Salome is offline  
Old 24 January 2019, 09:36   #7
carrion
Registered User

carrion's Avatar
 
Join Date: Dec 2016
Location: Warsaw area
Posts: 72
Preload images at the beginning of your program and just display them when key is pressed
carrion is offline  
Old 24 January 2019, 12:24   #8
Salome
Registered User

 
Join Date: Nov 2018
Location: Paris
Posts: 9
I solved the bug myself. Maybe not the cleanest code made, but it works.
Now i gotta figure how to setup a 1080p screen. I've seen that it can be done using Mildred library, or maybe you got a better suggestion ?
Thanks !
Salome is offline  
Old 24 January 2019, 13:19   #9
Daedalus
Registered User

Daedalus's Avatar
 
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 3,671
Cool. Not sure what you did to solve it, but I'd suggest not using strings for hex numbers as it only adds extra layers of processing that complicate matters and are pointless. a hex number is still just a number, and you can use it in Blitz by putting $ before it:

Code:
key.l = RawKey
If key = $35
Once you get into RTG (graphics card) screens, you're committed to system-friendly methods. Since you're using AmiBlitz3, check out the screen.include.ab3 in the Sourcecodes/Includes drawer. AB3 comes with a number of very useful includes that let you do lots of things, like opening big screens, using AHI for sound, and so on. You can also use image.include.ab3 to easily load, save and blit images of almost any format, including 24-bit formats for graphics card use.
Daedalus is offline  
Old 24 January 2019, 17:27   #10
Salome
Registered User

 
Join Date: Nov 2018
Location: Paris
Posts: 9
To fix the problem i opened a window on start and the events started to work. Kinda strange, but that fixed it ^^

I'll take a look at the includes. Thanks for the tip!
Salome is offline  
Old 24 January 2019, 18:05   #11
Daedalus
Registered User

Daedalus's Avatar
 
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 3,671
Ah yes - the events are driven by windows, so without a window, there's nothing to gather the events for you. As well as that, only the *active* window gets keypress events, so bear that in mind. It's expected behaviour from Intuition, but if you're not used to it I can see that it's not that obvious. For full-screen stuff to use events, perhaps the simplest way is to open a full sized, borderless window and use that for your display.

There are also Window and Intuition includes that replace the standard Window and Event commands, and they all have built-in demo code so you can see a working example simply by loading the include into the editor and compiling it. The demo code is usually at the very end of the file.
Daedalus is offline  
Old 24 January 2019, 19:58   #12
Salome
Registered User

 
Join Date: Nov 2018
Location: Paris
Posts: 9
The window disappears when i start to trigger pictures and still catches the events, so that's not a big deal ^^
Salome is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
Screen not displaying on 2.6.1 Akira support.WinUAE 4 25 August 2013 18:50
Displaying images Tiddlypeeps Coders. Tutorials 40 30 August 2012 11:11
Displaying sprites Hewitson Coders. General 18 27 April 2011 17:35
Hitting the right keys ajoh198 support.WinUAE 1 18 November 2004 20:18
Messed up colours after hitting F12 jrom support.WinUAE 5 13 October 2002 11:09

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 23:56.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2019, vBulletin Solutions Inc.
Page generated in 0.07438 seconds with 15 queries