Skip to content

Commit

Permalink
Bump submodules
Browse files Browse the repository at this point in the history
Signed-off-by: Marek Maškarinec <[email protected]>
  • Loading branch information
marekmaskarinec committed Mar 10, 2024
1 parent 9d9ba0b commit 5356d03
Show file tree
Hide file tree
Showing 30 changed files with 737 additions and 736 deletions.
6 changes: 3 additions & 3 deletions examples/flappy/main.um
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,8 @@ fn drawCenteredText(t: str, y: th.fu, c: uint32, s: th.fu): th.fu {

fn menu() {
// check all the known keys for a press
for i:=0; i <= input.key_menu; i++ {
if input.isJustPressed(i) {
for i:=0; i <= int(input.Key.menu); i++ {
if input.isJustPressed(input.Key(i)) {
play()
}
}
Expand Down Expand Up @@ -196,7 +196,7 @@ fn game() {
}

// jumping means setting the y motion to the jumpForce
if input.isJustPressedc(' ') || input.isJustPressed(input.mouse1) {
if input.isJustPressedc(' ') || input.isJustPressed(input.Key.mouse1) {
motion.y = jumpForce
jumpSound.play()
}
Expand Down
2 changes: 1 addition & 1 deletion examples/platformer/game/env.um
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ fn reset*() {
}

fn handle*() {
if input.isJustPressed(input.key_enter) {
if input.isJustPressed(input.Key.enter) {
reset()
start = th.time
}
Expand Down
2 changes: 1 addition & 1 deletion examples/platformer/game/game.um
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ fn handle*() {
bees.handle()
player.handle()
case stateFinished:
if input.isJustPressed(input.key_enter) {
if input.isJustPressed(input.Key.enter) {
state = stateGame
reset()
}
Expand Down
6 changes: 3 additions & 3 deletions examples/platformer/game/player.um
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,11 @@ fn move() {
canJump = false
}

if input.isPressed(input.key_left) {
if input.isPressed(input.Key.left) {
mot.x = -1
}

if input.isPressed(input.key_right) {
if input.isPressed(input.Key.right) {
mot.x = 1
}

Expand Down Expand Up @@ -150,7 +150,7 @@ fn handle*() {
die()
}

if input.isJustPressed(input.key_escape) {
if input.isJustPressed(input.Key.escape) {
body.t.p = env.spawn
}

Expand Down
8 changes: 4 additions & 4 deletions examples/pomodoro/main.um
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ fn guiGetButtonState(gui: ^Gui): ButtonState {
lastRect := guiGetLastRect(gui).rect
state := ButtonState{}
state.hovered = rectVsPoint(lastRect, th_input.getMousePos())
state.pressed = state.hovered && th_input.isJustPressed(th_input.mouse1)
state.pressed = state.hovered && th_input.isJustPressed(th_input.Key.mouse1)
return state
}

Expand Down Expand Up @@ -401,7 +401,7 @@ const onFrame = fn(args: []any) {
v_colorscheme = c_colorschemeLight
}

if th_input.isJustPressed(th_input.key_escape) {
if th_input.isJustPressed(th_input.Key.escape) {
debug = !debug
}

Expand Down Expand Up @@ -490,8 +490,8 @@ fn init*() {
v_lastTime = th.time
th_window.setup("Pomodoro", trunc(screen.w), trunc(screen.h))
th_window.setViewport(th.Vf2{screen.w, screen.h})
v_mainFont = th_font.load("Font.ttf", 32, 1)
v_mainFontSmall = th_font.load("Font.ttf", 20, 1)
v_mainFont = th_font.load("Font.ttf", 32)
v_mainFontSmall = th_font.load("Font.ttf", 20)
v_countdown = getCountdown(0)
v_alarm = th_audio.load("Alarm.wav")
v_rectBase = th_image.load("rectbase.png")
Expand Down
2 changes: 1 addition & 1 deletion examples/space-shooter/hud.um
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ var (
fn init*() {
hearth = image.load("gfx/hearth.png")

mainFont = font.load("gfx/marediv-regular.ttf", 64, font.filterNearest)
mainFont = font.load("gfx/marediv-regular.ttf", 64, font.Filter.nearest)
}

fn handle*() { }
Expand Down
2 changes: 1 addition & 1 deletion examples/space-shooter/menu.um
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ fn handle*() {
gui.box({
dimension: 10,
padding: 2,
dir: ui.BoxDirectionUp })
dir: ui.BoxDir.up })

if gui.qbutton("EXIT") {
global.scene = global.NONE
Expand Down
20 changes: 10 additions & 10 deletions examples/tetris/falling_piece.um
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,13 @@ fn getKicks(from, to: int): [4]presets.Kick {
if clockwise {
return presets.ClockwiseI[from]
} else {
return presets.CounterclockwiseI[from]
return presets.CounterclockwiseI[from]
}
}
if clockwise {
return presets.ClockwiseNI[from]
}
return presets.CounterclockwiseNI[from]
return presets.CounterclockwiseNI[from]
}

fn checkTSpinCorners() {
Expand Down Expand Up @@ -88,14 +88,14 @@ fn runKickTable(table: [4]presets.Kick): bool {
if !invalid() {
if kind == presets.pieceTypeT {
isTspin = true
}
}
return true
}
x = original_x
y = original_y
}
return false
}
}

fn rotate180() {
from := rotation
Expand Down Expand Up @@ -180,18 +180,18 @@ fn update*(speed: real) {
placeTimer = 0
}

if (leftBtnLatch.pass(input.isPressed(input.key_left))) {

if (leftBtnLatch.pass(input.isPressed(input.Key.left))) {
placeTimer = 0
movePiece(-1, 0)
}

if (rightBtnLatch.pass(input.isPressed(input.key_right))) {
if (rightBtnLatch.pass(input.isPressed(input.Key.right))) {
placeTimer = 0
movePiece(1, 0)
}

if (input.isPressed(input.key_down)) {
if (input.isPressed(input.Key.down)) {
placeTimer += th.delta/1000.0
prev := y
y += 0.01*th.delta*speed;
Expand All @@ -200,7 +200,7 @@ fn update*(speed: real) {
}
}

if (input.isJustPressedc('X') || input.isJustPressed(input.key_up)) {
if (input.isJustPressedc('X') || input.isJustPressed(input.Key.up)) {
global.playSound(&global.audioRotate)
placeTimer = 0
rotateClockwise()
Expand All @@ -215,7 +215,7 @@ fn update*(speed: real) {
}
if (input.isJustPressedc(' ')) {
global.playSound(&global.audioPush)
push()
push()
}
}

Expand Down
2 changes: 1 addition & 1 deletion examples/tetris/gameplay.um
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ fn update*() {
field.init()
field.lost = false
}
if input.isJustPressed(input.key_shift) {
if input.isJustPressed(input.Key.shift) {
stashPiece()
}
if falling_piece.placeTimer > 0.5 || falling_piece.groundTouchTimer > 5 {
Expand Down
2 changes: 1 addition & 1 deletion lib/sokol
Submodule sokol updated 1 files
+3 −3 sokol_gfx.h
10 changes: 5 additions & 5 deletions main.um
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ fn onFrame(args: []any) {

p := th.Vf2{ 0, 1 }

if !input.isPressed(input.key_left_alt) {
if !input.isPressed(input.Key.leftAlt) {
for i in lines {
s := 1
if i == 1 {
Expand Down Expand Up @@ -56,10 +56,10 @@ fn onFrame(args: []any) {
}


if input.isJustPressed(input.key_enter) {
if th.platform == th.PlatformWindows {
if input.isJustPressed(input.Key.enter) {
if th.platform == th.Platform.windows {
std.system("explorer \"https://tophat2d.dev/\"")
} else if th.platform == th.PlatformLinux {
} else if th.platform == th.Platform.linux {
std.system("xdg-open https://tophat2d.dev/")
}
}
Expand All @@ -74,7 +74,7 @@ fn init*() {
window.setup("Hello world", 600, 600)
window.setViewport(th.Vf2{ 100, 100 })

loadedFont = font.load("etc/roboto.ttf", 16, 2)
loadedFont = font.load("etc/roboto.ttf", 16)
if !loadedFont.validate() {
exit(1, "could not load font")
}
Expand Down
Loading

0 comments on commit 5356d03

Please sign in to comment.