File: dc_maple.cpp

package info (click to toggle)
wolf4sdl 1.7+svn262+dfsg1-5
  • links: PTS, VCS
  • area: contrib
  • in suites: bullseye, buster, sid
  • size: 4,112 kB
  • sloc: cpp: 34,696; ansic: 1,257; objc: 246; makefile: 159; sh: 44
file content (60 lines) | stat: -rw-r--r-- 1,294 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
//Wolf4SDL\DC
//dc_maple.cpp
//2009 - Cyle Terry

#if defined(_arch_dreamcast)

#include <SDL.h>
#include "dc/maple.h"
#include "dc/maple/controller.h"
#include "dc/maple/vmu.h"

int DC_MousePresent() {
    return maple_first_mouse() != 0;
}

void DC_WaitButtonPress(int button)
{
    int first_controller = 0;
    cont_cond_t controller_condition;

    first_controller = maple_first_controller();
    cont_get_cond(first_controller, &controller_condition);

    while((controller_condition.buttons & button)) {
        SDL_Delay(5);
        cont_get_cond(first_controller, &controller_condition);
    }
}


void DC_WaitButtonRelease(int button)
{
    int first_controller = 0;
    cont_cond_t controller_condition;

    first_controller = maple_first_controller();
    cont_get_cond(first_controller, &controller_condition);

    while(!(controller_condition.buttons & button)) {
        SDL_Delay(5);
        cont_get_cond(first_controller, &controller_condition);
    }
}


int DC_ButtonPress(int button)
{
    int first_controller = 0;
    cont_cond_t controller_condition;

    first_controller = maple_first_controller();
    cont_get_cond(first_controller, &controller_condition);

    if(!(controller_condition.buttons & button))
        return 1;
    else
        return 0;
}

#endif