Changeset 21


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

Add a sprite following the mouse.

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/maps/testmap.tmx

    r20 r21  
    22<map version="1.0" orientation="orthogonal" width="32" height="32" tilewidth="32" tileheight="32">
    33 <tileset firstgid="1" name="Road" tilewidth="32" tileheight="32">
    4   <image source="art/test/groundtest.png"/>
     4  <image source="../art/test/groundtest.png"/>
    55 </tileset>
    66 <layer name="Layer 1" width="32" height="32">
     
    1111 <layer name="Layer 1.5" width="32" height="32">
    1212  <data encoding="base64" compression="gzip">
    13    H4sIAAAAAAAAA+3TwQkAIAhGYVdpBZug/ZfqFISHItD+y/sG0AeWGZahDrhYfa1wx8vsrA5PmlOx/8eb8NBQed/TfuUd3LQdcf/e0EUNKur/CAAAgDoTUy0wRgAQAAA=
     13   H4sIAAAAAAAAA+3TsQ0AIAhEUVZxBTZw/6WsaCg0JuBZ/DcAdwlghjDVBQ6i32jMuJld1cOL5nTkv7gJTx0697vLV+7BTdsj5//QQUX9jwAAAOizAOK0B+4AEAAA
     14  </data>
     15 </layer>
     16 <layer name="Layer perso" width="32" height="32">
     17  <data encoding="base64" compression="gzip">
     18   H4sIAAAAAAAAA+3BAQkAAAACoD71/1s/Qm0AAACAdwMtfmIFABAAAA==
    1419  </data>
    1520 </layer>
    1621 <layer name="Layer 2" width="32" height="32">
    1722  <data encoding="base64" compression="gzip">
    18    H4sIAAAAAAAAA2NgGDzAcKAdQAAMdvcNRzAa5rgBFxBz0skudiBWR7NbA4i16GQ/sjvMgVgTii3obD/MDepQLD4A9o8EwIgHjwT7R8EoGAWjYBSMglEwCmgFAEc8wqAAEAAA
     23   H4sIAAAAAAAAA+2SQQqAMAwE60n0A4IfaOvNk/r/j5lACkuoChKoSAbm0KhsTBPCd1hbN/DA1/v7I61mPpNDo2zmIBM5iqnyDtetetT/u5FZTGJW2VxbjPI5b4dzT0bxkBw8l372YAPnTRfPSr4+x5tv3nC1c7VdsJo7ou8A61lpNXcE76ADcReKlnOvgfmO4ziO4zh/4gSy+XWyABAAAA==
    1924  </data>
    2025 </layer>
    2126 <layer name="Layer 3" width="32" height="32">
    2227  <data encoding="base64" compression="gzip">
    23    H4sIAAAAAAAAA+3OMQ0AIBAEwXMBKMC/Qz5BAdVTzCTbbwL8blWzeyL3Y1ejewQAAHh2AJ7ne/0AEAAA
     28   H4sIAAAAAAAAA+3RsQkAIBAEwc+0A7EC++9QxRaUN5iByxcuAvhdWRvZEUuP09GyQ7huf1uzIwAAeGoCAAVL1wAQAAA=
    2429  </data>
    2530 </layer>
    2631 <layer name="Layer 4" width="32" height="32">
    2732  <data encoding="base64" compression="gzip">
    28    H4sIAAAAAAAAA+3OsQ0AIAwDwbQwAhPABGT/yXCRgg0M0p/0tR0BvG+oXjXD/lZLzcrx4f6Rpn0AAAAA/zpR9K8YABAAAA==
     33   H4sIAAAAAAAAA+3RwQkAIAxDUY/qBjqBTqD7T2YLHlxAIvIf5JyShgC8r1ryThL0D0u3tB3FDecdU9R/k/9YtavzbZW7FksU9gMAAOB/C0yy2/0AEAAA
    2934  </data>
    3035 </layer>
    3136 <layer name="Layer 4.5" width="32" height="32">
    3237  <data encoding="base64" compression="gzip">
    33    H4sIAAAAAAAAA+3NMQ0AMAgAQSxRB/g3xYKBToTkLvn5I+BPLn3fVEt/AACAyxpif1G3ABAAAA==
     38   H4sIAAAAAAAAA2NgGAWjgDRgOED2GkGx4wDZPwowgeJAO2CEAFjaZ0CiB8INo2AUjIJRMApGwSgYBaNgaAMAylMPngAQAAA=
    3439  </data>
    3540 </layer>
  • 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.