|
Im a beginner needing help! xD |
Thiago Lazier
Member #10,219
September 2008
|
well... i'm starting with allegro now and i'm having a lot of troubles... So... i'm needing help... =X while (!key[KEY_ESC]) { } Sorry for mistakes in the writing, im from brazil and still have a lot to learn in english |
Sol Blast
Member #9,655
April 2008
|
Check the returns. Once you've called load_bitmap, test to see if it worked like so... BITMAP *a = load_bitmap("E:\\Documents and Settings\\Servidor\\Meus documentos\\1.bmp", NULL); BITMAP *b = load_bitmap("E:\\Documents and Settings\\Servidor\\Meus documentos\\2.bmp", NULL); if (!a) { allegro_message("Could not load bitmap a!"; allegro_exit(); } if (!b) { allegro_message("Could not load bitmap b!"; allegro_exit(); }
If you get either of those message popping up then you've probably set the wrong path for the bitmap or allegro doesn't like them for some reason. |
bamccaig
Member #7,536
July 2006
|
@Thiago Lazier: Just a note: on the forums you can surround code with BBCode tags (i.e. [code]text[/code]) and it will maintain white-space, attempt to highlight the source, and even provides links to the Allegro manual and AFAIK a C standard library reference. You can see the rest of the BBCode syntax if you click the "Help" option in the toolbar above the post textarea (IMO it's hard to spot until you know it's there though)... Thiago Lazier said:
while (!key[KEY_ESC]) { BITMAP *a = load_bitmap("E:\\Documents and Settings\\Servidor\\Meus documentos\\1.bmp", NULL); BITMAP *b = load_bitmap("E:\\Documents and Settings\\Servidor\\Meus documentos\\2.bmp", NULL); draw_sprite (screen, a, 0, 0); draw_sprite (screen, b, 0, 0); }
Assuming the above code is working, it repeatedly loads 1.bmp and 2.bmp before drawing them (technically leaking the memory consumed by the past iterations' loaded BITMAPs). So first of all, you're going to want to move the load_bitmap calls outside of the while loop. Secondly, I've heard of two solutions for eliminating the "flickering" screen problem. Double buffering and using Allegro's vsync routine. Double buffering is a technique where you create an empty BITMAP structure (i.e. your buffer) with the same dimensions as the screen and draw everything to it. Then, when your game loop / frame ends you draw the buffer to the screen. System memory is much faster than video memory, IIRC, so this results in the whole operation being much faster, eliminating the visible flickering.
I've never used vsync before so I can't be sure on the syntax, but if you're still having problems after double buffering then you can give it a try too. If you're able to show us more code then we can probably help you correct some other common mistakes before you get very far. A lot of people neglect return values, which leads to unexpected errors. If a routine returns a value indicating success or failure make sure to check that it was successful and react accordingly. Timing is another common problem. IMHO, attempting to write an RPG before Oct 2 when you're this new is unlikely to succeed. You might want to negotiate with your teacher/professor either on the project or the deadline. -- acc.js | al4anim - Allegro 4 Animation library | Allegro 5 VS/NuGet Guide | Allegro.cc Mockup | Allegro.cc <code> Tag | Allegro 4 Timer Example (w/ Semaphores) | Allegro 5 "Winpkg" (MSVC readme) | Bambot | Blog | C++ STL Container Flowchart | Castopulence Software | Check Return Values | Derail? | Is This A Discussion? Flow Chart | Filesystem Hierarchy Standard | Clean Code Talks - Global State and Singletons | How To Use Header Files | GNU/Linux (Debian, Fedora, Gentoo) | rot (rot13, rot47, rotN) | Streaming |
Albin Engström
Member #8,110
December 2006
|
Hello Thiago Lazier, you probably won't appreciate what I'm about to say. Even if you had "the skills" you probably won't finish a full fledged RPG in a week, unless it's very small. So in case you're aiming that high you should reconsider. You could however make the engine in a week, and maybe even throw in an editor. I'm not sure how new you are to game programming but you should aim at a simple engine to begin with. I'm sure your programming teacher will be impressed with that. Just a tip, you do whatever you think is best. Oh, and good luck with leveling your ragnarok characters. |
Dario ff
Member #10,065
August 2008
|
RPG in a week? Your teacher must play speedhack . Don´t even try an RPG in a week. Making a battle system, datbase, and... well, you got the idea. anyways, My best solution for you would be that you just copy some of the examples on the allegro folder to get a page-flipping system or a simple double buffer. TranslatorHack 2010, a human translation chain in a.cc. |
Matthew Leverton
Supreme Loser
January 1999
|
Don Freeman
Member #5,110
October 2004
|
Matthew that was awesome!:D;D8-) -- |
Albin Engström
Member #8,110
December 2006
|
Nice Matthew! |
Schyfis
Member #9,752
May 2008
|
That made my day. ________________________________________________________________________________________________________ |
Tobias Dammers
Member #2,604
August 2002
|
The song itself is one of the most successful monday projects ever.:D --- |
Don Freeman
Member #5,110
October 2004
|
Or Tuesday, for that matter!:P -- |
OnlineCop
Member #7,919
October 2006
|
Don Freeman said: Or Tuesday, for that matter!:P No, no. Tuesday is the other group's Group Project. As I recall, there were three groups: Monday, Tuesday and Duke Nukem Forever.
|
Neil Black
Member #7,867
October 2006
|
Quote: As I recall, there were three groups: Monday, Tuesday and Duke Nukem Forever. Sigged.
|
|