Jump to content

  • Log In with Google      Sign In   
  • Create Account

Alphablackwolf

Member Since 23 Apr 2012
Offline Last Active May 08 2012 01:26 PM

Topics I've Started

Issue Loading Spritefont

07 May 2012 - 04:31 PM

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):

Dim family As FontFamily
	    For Each family In FontFamily.Families
             debug.Print(family.Name)

        Next


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.

Checking for texture transparency with resize

02 May 2012 - 07:39 PM

Ok, so I was using the tutorial here: http://create.msdn.com/en-US/education/catalog/tutorial/collision_2d_perpixel

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 think 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:

    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

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?

Sprite Storage Question

25 April 2012 - 08:36 AM

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?

Graphic Display for Card Game

23 April 2012 - 03:37 PM

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!

PARTNERS