Author Topic: Sprite2Mem question  (Read 2182 times)

Offline CptnRoughnight

  • Mr. Polyvector
  • ***
  • Posts: 114
    • View Profile
Sprite2Mem question
« on: 2013-Jan-10 »
Hi,

I have a problem by using Sprite2Mem. First my image was warped and now i got only a white screen. Could anybody help me, please?
https://dl.dropbox.com/u/51078888/Sprite2Mem.zip

I have already used the search function but found nothing.

edit : I want to use Sprite2Mem to load a Bitmap and convert it to my MAP- format.

Thansk in advance!

« Last Edit: 2013-Jan-10 by Dr.Damn Fist »
Es ist kein Mond....

A young band from Thuringia with a lot of potential :
http://youtu.be/diMBlNspsD8

Offline hardyx

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 505
    • View Profile
Re: Sprite2Mem question
« Reply #1 on: 2013-Jan-11 »
You are using a function analyseMap() wich only returns true or false, and you are only painting white (255,255,255) pixels. The function ExtractColor is returning true of false, ignoring the colour components: red, green, blue. Briefly, you are painting the black pixels in the .bmp image with the colour white.

P.S. You can post the .gbas code in your message too.
« Last Edit: 2013-Jan-11 by hardyx »

Offline CptnRoughnight

  • Mr. Polyvector
  • ***
  • Posts: 114
    • View Profile
Re: Sprite2Mem question
« Reply #2 on: 2013-Jan-11 »
Yes, thats true.

It's only extracted from the main project to test this function. The problem is that the image is distorted, i want to know why?
Es ist kein Mond....

A young band from Thuringia with a lot of potential :
http://youtu.be/diMBlNspsD8

Offline hardyx

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 505
    • View Profile
Re: Sprite2Mem question
« Reply #3 on: 2013-Jan-11 »
If your image has 500x500 pixels, then you must to use curMapBuffer%[x+y*500] in the analyseMap() function. And I think you must to change the FOR loops putting first "FOR y" and then "FOR x". The inner loop moves in the horizontal direction.

Offline CptnRoughnight

  • Mr. Polyvector
  • ***
  • Posts: 114
    • View Profile
Re: Sprite2Mem question
« Reply #4 on: 2013-Jan-14 »
Thank you that has helped first. But I have another problem. I made a completely white bitmap and interrogated by white. Everything works fine so far. Then I clean painted a black line and it works very well. Only now when I query to red, even if no red in the picture, then he painted all white and red points.
It is the same code as in the first post. Hope someone can see what I'm doing wrong.

powered by Google-Translator ;)

MfG
Es ist kein Mond....

A young band from Thuringia with a lot of potential :
http://youtu.be/diMBlNspsD8

Offline hardyx

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 505
    • View Profile
Re: Sprite2Mem question
« Reply #5 on: 2013-Jan-14 »
You can use the debug button before compiling and use breakpoints to see the values of variables. You can compare the colour value at once without extracting the components using RGB(r,g,b) function with RGB(255,0,0) // red

BTW: You must to compare with the exact colour value, for example RGB(255,0,0) if you used pure light red in your graphic. Maybe the colour in the graphic is other tone.