It's competition time!
All, right. I haven't participated in one of these compos yet, but I figure it will give me some practice! I'm not really worried about qualifying, so I'll go ahead and ask a question in the context of the uploaded content. If this should be moved, just say so. I hate to add unwanted clutter! I just wanted to get the attention of people working with this file.
What is the bit-depth of the bmp/png? I think it's 8-bit, and I'm having a serious headache trying to use it in a 24-bpp screen. I can't lock down the transparency value, and anything I try to do to the image either crashes FB of shows nothing when I PUT it. I tried searching the forum for anything about converting 8bpp to 24bpp, but I can't find squat!
You may all now line up and kick the n00b.
What is the bit-depth of the bmp/png? I think it's 8-bit, and I'm having a serious headache trying to use it in a 24-bpp screen. I can't lock down the transparency value, and anything I try to do to the image either crashes FB of shows nothing when I PUT it. I tried searching the forum for anything about converting 8bpp to 24bpp, but I can't find squat!
You may all now line up and kick the n00b.
From the Help File...
[Lines up for his kick] :-)
Cheers
-Vince
Code: Select all
ImageConvertRow Converts a row of image data into another color depth
Syntax
Declare Sub ImageConvertRow ( ByVal src As Any Ptr, ByVal src_bpp As Integer, ByVal dst As Any Ptr, ByVal dst_bpp As Integer, ByVal width As Integer, ByVal isrgb As Integer = 1 )
Usage
ImageConvertRow( src, src_bpp, dst, dst_bpp, width )
or
ImageConvertRow( src, src_bpp, dst, dst_bpp, width, isrgb )
Parameters
src
The address of the start of the source row. The source can either be a full-color image with a bit depth of 24 or 32 bits per pixel, or a paletted image with a bit depth of 1-8 bits per pixel. Converting a paletted image will only work properly if you are in a screen mode that is using the correct palette for the image when you do the conversion.
src_bpp
The number of bits per pixel in the source row. 1-8, 24 and 32.
dst
The address of the start of the destination row. The image can be a full-color image of 16 or 32 bits per pixel. If the source is a paletted image, the destination can also be a paletted image of 1 to 8 bits per pixel.
dst_bpp
The number of bits per pixel in the destination row. Valid values for this are 1-8, 16 and 32.
width
The length of the row in pixels.
isrgb
A value of zero indicates that the Red and Blue channels are the other way round in the source image. Use this switch if you want the Red and Blue channels to be swapped in the conversion.
Description
Copies the row of an image from one memory location to another, converting the color information in each pixel to match the destination image.
Example
Const As Integer w = 64, h = 64
Dim As Any Ptr img8, img32
Dim As Integer i, y
'' create a 32-bit image, size w*h:
ScreenRes 320, 200, 32, , -1
img32 = ImageCreate(w, h)
'' create an 8-bit image, size w*h:
ScreenRes 320, 200, 8, , -1
img8 = ImageCreate(w, h)
'' spatter some random dots into the image:
For i = 1 To 1000
PSet img8, ( Int(Rnd * w), Int(Rnd * h) ), Int(Rnd * 256)
Next i
'' open a graphics window in 8-bit mode, and PUT the image into it:
ScreenRes 320, 200, 8
WindowTitle "8-bit color mode"
Put (10, 10), img8
Sleep
'' copy the image data into a 32-bit image
For y = 0 To h - 1
ImageConvertRow(img8 + (4 + y * w ), 8, _
img32 + (4 + y * w * 4), 32, _
w)
Next y
'' open a graphics window in 32-bit mode and PUT the image into it:
ScreenRes 320, 200, 32
WindowTitle "32-bit color mode"
Put (10, 10), img32
Sleep
'' remove the images from memory:
ImageDestroy img8
ImageDestroy img32
Differences from QB
New to FB
See also
ScreenRes
Get (Graphics)
Put (Graphics)
ImageCreate
ImageDestroy
Cheers
-Vince
-
- Posts: 2338
- Joined: May 31, 2005 9:59
- Location: Croatia
- Contact:
I have a problem with two rules.
Binary version of the entry should be provided in a separate download. May I ask why?
Second, what do you mean that we should provide binaries of external libraries, if we are going to use such? Are you referring to dll files like the one for FMOD?
Anyway, I contemplated yesterday and today about a concept to work on and decided on one. Really no time to waste so if I didn't pick the best, there won't be time to fix this.
It's sort of a combination of two genres, both not really being original, but I think the way how I imagined that these two genres combine is really cool.
I've dropped two ideas so if some of you are looking for one I'll present them now. Free for grabs.
First one involves the idea that the player controls the invaders somehow, and the foe is the ship at the bottom. This of course would require some changes in the gameplay and starting size of the invaders group. The player would have the control over the horizontal direction of the invaders, and they would move down with every touch of the opposite edge of the screen.
Second idea was basically to use the code from my Dealing with Angles Part II tutorial to make a top-down 360° rotating shooter. I kinda imagine using an invader as the main ship and D.J.Peters' multiput to actually rotate the sprites. I gave on that simply because this sort of gameplay packed in a mini-game does not excite me at this moment (perhaps for a bigger project). But I think this code can be a nice solution for some of you because the example game from the tutorial is basically the entire game skeleton built-up. All you need to do is to actually make a game out of it.
Binary version of the entry should be provided in a separate download. May I ask why?
Second, what do you mean that we should provide binaries of external libraries, if we are going to use such? Are you referring to dll files like the one for FMOD?
Anyway, I contemplated yesterday and today about a concept to work on and decided on one. Really no time to waste so if I didn't pick the best, there won't be time to fix this.
It's sort of a combination of two genres, both not really being original, but I think the way how I imagined that these two genres combine is really cool.
I've dropped two ideas so if some of you are looking for one I'll present them now. Free for grabs.
First one involves the idea that the player controls the invaders somehow, and the foe is the ship at the bottom. This of course would require some changes in the gameplay and starting size of the invaders group. The player would have the control over the horizontal direction of the invaders, and they would move down with every touch of the opposite edge of the screen.
Second idea was basically to use the code from my Dealing with Angles Part II tutorial to make a top-down 360° rotating shooter. I kinda imagine using an invader as the main ship and D.J.Peters' multiput to actually rotate the sprites. I gave on that simply because this sort of gameplay packed in a mini-game does not excite me at this moment (perhaps for a bigger project). But I think this code can be a nice solution for some of you because the example game from the tutorial is basically the entire game skeleton built-up. All you need to do is to actually make a game out of it.
-
- Posts: 2428
- Joined: Jul 19, 2006 19:17
- Location: Sunnyvale, CA
- Contact:
One of mine involves a giant magnifying glass!! :-Panonymous1337 wrote:This looks great. Thanks for posting the rules and everything as such ^.^;; I already have several ideas rolling around.
Multiput() on an 8x8 sprite!?? Ha ha ha... (It won't work well... ;-))I kinda imagine using an invader as the main ship and D.J.Peters' multiput to actually rotate the sprites.
-
- Posts: 2338
- Joined: May 31, 2005 9:59
- Location: Croatia
- Contact:
-
- Posts: 2428
- Joined: Jul 19, 2006 19:17
- Location: Sunnyvale, CA
- Contact:
ERMLachie Dazdarian wrote:Erm...scale it?
Multiput, for one thing, won't typically show the last two columns or rows of the source of the picture it puts, and the rotation combined with a big scale looks very inaccurate.
-
- Posts: 2338
- Joined: May 31, 2005 9:59
- Location: Croatia
- Contact:
You are tempting me to prove you wrong...again. But sadly I don't have time for this.
Anyway, I have a question for ciw. ciw, will I be breaking some rule if I convert the BMP image to 24-bit color depth and then use it like that in my program? No pixels are changed with this, only the color depth. I find it rather annoying to use certain routines to convert this image to 32-bit inside the code while I can easily do that with Paint Shop Pro or some other drawing program.
Anyway, I have a question for ciw. ciw, will I be breaking some rule if I convert the BMP image to 24-bit color depth and then use it like that in my program? No pixels are changed with this, only the color depth. I find it rather annoying to use certain routines to convert this image to 32-bit inside the code while I can easily do that with Paint Shop Pro or some other drawing program.
Lachie
I would consider using an outside editor like Photoshop as violating the spirit of the compo. Not everyone is blessed with good image editors but we are all blessed with FreeBASIC.
From what I understood, as long as the original images are used, we are free to do whatever we want (in code) with them. I myself have already changed the images BPP internally.
It was my impression that the game MUST run with the original graphics and sounds. All conversions must happen in code.
@CIW
Is this correct?
-Vince
I would consider using an outside editor like Photoshop as violating the spirit of the compo. Not everyone is blessed with good image editors but we are all blessed with FreeBASIC.
From what I understood, as long as the original images are used, we are free to do whatever we want (in code) with them. I myself have already changed the images BPP internally.
It was my impression that the game MUST run with the original graphics and sounds. All conversions must happen in code.
@CIW
Is this correct?
-Vince
-
- Posts: 2338
- Joined: May 31, 2005 9:59
- Location: Croatia
- Contact:
if all that was happening was changing bit depth rather than hafta spend time making the program do it, it shouldn't matter, and wouldn't cause any unfair advantage imo.
@vdecampo: you absolutely do NOT need a great image editor for something so simple.
for those that may not have something to convert image bit depths here's a small program I know of that can do this and it can convert to a ton of diff formats if that's not against the rules.
http://www.irfanview.com
just go to the download section.
it's only 1.1 mb.
@vdecampo: you absolutely do NOT need a great image editor for something so simple.
for those that may not have something to convert image bit depths here's a small program I know of that can do this and it can convert to a ton of diff formats if that's not against the rules.
http://www.irfanview.com
just go to the download section.
it's only 1.1 mb.
-
- Posts: 2338
- Joined: May 31, 2005 9:59
- Location: Croatia
- Contact:
As I already mentioned, IrfanView has some problems converting the background color properly. Well, maybe that's with the version I'm using.
Anway, I went on using the 8-bit image as I don't want to annoy some people.
For people who had the same problems as I did, this is the solution:
http://www.freebasic.net/wiki/wikka.php ... ConvertRow
Anway, I went on using the 8-bit image as I don't want to annoy some people.
For people who had the same problems as I did, this is the solution:
http://www.freebasic.net/wiki/wikka.php ... ConvertRow
-
- Posts: 2428
- Joined: Jul 19, 2006 19:17
- Location: Sunnyvale, CA
- Contact:
You know, Ciw1973 could just provide a 24-bit bitmap to begin with, but he didn't...
Two questions:
1) Can I use Draw String? I don't see why I should load a font from a bitmap that is so much like the built-in font.
2) Can I submit multiple entries? Can I win more than one prize if I have two good entries?
Two questions:
1) Can I use Draw String? I don't see why I should load a font from a bitmap that is so much like the built-in font.
2) Can I submit multiple entries? Can I win more than one prize if I have two good entries?
-
- Posts: 2338
- Joined: May 31, 2005 9:59
- Location: Croatia
- Contact: