Mapeditor

Übersicht BlitzBasic Blitz3D

Neue Antwort erstellen

 

boss@future

Betreff: Mapeditor

BeitragSo, Feb 01, 2004 22:17
Antworten mit Zitat
Benutzer-Profile anzeigen
Hi,
ich prog zur Zeit einen kleinen MApeditor. In dem Editor hat man eine Oberfläche, die mit Blitzui erstellt ist. Außerdem einen Kontrollmodus in 3D. Jedoch kommt ein Fehler wenn man von dem 3D Modus zurückschaltet und eine Textur oder etwas anderes laden will. Ich hoffe ihr könnt mir Helfen. Für den Code benötigt ihr auch noch die Includes, die beim BlitzUI Download dabei sind.
http://www.legacygames.co.uk/downloads.php


Der Fehler tritt nach dem Zurückschalten in die GUI oberfläche auf.. aber erst wenn man mit dem OPENSAVE-include eine Datei laden will. ich höffe jetzt wisst ihr genau was ich meine.
Fehler : image does not exist

PS.: am ende von Function Modus lad ich des des ganze Zeug nochmal ganz neu...!!!wichtig!!!

Code: [AUSKLAPPEN]

Graphics 640, 480, 16, 1
SetBuffer BackBuffer(  )
HidePointer

Global Hight$
Global Bild
Global open
Global save
Global Close
Global Hightmap
Global Texture
Global struktur
Global St$
Global Tex$
Global Texx
Global dreiD
Global zweiD
Global cam
;Global


 
Include "blitzui.bb"
Include "icons.bb"
Include "opensavedialog.bb"

;Load fonts and mouse cursors
;and collect information
Initialise(  )

;Window
Win()
;____________________________________________________________
Repeat

GUI()
Map()
DrawMouse(  )
Flip   
Until KeyHit( 1 ) Or app\Quit = True

   ;Draw the GUI and update the mouse
   
   
   
;Free all images and controls created by BlitzUI
Destroy(  )

Function Map()
if Bild <> 0
DrawBlock Bild,186,23
Else
EndIf

End Function

;_______________________________________

Function modus()
If Bild <>0 And  Texx <>0 Then
Graphics3D 640,480,16,1
SetBuffer BackBuffer()

cam=CreateCamera()
PositionEntity cam,10,200,10
CameraClsColor cam,0, 128, 255
terr=LoadTerrain( hight$ )
ScaleEntity terr,10,200,10
TerrainDetail terr,2000,1
TerrainShading terr,True

texxx=LoadTexture( tex$ )
texxxx=LoadTexture( st$ )
Breite = TerrainSize (terr)
ScaleTexture texxx,Breite,Breite
ScaleTexture texxxx,20,20

EntityTexture terr,texxx ,0,2
EntityTexture terr,texxxx,0,1
EntityType terr,SCENE

While Not KeyHit(1)



If KeyDown(203)=1 Then x#=x#-5
If KeyDown(205)=1 Then x#=x#+5
If KeyDown(208)=1 Then y#=y#-5
If KeyDown(200)=1 Then y#=y#+5
If KeyDown(44)=1 Then z#=z#-5
If KeyDown(30)=1 Then z#=z#+5
If KeyDown(205)=1 Then TurnEntity cam,0,-2,0
If KeyDown(203)=1 Then TurnEntity cam,0,2,0
If KeyDown(208)=1 Then MoveEntity cam,0,0,-5
If KeyDown(200)=1 Then MoveEntity cam,0,0,5
x#=EntityX(cam)
y#=EntityY(cam)
z#=EntityZ(cam)
terra_y#=TerrainY(terr,x#,y#,z#)+5
PositionEntity cam,x#,terra_y#,z#

updateworld

RenderWorld

Flip


Wend

Else
Endif
; mx=MouseX():my=MouseY():If mx>BildX And mx<BildX+BildBreite And my>BildY And my<BildY+BildHöhe Then
Graphics 640, 480, 16, 1
SetBuffer BackBuffer(  )
HidePointer
Include "blitzui.bb"
Include "icons.bb"
Include "opensavedialog.bb"

;Load fonts and mouse cursors
;and collect information
Initialise(  )

;Window
Win()
Bild=LoadImage (Hight$)
 ResizeImage bild, 450,450
texx = LoadImage (Tex$)   
stt = LoadImage (st$)
GUI()
End Function

