[BlitzMax] Help with image-drawing

Discussion in 'Game Development (Technical)' started by orias, Nov 27, 2008.

  1. orias

    orias New Member

    Joined:
    Nov 19, 2008
    Messages:
    3
    Likes Received:
    0
    Hello everyone,

    I just started programming again after many many years, and don't have the energy to pick up C++ again, or start with C# or something, so I jumped right into BlitzMax, downloaded the demo, and begun trying it out. At the moment, I am writing a text-based game, just to get the hang of programming again (kinda sorta had to start from the beginning again, although I'm not a total newbie, because I programmed ALOT some years back). But I have run into a small (huge) problem. I can't seem to get any images to be drawn correctly, for some reason. Every time I try to draw an image, it becomes VERY dark. What have I missed? I know I am doing SOMETHING wrong, because it is possible to do this in the demo (I am using the images to make a sort of mini-map, so that it's easier to find your way around, in my awesome little text-based world), and I know that since I've tried running some of the sample programs, and they work just fine, using images.

    This is what I have so far. I have "Graphics 800,600" in the start, as well as "SetBlend ALPHABLEND". Then I have a function that loads the images (so far it's only three images), using "imagevar = LoadImage("imageblabla.png",MASKEDIMAGE)", using 255,0,255 as the masked color (kind of a magenta-ish color I guess), using "SetMaskColor 255,0,255", which I put before the LoadImage's. And yes, all my image variables are set with the TImage type, in a header file, and I use strict in the beginning of the program, so that I have to define every variable before using it (and the game compiles just fine... only problem is that it screws up the drawing of the images). I draw the images with "DrawImage imagevar,x,y" (where x and y are the coordinates, and not two variables named x and y).

    Anyone has any ideas as to why this happens? I really don't get it. This is what it looks like:

    www.orias.se/screwedupimages.png

    This is what it SHOULD look like:

    www.orias.se/correctimages.png (I created this picture with paint, using the screwed up one)

    Regards,
    Anton
     
  2. JGOware

    Indie Author

    Joined:
    Aug 22, 2007
    Messages:
    1,578
    Likes Received:
    0
    Did you mess with the setcolor at all? You may need to reset it before drawing anything. SetColor(255,255,255)

    As a general note you may to have a reset function something like this at the start or when you want to reset everything.

    SetAlpha(1)
    SetTransform(0,1,1)
    SetBlend(AlphaBlend)
    SetColor(255,255,255)
     
  3. Crimson Knight

    Crimson Knight New Member

    Joined:
    Sep 10, 2006
    Messages:
    31
    Likes Received:
    0
    Global settings stay until changed. So like JGOware said, if you don't change the global color setting back, EVERYTHING stays the same color until you change to another color, like SetColor(255,255,255).

    So for example:

    Code:
    Function draw_stuff:Int()
    SetColor(255,0,0)
    DrawImage(poops,x,y)
    SetColor(255,255,255)
    End Function
    This is good practice, though a reset function is good too.

    I'm a Blitzer, and I use SuperStrict myself. :) I've been raised by my Game Maker days to specify EVERYTHING.
     
  4. Indiepath

    Indiepath New Member

    Joined:
    Aug 22, 2004
    Messages:
    999
    Likes Received:
    0
    turn off filtering?
     
  5. orias

    orias New Member

    Joined:
    Nov 19, 2008
    Messages:
    3
    Likes Received:
    0
    THANK YOU. This helped ALOT. Yes I have been messing around with setcolor alot, but reseting it helped ALOT. THANKS! :)
     
  6. charlie

    Original Member

    Joined:
    Dec 13, 2005
    Messages:
    42
    Likes Received:
    0
    Just to qualify this, Blitzmax is state based, meaning that any change you make to colour, scale, blend, rotation or alpha is carried through to whatever else you draw until you explicitly change them.

    Cheers
    Charlie
     
  7. orias

    orias New Member

    Joined:
    Nov 19, 2008
    Messages:
    3
    Likes Received:
    0
    Thanks, Charlie. Good to know. Good to know indeed! :)
     

Share This Page

  • About Indie Gamer

    When the original Dexterity Forums closed in 2004, Indie Gamer was born and a diverse community has grown out of a passion for creating great games. Here you will find over 10 years of in-depth discussion on game design, the business of game development, and marketing/sales. Indie Gamer also provides a friendly place to meet up with other Developers, Artists, Composers and Writers.
  • Buy us a beer!

    Indie Gamer is delicately held together by a single poor bastard who thankfully gets help from various community volunteers. If you frequent this site or have found value in something you've learned here, help keep the site running by donating a few dollars (for beer of course)!

    Sure, I'll Buy You a Beer