Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » couple questions...

This thread is locked; no one can reply to it. rss feed Print
couple questions...
MickyD
Member #2,409
June 2002

how can I use scancode_to_ascii and check if the user is holding shift and if so enter a capitol letter (for high score name entry). I have the function done, but no caps.

when I build the static version of allegroMp3 and link it using almp3.lib and try to compile using MSVC6 I get: error LNK2001: unresolved external symbol __imp__play_audio_stream
almp3.lib(almp3.obj) : error LNK2001: unresolved external symbol __imp__stop_audio_stream
almp3.lib(almp3.obj) : error LNK2001: unresolved external symbol __imp__free_audio_stream_buffer
almp3.lib(almp3.obj) : error LNK2001: unresolved external symbol __imp__get_audio_stream_buffer

and also, jpgAlleg 2.1 still wont compile for me (need MSVC6 version). I tried over and over with MingW32, but to no avail. I've been trying using MSVC's NMAKE program, but I only assumed that it would work. If anyone can help me out and tell me exactly how to compile the lib OR send me the files I need via email, that would be great: typosoft@hotmail.com

X-G
Member #856
December 2000
avatar

If (key[KEY_SHIFT]) isn't good enough?
Remember to check for caps state, though.

--
Since 2008-Jun-18, democracy in Sweden is dead. | 悪霊退散!悪霊退散!怨霊、物の怪、困った時は ドーマン!セーマン!ドーマン!セーマン! 直ぐに呼びましょう陰陽師レッツゴー!

Derezo
Member #1,666
April 2001
avatar

For the first question, you could do something like this.

char k = scancode_to_ascii(scancode);
if(key[KEY_RSHIFT] || key[KEY_LSHIFT)
  k = toupper(k);

// then deal with k.

[edit: beaten by the cookie, and toupper is in ctype.h btw]

"He who controls the stuffing controls the Universe"

MickyD
Member #2,409
June 2002

Okay, got the highscores thing working, and for the most part the jpglib. I just included the files in my program. But because I included the jpeg.c and jpgalleg.h files all my calls to sin and cos are very jumpy now instead of smooth. Maybe I should use fixsin & fixcos? If so, how do you use them (because when I tried I didn't get the same results as sin and cos using a float for the value).

X-G
Member #856
December 2000
avatar

Quote:

But because I included the jpeg.c and jpgalleg.h files

Aigh! Never include .c files!

--
Since 2008-Jun-18, democracy in Sweden is dead. | 悪霊退散!悪霊退散!怨霊、物の怪、困った時は ドーマン!セーマン!ドーマン!セーマン! 直ぐに呼びましょう陰陽師レッツゴー!

MickyD
Member #2,409
June 2002

then how should I do it?

X-G
Member #856
December 2000
avatar

Compile them and link with them, perhaps? :P

--
Since 2008-Jun-18, democracy in Sweden is dead. | 悪霊退散!悪霊退散!怨霊、物の怪、困った時は ドーマン!セーマン!ドーマン!セーマン! 直ぐに呼びましょう陰陽師レッツゴー!

MickyD
Member #2,409
June 2002

screw the jpglib. I have it working now and if I compress an image to the point where it makes a difference I lost my transparency for my game (because it makes the image lossy). But when I use the lowest compression for a jpg (which decreases the file size by half) and then run the allegro grabber, it saves the datafile to 130% the original file size! So I'll just use the bitmaps instead.

I still am having problems with allegroMp3. Anybody know what I need to do? I ran and compiled the static version and copied the lib to my vc98\lib\ directory. Then I included the .h file and added almp3.lib to my link tab. It doesn't spit out any errors when I don't use any functions from the lib, but when I add in the functions from the example program I get: almp3.lib(almp3.obj) : error LNK2001: unresolved external symbol __imp__play_audio_stream
almp3.lib(almp3.obj) : error LNK2001: unresolved external symbol __imp__stop_audio_stream
almp3.lib(almp3.obj) : error LNK2001: unresolved external symbol __imp__free_audio_stream_buffer
almp3.lib(almp3.obj) : error LNK2001: unresolved external symbol __imp__get_audio_stream_buffer

Mae Mutts
Member #3,766
August 2003
avatar

sounds like the mp3 library is referencing another library that you don't have. Just my 2 pennies.

Mae

Tobias Dammers
Member #2,604
August 2002
avatar

Why put jpg's into a datafile? Wanna keep others from using them?
Anyway, jpg is only good at "smooth" images like photographs or blurry backgrounds or the like. Games usually need sharp edges, and a single sprite seldom uses many colors. You might want to use gifs instead? (Plus they support mask colors)

---
Me make music: Triofobie
---
"We need Tobias and his awesome trombone, too." - Johan Halmén

Fladimir da Gorf
Member #1,565
October 2001
avatar

Use PNGs. Good non-lossy compression and a higher bit-depth support.

OpenLayer has reached a random SVN version number ;) | Online manual | Installation video!| MSVC projects now possible with cmake | Now alvailable as a Dev-C++ Devpack! (Thanks to Kotori)

Derezo
Member #1,666
April 2001
avatar

PNG's are the way to go. :)
Personally, I just use BMP's until the size exceeds a couple megs.

Quote:

Why put jpg's into a datafile? Wanna keep others from using them?

You can also load the jpgs from a single datafile instead of having hundreds of jpg's... and it also offers more compression (although I don't know if jpgs would compress well with datafiles). Datafiles are excellent organizers. :)

"He who controls the stuffing controls the Universe"

MickyD
Member #2,409
June 2002

I'm just not going to worry about anything other than bitmaps. I've been working on this game for about a month and it is pretty much done. The only thing I don't like about it is that it's a 6 meg download.

Anyways, here's a question: how can I change an executable's icon using an icon stored in the exe using MSVC?

and I think the mp3 library is trying to access the mp3123 lib or something?

Go to: