Skip to content

Commit

Permalink
enable star key on sdl2 (#26)
Browse files Browse the repository at this point in the history
  • Loading branch information
vadosnaprimer authored Oct 30, 2024
1 parent a771ecb commit abc6c01
Showing 1 changed file with 17 additions and 16 deletions.
33 changes: 17 additions & 16 deletions src/org/recompile/freej2me/Anbu.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
import static io.github.libsdl4j.api.joystick.SdlJoystick.SDL_JoystickOpen;
import static io.github.libsdl4j.api.joystick.SdlJoystick.SDL_JoystickEventState;
import static io.github.libsdl4j.api.joystick.SdlJoystickConst.*;
import static io.github.libsdl4j.api.joystick.SdlJoystick.*;
import static io.github.libsdl4j.api.joystick.SdlJoystick.*;

import java.awt.image.DataBufferInt;
import java.io.File;
Expand Down Expand Up @@ -97,8 +97,8 @@ public static void main(String[] args)
private long elapsedTime = 0;
private long sleepTime = 0;

SDL_Joystick joy = null;

SDL_Joystick joy = null;

private boolean[] pressedKeys = new boolean[128];

private Runnable painter;
Expand Down Expand Up @@ -150,13 +150,13 @@ public void run()
{
try
{
/* Check if vibration commands have to be handled */
if(Mobile.vibrationDuration != 0)
{
int vib = SDL_JoystickRumble(joy, (short) 0xFFFF, (short) 0xFFFF, Mobile.vibrationDuration);
Mobile.vibrationDuration = 0;
}

/* Check if vibration commands have to be handled */
if(Mobile.vibrationDuration != 0)
{
int vib = SDL_JoystickRumble(joy, (short) 0xFFFF, (short) 0xFFFF, Mobile.vibrationDuration);
Mobile.vibrationDuration = 0;
}

if(limitFPS>0)
{
requiredFrametime = 1000 / limitFPS;
Expand Down Expand Up @@ -561,6 +561,7 @@ private int getMobileKey(int keycode)
if(keycode == SDLK_KP_1) return Mobile.KEY_NUM7; // B
if(keycode == SDLK_KP_3) return Mobile.KEY_NUM9; // X
if(keycode == SDLK_X) return Mobile.KEY_POUND; // Y
if(keycode == SDLK_Z) return Mobile.KEY_STAR; // ???


if(keycode == SDLK_C) return Mobile.KEY_NUM0; // Home
Expand Down Expand Up @@ -681,9 +682,9 @@ private void addJoystick(int id)
// assert(id >= 0 && id < SDL_NumJoysticks());

// open joystick & add to our list
//System.out.println("Joystick Detected!" + SDL_JoystickName(joy));
joy = SDL_JoystickOpen(id);
//System.out.println("Added Joystick:" + SDL_JoystickName(joy));
//System.out.println("Joystick Detected!" + SDL_JoystickName(joy));
joy = SDL_JoystickOpen(id);
//System.out.println("Added Joystick:" + SDL_JoystickName(joy));
// assert(joy);

// add it to our list so we can close it again later
Expand All @@ -698,9 +699,9 @@ private void addJoystick(int id)

private void removeJoystick(int joyId)
{
//System.out.println("Removing Joystick:" + SDL_JoystickName(joy));
SDL_JoystickClose(joy);
//System.out.println("Joystick Removed!" + SDL_JoystickName(joy));
//System.out.println("Removing Joystick:" + SDL_JoystickName(joy));
SDL_JoystickClose(joy);
//System.out.println("Joystick Removed!" + SDL_JoystickName(joy));
// assert(joyId != -1);
// delete old prevAxisValues
// auto axisIt = mPrevAxisValues.find(joyId);
Expand Down

0 comments on commit abc6c01

Please sign in to comment.