Function GUI()
 UpdateGUI(  )



   ;Event Handling
   Select app\Event
      Case EVENT_WINDOW
         Select app\WindowEvent
         End Select
      Case EVENT_MENU
         
      Select app\MenuEvent
      Case Close: End
        Case Open:
        Filename$ = FileDialog( "Open File", CurrentDir(), ".png" )
           
        Case Hightmap:
        Hight$ = FileDialog( "Hightmap", CurrentDir(), ".bmp")
          Bild=LoadImage (Hight$)
          ResizeImage Bild, 450,450
      
      
      Case Texture:
        Tex$ = FileDialog( "Textur", CurrentDir(), ".bmp" )
      texx = LoadImage (Tex$)      
      Case Struktur:
        st$ = FileDialog( "Textur", CurrentDir(), ".bmp" )
      stt = LoadImage (st$)
      Case dreiD: Modus()   
      

      End Select
          Select app\GadgetEvent
          Case EVENT_GADGET
         
         End Select
   End Select
   ;Draw the mouse
   
   
   ;Reset all GUI events
   ResetEvents(  )

End Function

Function Win()
Mapeditor = Window(0, 0, 640, 480, "Mapeditor", "0", 0, 1, 1, 1 )
Datei = MenuTitle( "File" )
Open = MenuItem( Datei, "Open", "", "0", 0, 0, 0 )
Save = MenuItem( Datei, "Save", "", "0", 0, 0, 0 )
Close = MenuItem( Datei, "Close", "", "0", 0, 0, 0 )
Map = MenuTitle( "Map" )
Hightmap = MenuItem( Map, "Map", "", "0", 0, 0, 0 )
Texture = MenuItem( Map, "Texture", "", "0", 0, 0, 0 )
Struktur = MenuItem( Map, "Struktur", "", "0", 0, 0, 0 )

mnut006 = MenuTitle( "Modus" )
zweiD = MenuItem( mnut006, "2D", "", "0", 0, 0, 0 )
dreiD = MenuItem( mnut006, "3D", "", "0", 0, 0, 0 )
tab004 = Tab( 427, 68, 0, 0 )
CloseTab(  )

tab002 = Tab( 93, 144, 0, 0 )
CloseTab(  )

tab001 = Tab( 0, 0, 180, 458 )
Nature = TabPage( "Nature", "" )
SendMessage( Nature, "TM_SETSIZE", 60, 20 )
Animals = TabPage( "Animals", "" )
SendMessage( Animals, "TM_SETSIZE", 60, 20 )
obj = TabPage( "objects", "" )
SendMessage( obj, "TM_SETSIZE", 58, 20 )
btnTwo = Button( 20, 20, 70, 20, "Button Two" )
CloseTab(  )

End Function

End
  • Zuletzt bearbeitet von boss@future am So, Feb 01, 2004 22:30, insgesamt einmal bearbeitet
 

René Meyer

BeitragSo, Feb 01, 2004 22:23
Antworten mit Zitat
Benutzer-Profile anzeigen
Jedoch kommt ein Fehler ...

Und wärst Du auch bereit, uns mitzuteilen, welcher Fehler das ist und wo er auftritt? :)

... wenn man von dem 3D Modus zurückschaltet und eine Textur oder etwas anderes laden will.

(Du weißt, daß durch Graphics alle Bild-Handles ungültig werden?)
www.blitzbasic.de | Das Buch zu Blitz Basic: www.schreibfabrik.de/txt/bbb

Mike Nike

BeitragSo, Feb 01, 2004 22:24
Antworten mit Zitat
Benutzer-Profile anzeigen
Ich hab mir noch nicht ganz alles angesehen, aber ich habe eine Vorahnung.
Wenn du den Modus reloadest, setzt du Graphics neu.
Dadurch werden die einst eingeladenen Grafiken gelöscht (Grafikspeicherentleerung...) und müsstest diese jedesmal wieder neuladen.
Da du dies hier glaube ich nicht tust, versuch BB nach einem ModeReload Grafiken zu malen, die nicht mehr im Grafikspeicher sind.

Edit:
Mist, René war schneller...
..where the only limit is your imagination.
 

boss@future

Betreff: Soweit so Schlecht...

BeitragSo, Feb 01, 2004 23:08
Antworten mit Zitat
Benutzer-Profile anzeigen
Soweit hab ich mir des auch schon gedacht.. nur weiß ich nicht was an dem Code Falsch ist..dennSchließlich habe ich alles wieder neu geladen....und trotzdem komm tder Fehler, dass das Bild nicht geladen ist.. !?! Vieleicht ist es das beste wenn ihr den Code mal ausprobiert.
Thx FLO

Neue Antwort erstellen


Übersicht BlitzBasic Blitz3D

Gehe zu:

Powered by phpBB © 2001 - 2006, phpBB Group