Autor Beitrag
Leuchtturm
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1087

Win Vista, Knoppix, Ubuntu
Delphi 7 Pe, Turbo Delphi, C#(VS 2005 Express), (X)HTML + CSS, bald Assembler
BeitragVerfasst: Fr 29.06.07 16:41 
Hi,
ich habe ein problem:
Ich habe mir für ein Object(Fadenkreuz)eine Klasse erstellt. Mit dieser will ich jetzt die Textur laden. So geht es ja aus der Game-Klasse heraus:
ausblenden C#-Quelltext
1:
2:
texture = content.Load<Texture2D>( "texture" );
spriteBatch = new SpriteBatch( graphics.GraphicsDevice );

Mit der Klasse kann ich das jedoch nicht so laden,weil ich dort weder ein ContentManager noch ein GraphicsDevice erstellen kann.
Wie kann ich eine Texture mit einer Klasse laden?
Leuchtturm

PS: Ich hoffe es war nicht allzu umständlich formuliert :wink:

_________________
Ich bin dafür verantwortlich was ich sage - nicht dafür was du verstehst.
Leuchtturm Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1087

Win Vista, Knoppix, Ubuntu
Delphi 7 Pe, Turbo Delphi, C#(VS 2005 Express), (X)HTML + CSS, bald Assembler
BeitragVerfasst: Fr 29.06.07 17:44 
So gehts, einfach den Contentmanager und den GraphicDeviceManager als Parameter übergeben :D
ausblenden C#-Quelltext
1:
2:
3:
4:
5:
public void loadTexture(ContentManager content, GraphicsDeviceManager graphics, string assetName)
{
fadenkreuz = content.Load<Texture2D>(assetName);
this.spriteBatch = new SpriteBatch(graphics.GraphicsDevice);}
}

_________________
Ich bin dafür verantwortlich was ich sage - nicht dafür was du verstehst.