Page 1 of 1
Posted: Wed Feb 05, 2003 7:31 pm
by BackupUser
Restored from previous forum. Originally posted by David.
Hi. Sorry for such an idiot question.. but.. How can i draw an image on a Window ? And, can i draw an Sprite on the window ?
Here is what im trying (but no image is displayed) :
OpenWindow(0, 100, 100, 300, 200, #PB_Window_SystemMenu, "Draw Image Test")
If LoadImage(0, "block1.bmp") = false
MessageRequester("IQ", "Error",0) ; The image is loaded, cuz no error msgs are displayed
EndIf
CreateGadgetList(0) ; Creating GadGet stuff.. not sure if this is necessary !
Repeat
EventID.l = WaitWindowEvent()
StartDrawing(WindowOutput())
DrawingMode(1)
Locate(10, 50)
DrawText("Test !!") ; This works ok
ImageGadget(0, 0, 0, 50, 50, 0) ; This is not displayed ! =(
StopDrawing()
Until EventID = #PB_EventCloseWindow ; If the user has pressed on the close button
Thanx.
David.
Posted: Wed Feb 05, 2003 8:26 pm
by BackupUser
Restored from previous forum. Originally posted by Andre.
This way your example should work: (couldn't test it now)
Code: Select all
OpenWindow(0, 100, 100, 300, 200, #PB_Window_SystemMenu, "Draw Image Test")
If LoadImage(0, "block1.bmp") = false
MessageRequester("IQ", "Error",0) ; The image is loaded, cuz no error msgs are displayed
End
EndIf
CreateGadgetList(WindowID()) ; Creating GadGet stuff.. not sure if this is necessary !
ImageGadget(0, 0, 0, 50, 50, UseImage(0))
Repeat
EventID.l = WaitWindowEvent()
StartDrawing(WindowOutput())
DrawingMode(1)
Locate(10, 50)
DrawText("Test !!") ; This works ok
StopDrawing()
Until EventID = #PB_EventCloseWindow ; If the user has pressed on the close button
Regards
André
*** German PureBasic Support ***
Posted: Wed Feb 05, 2003 8:31 pm
by BackupUser
Restored from previous forum. Originally posted by David.
Yeah, works fine now ! =)
Thanx.
Posted: Wed Feb 05, 2003 9:03 pm
by BackupUser
Restored from previous forum. Originally posted by David.
Well, that was only part of the code.
Im working on a Tile-Based map editor for a RPG game. I have lots of GadGets images on the screen now, but i must move them. Any ideias of how can i move them ?
PS. Im using GadGets only for the editor, in the real game ill be using Sprites, in a full-screen mode (using OpenScreen). But in the map editor i need more than 1 window, thats why im using GadGets.
Posted: Wed Feb 05, 2003 9:52 pm
by BackupUser
Restored from previous forum. Originally posted by Pupil.
Why don't you just use a windowed screen? I don't think Gadgets instead of sprite tiles is a good way to do these kind of things..
Posted: Wed Feb 05, 2003 10:14 pm
by BackupUser
Restored from previous forum. Originally posted by tinman.
Originally posted by David
Well, that was only part of the code.
Im working on a Tile-Based map editor for a RPG game. I have lots of GadGets images on the screen now, but i must move them. Any ideias of how can i move them ?
You can use the ResizeGadget command to move gadgets. If you want to move them using the mouse, then you might want to search these forums for the form designer that allowed you to do that, as the technique would be the same. (I cannot remember if the source was posted though.)
--
It's not minimalist - I'm increasing efficiency by reducing input effort.
(Win98first ed. + all updates, PB3.51)
Posted: Thu Feb 06, 2003 12:30 am
by BackupUser
Restored from previous forum. Originally posted by David.
sweet !
Pupil: Thanx ! This will help a lot ! (i think)
Lets code.
David