Skip to content

Commit

Permalink
tweak(web/cursor): Use FiveM provided cursor for loadscreens
Browse files Browse the repository at this point in the history
Added in citizenfx/fivem@517c63e. 

This is a better alternative than the svg based cursor
  • Loading branch information
TasoOneAsia committed Sep 24, 2021
1 parent 8513653 commit 2d76c47
Show file tree
Hide file tree
Showing 7 changed files with 3 additions and 41 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ The config can be found in `web/config.js`. This holds a plethora of configurati
| TIP_CHANGE_INTERVAL | The interval (ms) at which Tips change automatically | `TIP_CHANGE_INTERVAL = 12000` |
| BACKGROUND_CHANGE_INTERVAL | The interval (ms) at which backgrounds automatically switch | `BACKGROUND_CHANGE_INTERVAL = 15000` |
| BACKGROUND_IMAGES | An array of file names for images present in the `web/backgrounds` folder. | `BACKGROUND_IMAGES = ["1.jpg","2.jpg"]`
| ENABLE_CURSOR | Whether to enable the cursor while in the loading screen | `ENABLE_CURSOR = false`
| ENABLE_GFM_MARKDOWN | Whether to enable the `Github Flavored Markdown` spec for the parser | `ENABLE_GFM_MARKDOWN = true`
| ENABLE_SERVER_LOGO | Whether to enable the server logo | `ENABLE_SERVER_LOGO = true`
| SERVER_LOGO_POSITION | Where to place logo if enabled | `SERVER_LOGO_POSITION = 'top-left'`
Expand Down
2 changes: 2 additions & 0 deletions fxmanifest.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ loadscreen 'web/index.html'

client_script 'client.lua'

loadscreen_cursor 'yes'

loadscreen_manual_shutdown 'yes'

files {
Expand Down
4 changes: 0 additions & 4 deletions web/assets/images/cursor.svg

This file was deleted.

20 changes: 1 addition & 19 deletions web/assets/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import {
TIP_CHANGE_INTERVAL,
BACKGROUND_CHANGE_INTERVAL,
BACKGROUND_IMAGES,
ENABLE_CURSOR,
SERVER_LOGO_POSITION,
ENABLE_SERVER_LOGO,
MUSIC_ENABLED, SERVER_LOGO_FILE_NAME
Expand Down Expand Up @@ -167,21 +166,4 @@ const leftArrow = document.getElementById('tip-left-arrow')
const rightArrow = document.getElementById('tip-right-arrow')

leftArrow.addEventListener('click', showPrevTip)
rightArrow.addEventListener('click', showNextTip)

if (ENABLE_CURSOR) {
const cursor = document.getElementById('cursor')

cursor.style.visibility = 'visible'

window.addEventListener("mousemove", e => {
// These offsets are related to the size of the SVG
// for now this is fine
const x = e.pageX - cursor.offsetWidth + 20
const y = e.pageY - 2

cursor.style.left = `${x}px`
cursor.style.top = `${y}px`
})

}
rightArrow.addEventListener('click', showNextTip)
13 changes: 0 additions & 13 deletions web/assets/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -48,19 +48,6 @@ a[onclick] {
--main-bg: rgba(0, 0, 0, 0.85)
}

#cursor {
width: 30px;
height: 30px;
pointer-events: none;
top: 0;
left: 0;
visibility: hidden;
background-image: url("images/cursor.svg");
background-position: center;
position: absolute;
z-index: 999999;
}

#bgImg {
background-image: url(../backgrounds/1.jpg);
transition: background 1.5s linear;
Expand Down
3 changes: 0 additions & 3 deletions web/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,6 @@ export const MUSIC_FILE_NAME = 'music.mp3'

export const MUSIC_START_VOLUME = 0.3

// Whether we should enable the cursor for the loadscreen
export const ENABLE_CURSOR = true

// Enable github flavored markdown
export const ENABLE_GFM_MARKDOWN = false

Expand Down
1 change: 0 additions & 1 deletion web/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
<audio id="loadscreen-music" autoplay="autoplay" autostart loop preload src="">
</audio>
<div id="page-wrapper">
<div id="cursor"></div>
<div id="bgImg"></div>
<div id="server-logo"></div>
<div id="audio-controls">
Expand Down

0 comments on commit 2d76c47

Please sign in to comment.