Changeset 21 for trunk/src


Ignore:
Timestamp:
Jun 29, 2010, 2:27:18 PM (11 years ago)
Author:
sam
Message:

Add a sprite following the mouse.

Location:
trunk/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/test-map.cpp

    r20 r21  
    3232int nlayers = 0;
    3333
     34/* Player coordinates */
     35int playerx = 0, playery = 0;
     36
    3437// Load Bitmaps And Convert To Textures
    3538void LoadGLTextures(void)
     
    197200
    198201    for (int i = 0; i < nlayers; i++)
     202    {
     203        glPushMatrix();
     204        if (i == 2)
     205            glTranslatef(playerx, playery, 0.0f);
    199206        PutMap(layers[i], width, height);
     207        glPopMatrix();
     208    }
    200209}
    201210
     
    217226
    218227        video->Refresh(33.33333f);
     228
     229        SDL_GetMouseState(&playerx, &playery);
    219230
    220231        /* This could go in a separate function */
  • trunk/src/video.cpp

    r18 r21  
    5454
    5555    SDL_WM_SetCaption(title, NULL);
     56    SDL_ShowCursor(0);
     57    SDL_WM_GrabInput(SDL_GRAB_ON);
    5658
    5759    /* Initialise OpenGL */
Note: See TracChangeset for help on using the changeset viewer.