Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / example code broken?

Author
Message
Dancelot Gaiming
2
Years of Service
User Offline
Joined: 11th Oct 2019
Location:
Posted: 10th Oct 2021 10:14
get image 1,0,0,100,100,0
cls
load image "anypicture.bmp",1,0
do
loop
end

i was trying this code from the help file and for some reason, it doesn't work

did I do something wrong?
Code Maker
5
Years of Service
User Offline
Joined: 4th Dec 2015
Location:
Posted: 10th Oct 2021 20:55
This is what the help file says about the "get image" command

Dancelot Gaiming
2
Years of Service
User Offline
Joined: 11th Oct 2019
Location:
Posted: 11th Oct 2021 04:19
how do i add custom image? cause it shows this



how do i change that?
Derek Darkly
10
Years of Service
User Offline
Joined: 22nd Sep 2011
Location: Whats Our Vector, Victor?
Posted: 11th Oct 2021 18:58
If you only want to paste an image to the the screen, use the PASTE IMAGE command after LOAD IMAGE.

If you want to load an image as a sprite, just use the SPRITE command after LOAD IMAGE.
Send your parents to noisy sprite demo hell... enter the D-Zone
Raven
16
Years of Service
User Offline
Joined: 23rd Mar 2005
Location: Hertfordshire, England
Posted: 13th Oct 2021 03:22
The Get Image command will copy anything within the defined area that has been Drawn to the Screen and create a new Image with it.
If we want to use an image we've already created and saved as a PNG or JPG then we'd use the Load Image command.

Now keep in mind that if we don't precisely specify a Hard Disk Location (such-as "C:\Windows\Web\Wallpaper\Theme1\img1.jpg"., which is a real location and image that is on every Windows PC since Windows Vista... although the image will be different from release to release) well then the Command will assume that you mean a location from wherever the Runtime.exe (or whatever you chose to rename it) is running from.

So, if I copied Runtime.exe to C:\myApplication\ then if I called Load Image 1, "img1.jpg" ... it would EXPECT the image to be located at C:\myApplication\img1.jpg
With Get Image., we don't have to worry about a location on Physical or Network Storage; because well we're just Copying whatever is On-Screen.

For example:



Now we can do some interesting things with the Get Image Command... like say we want to make an Animated Image, for example Super Mario Running.
Well we could use this image (right-click > save-as "mario.jpg")





This will provide an Animated "Mario"... of course Images themselves are actually quite limiting in terms of what we can do with them without delving into complicated pixel manipulation.
Also they're not exactly a "Fast" approach, as you're not using any Hardware Acceleration; it's instead using your CPU to handle everything.

What's much better is to use those Images for Sprites., as with a Sprite... well aside from being Hardware Accelerate by your Graphics Card., you have much more you can do with them.
But I'll let you figure out how those work, this should be a simple enough primer for Images.

Login to post a reply

Server time is: 2021-10-25 20:17:21
Your offset time is: 2021-10-25 20:17:21