Alphablackwolf

Member
  • Content count

    13
  • Joined

  • Last visited

Community Reputation

101 Neutral

About Alphablackwolf

  • Rank
    Member
  1. System.Drawing.Graphics and Texture2D?

    You could import it, and maybe work out how to use it, but I wouldn't recommend it. Between a lack of double buffering and that it's not optimized for game code could leave you with flickering and laggy graphics. I am also unsure how well that would port to Xbox if you were to do so.
  2. XNA UserControl

    I just ran into a similar issue, I am checking out custom control libraries out there, currently I am looking at a few of them. NeoForce Controls, located here: [url="http://neoforce.codeplex.com/"]http://neoforce.codeplex.com/[/url] Nuclex Framework : [url="http://nuclexframework.codeplex.com/"]http://nuclexframework.codeplex.com/[/url] Simple GUI: [url="http://simplegui.codeplex.com/"]http://simplegui.codeplex.com/[/url] XwinForms: [url="http://sourceforge.net/projects/xwinforms/"]http://sourceforge.net/projects/xwinforms/[/url] WSX: [url="http://wsx.codeplex.com/"]http://wsx.codeplex.com/[/url] and additionally I think you can now have XNA active in a WPF project, but that's a bit more complicated than I understand... Maybe someone with more experience can pitch in on which of these they would recommend, or another one I didn't list perhaps.
  3. Issue Loading Spritefont

    Aha! Found it. So apparently some OpenType Font setups will not work. It's a misleading error message. To quote an exerpt from where I found my answer: [quote][color=#4A4A4A][background=rgb(241, 241, 241)]The OpenType requirement is a bit misleading as the font has to have TrueType outlines; OpenType also supports PostScript outlines which do not work in GDI+, which is what the SpriteFont processor internally uses.[/background][/color][/quote] So I did an online conversion from otf to ttf and reinstalled my fonts with the TTF files, once I restarted visual studio again after that, it worked.
  4. Issue Loading Spritefont

    It's an open type font, but the error specifically states that it has to be open type or true type, so it's covered there. I am mostly attempting to use the name "Trajan Pro" with any variation I can think of. The 'friendly name' as far as I can tell is Trajan Pro according to the font folder and notepad/wordpad/word, etc. Which all show Trajan Pro as an option and work. Hmm... is there any way to load the font directly from the file, say if I include it in the project directory?
  5. I am having trouble loading a spritefont for Trajan Pro. I downloaded/installed the font (multiple times/ways now) and have restarted both my machine and visual studio many times, but I still get a build error telling me that it cannot find the 'Trajan Pro' font family. It's in the font folder, both regular and bold. I've tried every spelling of 'Trajan Pro' I can think of, and cannot get it to work. I even tried running through the .net library of available font families, and I noted several ones that were in my font folder, but did not show up, Trajan Pro was among them. The code I used to show font family (in a winforms project, not xna): [CODE] Dim family As FontFamily For Each family In FontFamily.Families debug.Print(family.Name) Next [/CODE] Does anyone know how visual studio/XNA loads in these fonts? Is there any way I can make this work? Any help would be greatly appreciated.
  6. Loading a tiled map

    If you load the file once in the load process and save it into an object stored in memory it won't have to reach out to the filesystem to read the data every time. It's expensive to read the file each time, so if you store in the load, the draw process won't have to read the file to get the information.
  7. Loading a tiled map

    As far as I can tell, you will need to make the following changes: 1) Add a routine for drawing your tiles, and call that from your draw routine. 2) Call the grass draw event from that new routine for any tile object that needs grass drawn on it. 3) remove the spritebatch.begin/end calls in the grass draw routine. 4)remove your grass load procedure. Change it so that you load in tile information from your file and set an enum or property so that you know what tile object needs what type (grass, dirt, whatever you have) then you will 'load' in the type without drawing it. Unless I am much mistaken, you are not going to want to draw your grass when you load the content, only on the draw event. Slynk is correct in pointing out the draw.begin/end inside of your grass draw loop is causing a lot of your lag. You are also calling your grass draw routine inside of a loop that calls LoadWorld each time. you call and use loadworld once to find it's length and then again for every single loop in the if statement to see if it is the first time. So if the LoadWorld function returns a char array of length 30, you read the entire file 30 times. Load it once before your loop, and save it. call the saved value instead of the actual function over and over again.
  8. Graphic Display for Card Game

    Hmm, thanks Geoffrey/ndssia, I will definitely do that. I can't think of a situation where I would need to actually adjust the card wording in my case, but you never know. The search function might be an eventual feature though... Hmm....
  9. Checking for texture transparency with resize

    Thanks Laztrezort, I dived into some of that stuff, and I ALMOST have it... Unfortunately I am getting a purple block when trying to get a renderTarget2D Texture. After looking around online I found a lot of issues with the renderTarget stuff, mostly about 1.0-2.0, which has all changed again in 4.0. I moved my render target code out of the draw event and tried to create a quick draw in the load event of the button, but now I'm getting no image whatsoever.. Here's what I currently have: [CODE] Public Sub Load(Content As ContentManager) Implements IButton.Load texture = Content.Load(Of Texture2D)(_spriteAssetLocation) Dim tempGraphicsDevice As GraphicsDevice = texture.GraphicsDevice Dim tempSpriteBatch As New SpriteBatch(tempGraphicsDevice) Dim renderTarget As New RenderTarget2D(tempGraphicsDevice, Bounds.Width, Bounds.Height) tempGraphicsDevice.SetRenderTarget(renderTarget) tempSpriteBatch.Begin() tempSpriteBatch.Draw(texture, Bounds, Color.White) tempSpriteBatch.End() tempGraphicsDevice.SetRenderTarget(Nothing) scaledTexture = renderTarget End Sub [/CODE] I figure if it's in the load event I only have to do it the once, then I'll have the scaled texture to compare against. Edit: Sorry, the above code is giving me a purple square. I was getting nothing at all when I set up 'Preserve Usage,' but that's something I want to avoid doing now anyway. Edit2: Got it. I was drawing the texture on the render target in a location that it was not viewable on. I set a newbounds rectangle with a location of (0,0) but the width/height of the bounds rectangle and used that in my call to draw the texture on my renderTarget. All working swimmingly now, and my check of texture transparency is working perfectly.
  10. Ok, so I was using the tutorial here: [url="http://create.msdn.com/en-US/education/catalog/tutorial/collision_2d_perpixel"]http://create.msdn.com/en-US/education/catalog/tutorial/collision_2d_perpixel[/url] to figure out how to detect transparency on a texture (in my case, a button). What I want to do is to be able to detect if a point (mouse click) is on a transparent part of the texture or not. I [i]think[/i] I understand how to do it for a texture normally, you get the texture's color data and find the point on the array created. However I am trying to figure out how I could possibly do that with a texture I am drawing with rectangle bounds that shrink/grow the original image. Since the spritebatch draw routine takes the parameters for scaling/re-sizing, the texture2D object itself is not changed, and so there is no way I can find to get the color data for a re-sized texture. Here's the routine I have currently: [CODE] Public Shared Function IsAtAlpha(textureToCheck As Texture2D, textureLocation As Rectangle, pointToCheck As Point) As Boolean Dim colorData As Color() colorData = New Color((textureToCheck.Width * textureToCheck.Height) - 1) {} textureToCheck.GetData(colorData) Dim SpecificPointColor As Color = colorData((pointToCheck.X - textureLocation.Left) + (pointToCheck.Y - textureLocation.Top) * textureToCheck.Width) Return SpecificPointColor.A = 0 End Function [/CODE] If I could get a resized texture2D object I know what to change to get this to work properly, but I have no clue how to get that. Or is there a better way to check for transparency here?
  11. Sprite Storage Question

    I am currently using a sqlite .db file to house a lot of the game information I am using. I want a lot of it to be database driven. I can actually store images in the database and load them in from there, or I could pull them all into an XNA game library and list the image asset names in the database (tied to the ID I am using for each) and load them in that way. I don't know which would be more efficient though, or the better design choice. Thoughts? Should I store these images in the .db file, or load them into XNA as content and reference them in the db by their asset names?
  12. Graphic Display for Card Game

    Found my answer, Installed XNA Game Studio (was unaware of it's existence) and brought my images in via the content pipeline.
  13. Graphic Display for Card Game

    I am working on making a card game in vb.net. It's not a playing card game; but that's poor wording... hmm, think more 'Magic: The Gathering', less poker cards. Anyway, I have physical cards, which have text on them that will need to be readable when I scan them in and add them to the game. What I am hoping to find out is if anyone knows the best choice for the object type to use to hold these images. I am hoping to have a graphic for a table (the background) and then individual cards that may be re-sized and moved around during the course of the game. I want to make sure I can scale the cards and leave the text readable, and be sure I can do smooth transitions for card movement, etc. I am currently only aware of system.drawing.image, and using a picture box in my form in order to display it all. Are there any better alternatives out there? Some assembly that you would recommend for use? I do plan to make custom buttons to display over the cards for the user to make gameplay choices, if that would change anything. I did google around a good bit, but having the words 'card, game, and graphics' in a search tends to lead me around to the wrong kinds of results. Any thoughts would be much appreciated, thanks!