Graphics lost after set screen graphics

Blitz3D Forums/Blitz3D Beginners Area/Graphics lost after set screen graphics

Fernhout(Posted 2009) [#1]
Maybe this topic is handeld before dut after 30 pages of searching i place this anyway.

I am startig programming. And i was setting up the program when i found out that when i loaded images and than is set up the screen i got a error that the images not exist. When i follow the program in step mode i see i got the handler of the images so why is BB saying then that the images is not there.

Program e.g. This one give an error image does not exist
[code]

Global MousePointer = CreatImage (10,10)
Global Button= CreateImage(75,50)

LoadImage MousePointer ("Mouse.bmp")
LoadImage Button (Button1.bmp")

Graphics 800,600,32
Setbuffer backbuffer()
Repeat
Cls
DrawImage MousePoiner,MouseX(),MouseY()
DrawImage Button,300,200
flip
if KeyDown(1)
End
EndIf
Forever
[\code]

This one works?
[code]
Graphics 800,600,32

Global MousePointer = CreatImage (10,10)
Global Button= CreateImage(75,50)

LoadImage MousePointer ("Mouse.bmp")
LoadImage Button (Button1.bmp")

Setbuffer backbuffer()
Repeat
Cls
DrawImage MousePoiner,MouseX(),MouseY()
DrawImage Button,300,200
flip
if KeyDown(1)
End
EndIf
Forever
[\code]

In both cases the handler is there.

Can someone explain me why this is happening.


puki(Posted 2009) [#2]
On glancing your code quickly:

LoadImage MousePointer ("Mouse.bmp") should be MousePointer=LoadImage("Mouse.bmp"), etc.


PowerPC603(Posted 2009) [#3]
Straight from the docs:

Graphics width, height, color depth,[mode]
Parameters
width = width of screen in pixels (640, 800, etc) 
height = height of screen in pixels (480, 600, etc) 
color depth = depth in bits (0, 16, 24, or 32 bit) 
mode = Video mode (see description); Optional  

Description
This command sets Blitz into 'graphics' mode with the specified width, height, and color depth (in bits).
This command must be executed before any graphic related commands can be used.
Every time this command is used, any images loaded will be lost,
and all handles to images will become invalid. 


You should first setup your graphics system (the resolution and bitdepth), then load/create all your images.


GfK(Posted 2009) [#4]
You've written 'DrawImage Mousepoiner' so no matter whether you've set the graphics mode or not, it'll never ever draw anything unless you spell your variable names correctly.

With such basic errors in the command syntax I think you first need to spend some serious time whispering sweet nothings into the proverbial ear of the documentation. You know, get to know each other a bit.


fox95871(Posted 2009) [#5]
I'm on my second run through the commands myself. It's time consuming, but it's like practicing an instrument. It's the only way. Studying a few a day, taking notes, and even going through them all a second time, has meant for me the difference being able to improve my game engine, and simply not being able to. I couldn't make progress at all if I didn't know the commands very well.

Ask me about any command if you need to. I take very beginner friendly notes because I am one!


GfK(Posted 2009) [#6]
There is no point reading the entire commandset thinking you'll magically know how to make it all work at the end - you won't. You'll be lucky if you can remember 2% of it.

Read the documentation as you need it. Learn by doing.


Warner(Posted 2009) [#7]
Well, I do not agree completely. Many times you'll find yourself in the position thinking: "hmm .. i did read something about that, now where was that again?". After reading the manual, you will forget, but you'll be less surprised the next time you encounter something. Still, when reading the manual, it is nice to know what it is about, so the reading should be altered with practicing. I think the optimal combination is working on a project at daytime, then at night, in bed, read a printed version of the manual.


Zethrax(Posted 2009) [#8]
I think that it's a good idea to periodically browse through the commands from start to finish and get an overview of what's available.

You'll only retain a fraction of it, but you'll be in a better position to know what functionality is available in the language.

Also, don't forget the online version of the docs. The online docs are more up to date, and often have additional information in the comments.