The very first few lines of code!

For discussion of the code running behind the game

Moderator: Staff

User avatar
Roots
Dictator
Posts: 8662
Joined: Wed Jun 16, 2004 6:07 pm
Location: Austin TX
Contact:

The very first few lines of code!

Postby Roots » Fri Jun 25, 2004 5:26 am

I decided to test my skill today and wrote some C++ code using the SDL libraries. :approve: The program loads in a JPEG image at 800x600x24 screen resolution and displays it on the screen for 2 seconds. Then a menu is displayed on the console that lets a user pick a different image to display, change the screen resolution, or quit the program. I know it's nothing special (250 lines of code already though!), but its a start. Basically I'm just getting my feet wet, but I have all the knowledge I need to program the boot screen.


For you guys who want to see the code I put it up on my site for you to download. (EDIT: Forgot to mention you need to have the SDL and SDL-development libraries installed to compile and run this code.)

http://expert.ics.purdue.edu/~olsent/allacrost/allacrost.cc
(the following 4 files should go in a directory called "img" that is a sub directory of the directory allacrost.cc is placed)
http://expert.ics.purdue.edu/~olsent/allacrost/lodoss_12_800.jpg
http://expert.ics.purdue.edu/~olsent/allacrost/lodoss_12_1024.jpg
http://expert.ics.purdue.edu/~olsent/allacrost/reflect800.jpg
http://expert.ics.purdue.edu/~olsent/allacrost/reflect1024.jpg

(EDIT; crap completely forgot to give you guys the command to compile it! The ` are backticks. Look at your tilde key.)

Code: Select all

g++ allacrost.cc -o allacrost `sdl-config --cflags --libs` -lSDL_image


I'm trying to figure out how to get the image to stretch/shrink to fit the screen resolution and how to get the mouse cursor to disappear. I just need to read some more. Oh if you want to view it in full screen then change the following lines of code:

Code: Select all

screen = SDL_SetVideoMode(800, 600, 24, SDL_ANYFORMAT);
// change this line (which occurs multiple times) to:
screen = SDL_SetVideoMode(800, 600, 24, SDL_ANYFORMAT | SDL_FULLSCREEN);


On one final note since I'm going to be working on the boot screen, what do you guys think it should look like? I think the menus should be 50% transparent and alligned on the right side of the screen. The currently selected command will be displayed using some kind of pointer or highlighting, not sure yet. The following commands will be displayed:

    New Game
    Load Game (this is the default command highlighted)
    Options (for changing screen resolution and key commands)
    Credits (for us ^^)
    Full Screen (hides the menu so the user can see the beautiful splash screen completely)


Later on we can let left arrow and right arrow cycle through the different boot screens. :approve:
User avatar
Balthazar
Former Staff
Posts: 732
Joined: Sun Jun 20, 2004 7:12 pm
Location: Penticton, BC
Contact:

Wahoo

Postby Balthazar » Fri Jun 25, 2004 8:06 am

Progress! Glad to see you got us going :D

Okay, that was your praise :bow: now comes be being an anal retentive prick (hey, it's a dirty job, but somebody has to do it :cool:).

First, the .cc. I have learned programming, and seen 98% of C++ programs use .cpp. .cc just seems....weird :eyebrow: I guess that should have been discussed in the coding standard thread, but it didn't come to mind.

Second, I know we're trying to be original, but if there is one tried and true tradition in video games, it's the setup of the loading screen. Centred horizontally, and usually towards the bottom if it is a small menu (which we have), or centred vertically if there is a large menu (in our case, irrelevant).

I also just happen to find symmetry very aesthetically pleasing.
"Homogenized?  No way, I like the ladies."
60 Tauren Shaman
31 Orc Warrior
21 Tauren Druid
18 Night Elf Hunter
12 Orc Warlock
Other various abandoned alts.
User avatar
Biohazard
Former Staff
Posts: 54
Joined: Wed Jun 16, 2004 7:03 pm
Contact:

Postby Biohazard » Fri Jun 25, 2004 4:01 pm

Good idea, i will work on a few pictured soon. BUT i think 50% is too much transparency. I think it should be 75 - 90% since transparency can make the font hard to read. Thats my opinion :)

New Game
Load Game (this is the default command highlighted)
Options (for changing screen resolution and key commands)
Credits (for us ^^)
Full Screen (hides the menu so the user can see the beautiful splash screen completely)



I wouldn't include full screen. I would rather say... that you define a key that hides the menues ( depends on the controls, if its arrow keys maybe Numpad 0 is good choice to hide menues and text to view the art :D )
User avatar
gorzuate
Developer
Posts: 2575
Joined: Thu Jun 17, 2004 3:03 am
Location: Hermosa Beach, CA
Contact:

Re: Wahoo

Postby gorzuate » Fri Jun 25, 2004 4:21 pm

Balthazar wrote:First, the .cc. I have learned programming, and seen 98% of C++ programs use .cpp. .cc just seems....weird :eyebrow: I guess that should have been discussed in the coding standard thread, but it didn't come to mind.


When I first learned C++ in high school, we did everything with .cpp. Then when I got to Purdue they did everything with .cc, so I kind of got used to it. But I still prefer .cpp, and it is something we need to decide on.
Image
User avatar
Roots
Dictator
Posts: 8662
Joined: Wed Jun 16, 2004 6:07 pm
Location: Austin TX
Contact:

Postby Roots » Fri Jun 25, 2004 7:26 pm

Alright then lets use .cpp. It doesn't really matter to me its just a freaking file extension!

Tim, I agree with what you said about the menu. Remember that was just a test, I still have to figure out how to center/resize/manipulate the images. I am completely like you in that symmetry is pleasing to me :D
User avatar
hamiko
Former Staff
Posts: 123
Joined: Tue Jul 06, 2004 8:31 pm

Postby hamiko » Fri Jul 09, 2004 11:50 pm

Nice, Nice..
Just Taking it Easy.

Return to “Programming”

Who is online

Users browsing this forum: No registered users and 6 guests