Cse 380 computer game programming guis for games l.jpg
This presentation is the property of its rightful owner.
Sponsored Links
1 / 20

CSE 380 – Computer Game Programming GUIs for Games PowerPoint PPT Presentation


  • 292 Views
  • Uploaded on
  • Presentation posted in: Sports / Games

CSE 380 – Computer Game Programming GUIs for Games ICON-28 Science Fiction Convention Founded by Stony Brook Students http://www.iconsf.org/ At Suffolk County Community College this year April 3 rd -5 th E-Gaming Track they are looking for Stony Brook students to lend a hand

Download Presentation

CSE 380 – Computer Game Programming GUIs for Games

An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Presentation Transcript


Cse 380 computer game programming guis for games l.jpg

CSE 380 – Computer Game ProgrammingGUIs for Games


Icon 28 l.jpg

ICON-28

  • Science Fiction Convention

    • Founded by Stony Brook Students

    • http://www.iconsf.org/

  • At Suffolk County Community College this year

    • April 3rd-5th

  • E-Gaming Track

    • they are looking for Stony Brook students to lend a hand

    • Interested? Contact Sandra Dumais

      • [email protected]


Game gui controls l.jpg

Game GUI Controls

  • Stylistically fit in with game theme

    • drawn as artwork

    • careful font/color selection

  • Same rules should apply as with other GUIs

    • align components

    • uniform style

    • balance

    • clarity (single word options are best)

    • keep it simple

    • minimize depth

    • don’t make assumptions about your player’s IQ


What are game guis for l.jpg

What are Game GUIs for?

  • Starting/Stopping games

    • New Game, Save Game, Load Game, Pause, Continue, Quit

  • Game Options

    • level of difficulty

    • character selection & properties (RPG in particular)

    • chapter selection

  • Custom Controls Setup

  • In-game Decisions (strategy in particular)

  • Providing Help


Menu vs in game controls l.jpg

Menu vs. In Game Controls

  • Menu controls, typically

    • simple, elegant

    • textual

    • centered on screen

    • allows for menu tabbling

    • tied to game controllers as well

  • In-game controls, typically

    • graphical

    • at bottom of screen

    • carefully grouped

    • tied to keystrokes for PC gaming (very important)


Halo s menu gui l.jpg

Halo’s Menu GUI


Starcraft s in game gui l.jpg

Starcraft’s In-game GUI


How might we make a gui l.jpg

How might we make a GUI?

  • We’ll build our own buttons

  • Download, unzip, and examine the contents of:

    • EmptyGame.zip

    • my advice: set breakpoint on first line and debug a few frames

      • this means you’ll see every line execute


We know how do render images l.jpg

We know how do render images

  • Use images to render:

    • buttons

    • cursor

    • other GUI images

  • For buttons, use 2 images

    • mouse over

    • normal

    • each frame update the state based on mouse position


How do we test if the mouse is over a button l.jpg

How do we test if the mouse is over a button?

void Button::updateMouseOver(POINT *mousePoint)

{

// IS THE CURSOR OVER THIS BUTTON?

if ((mousePoint->x >= x) &&

(mousePoint->x <= x + width) &&

(mousePoint->y >= y) &&

(mousePoint->y <= y + height) )

{

mouseOver = true;

}

else

{

mouseOver = false;

}

}


Render lists l.jpg

Render Lists

  • Common approach in games

  • Each frame:

    • make a list of items to render

    • iterate through the list and render each item

    • throw out the list

  • RenderList is built and destroyed each frame

  • We’ll use 2 render lists:

    • one for the GUI

    • one for the game world


Render list cheating l.jpg

Render List Cheating

  • We’re not really going to use a list

  • Why?

    • we don’t want to allocate memory dynamically

  • Instead, we’ll use a giant array and pretend it’s a list

    • give the array a max size

    • don’t exceed that max size


A note about platform independence l.jpg

A note about platform independence

  • Today our game’s graphics are drawn using DirectX

  • Tomorrow we may wish to use OpenGL

  • How can we minimize the difficulty of switching?

    • virtual functions

    • See:

      • GameGraphics & DirectXGameGraphics

      • TextureManager & DirectXTextureManager


To maximize platform independence l.jpg

To maximize platform independence

  • Confine technology-specific types and methods to technology-specific classes

  • Don’t let DirectX spill over into your data management classes


How do we respond to input l.jpg

How do we respond to input?

  • Get Input

  • If game state is in main menu

    • Process input for main menu screen components

    • Draw main menu screen

      • Main Menu GUI

  • If game state is in game

    • Process input for game screen components

    • Draw game screen

      • Game GUI & Game World


Getting input l.jpg

Getting Input

  • We’ll use Windows methods

  • To test if a key is currently pressed:

    • GetAsyncKeyState(key) & 0X8000

  • To get the current mouse position:

    • GetCursorPos(mousePoint);

  • To test if a mouse button is currently pressed:

    • GetAsyncKeyState(VK_LBUTTON) & 0X8000


Each frame l.jpg

Each Frame

  • We update data for:

    • all keys

      • first key press?

      • fill out struct for each key

    • mouse/cursor position

    • is mouse over buttons?


Gameinput l.jpg

GameInput

  • Each frame:

    void GameInput::processInput(Game *game, WINDOWINFO wi)

    {

    updateCursorPosition(wi, game->getGUI()->getCursor());

    updateInputState();

    respondToKeyboardInput(game);

    respondToMouseInput(game);

    }


Custom behavior l.jpg

Custom Behavior

  • In the example I’ve given you, I have:

    • a core library

    • a custom example game

  • Customized behavior is loaded by key child classes:

    • DirectXGraphics

    • EGButtonEventHandler

    • EGKeyEventHandler

    • EGTextGenerator


Questions for you to figure out l.jpg

Questions for you to figure out

  • Where is the programmed response to hitting SHIFT-C?

  • In what order are the GUI items rendered?

  • How can I speed up or slow down the frame rate?

  • How can you render something as more transparent?

  • How can we render changing text?


  • Login