Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
I
ingame
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Vladislav
ingame
Commits
f998d93a
Commit
f998d93a
authored
Jun 28, 2024
by
Yankovskiy Georgiy
Browse files
Options
Browse Files
Download
Plain Diff
Merge resolve
parents
194a9181
4b5a7b32
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
110 additions
and
73 deletions
+110
-73
App.py
ingame/models/App.py
+4
-0
Gamepad.py
ingame/models/Gamepad.py
+24
-0
Tabs.qml
qml/components/Tabs.qml
+57
-70
qml.qml
qml/qml.qml
+8
-0
GameInfoScene.qml
qml/scenes/GameInfoScene.qml
+10
-3
HomeScene.qml
qml/scenes/HomeScene.qml
+7
-0
No files found.
ingame/models/App.py
View file @
f998d93a
...
...
@@ -30,6 +30,8 @@ class App(QtCore.QObject):
gamepad_clicked_RB
=
Signal
(
bool
,
name
=
"gamepadClickedRB"
)
gamepad_clicked_apply
=
Signal
(
bool
,
name
=
"gamepadClickedApply"
)
gamepad_clicked_back
=
Signal
(
bool
,
name
=
"gamepadClickedBack"
)
gamepad_axis_up
=
Signal
(
bool
,
name
=
"gamepadAxisUp"
)
gamepad_axis_down
=
Signal
(
bool
,
name
=
"gamepadAxisDown"
)
gamepad_axis_left
=
Signal
(
bool
,
name
=
"gamepadAxisLeft"
)
gamepad_axis_right
=
Signal
(
bool
,
name
=
"gamepadAxisRight"
)
...
...
@@ -50,6 +52,8 @@ class App(QtCore.QObject):
self
.
gamepad
.
apply_clicked
=
lambda
:
self
.
gamepad_clicked_apply
.
emit
(
True
)
self
.
gamepad
.
l_clicked
=
lambda
:
self
.
gamepad_axis_left
.
emit
(
True
)
self
.
gamepad
.
r_clicked
=
lambda
:
self
.
gamepad_axis_right
.
emit
(
True
)
self
.
gamepad
.
u_clicked
=
lambda
:
self
.
gamepad_axis_up
.
emit
(
True
)
self
.
gamepad
.
d_clicked
=
lambda
:
self
.
gamepad_axis_down
.
emit
(
True
)
self
.
gamepad
.
back_clicked
=
lambda
:
self
.
gamepad_clicked_back
.
emit
(
True
)
self
.
agent
=
GameAgent
(
self
.
config_path
,
self
.
cache_path
)
...
...
ingame/models/Gamepad.py
View file @
f998d93a
...
...
@@ -11,6 +11,8 @@ class Gamepad:
RB_BUTTON
=
5
LEFT_RIGHT_AXIS
=
0
LEFT_RIGHT_AXIS_SENSITIVITY
=
0.7
UP_DOWN_AXIS
=
1
UP_DOWN_AXIS_SENSITIVITY
=
0.7
APPLY_BUTTON
=
0
BACK_BUTTON
=
1
...
...
@@ -23,12 +25,16 @@ class Gamepad:
self
.
last_apply_clicked
:
bool
=
False
self
.
last_left_clicked
:
bool
=
False
self
.
last_right_clicked
:
bool
=
False
self
.
last_up_clicked
:
bool
=
False
self
.
last_down_clicked
:
bool
=
False
self
.
last_back_clicked
:
bool
=
False
self
.
lb_clicked
:
()
=
lambda
:
None
self
.
rb_clicked
:
()
=
lambda
:
None
self
.
l_clicked
:
()
=
lambda
:
None
self
.
r_clicked
:
()
=
lambda
:
None
self
.
u_clicked
:
()
=
lambda
:
None
self
.
d_clicked
:
()
=
lambda
:
None
self
.
back_clicked
:
()
=
lambda
:
None
self
.
apply_clicked
:
()
=
lambda
:
None
...
...
@@ -64,6 +70,7 @@ class Gamepad:
rb_button
=
self
.
joystick
.
get_button
(
self
.
RB_BUTTON
)
apply_button
=
self
.
joystick
.
get_button
(
self
.
APPLY_BUTTON
)
left_right_axis
=
self
.
joystick
.
get_axis
(
self
.
LEFT_RIGHT_AXIS
)
up_down_axis
=
self
.
joystick
.
get_axis
(
self
.
UP_DOWN_AXIS
)
back_button
=
self
.
joystick
.
get_button
(
self
.
BACK_BUTTON
)
# LB
...
...
@@ -110,6 +117,23 @@ class Gamepad:
if
(
not
left_right_axis
>=
self
.
LEFT_RIGHT_AXIS_SENSITIVITY
)
and
self
.
last_right_clicked
:
self
.
last_right_clicked
=
not
self
.
last_right_clicked
# UP
if
(
up_down_axis
<=
-
self
.
UP_DOWN_AXIS_SENSITIVITY
)
and
not
self
.
last_up_clicked
:
self
.
last_up_clicked
=
not
self
.
last_up_clicked
self
.
u_clicked
()
if
not
(
up_down_axis
<=
-
self
.
UP_DOWN_AXIS_SENSITIVITY
)
and
self
.
last_up_clicked
:
self
.
last_up_clicked
=
not
self
.
last_up_clicked
# DOWN
if
(
up_down_axis
>=
self
.
UP_DOWN_AXIS_SENSITIVITY
)
and
not
self
.
last_down_clicked
:
self
.
last_down_clicked
=
not
self
.
last_down_clicked
self
.
d_clicked
()
if
(
not
up_down_axis
>=
self
.
UP_DOWN_AXIS_SENSITIVITY
)
and
self
.
last_down_clicked
:
self
.
last_down_clicked
=
not
self
.
last_down_clicked
# BACK
if
back_button
and
not
self
.
last_back_clicked
:
self
.
last_back_clicked
=
not
self
.
last_back_clicked
...
...
qml/components/Tabs.qml
View file @
f998d93a
...
...
@@ -135,16 +135,12 @@ Rectangle {
id
:
buttonSystemManagement
;
text
:
TabConstants
.
systemManagementTab
;
width
:
400
;
/*
onClicked
:
function
(){
tabButtons
.
x
=
tabButtons
.
tempX
tabButtons
.
changeButtonActiveTab
(
this
)
tabButtons
.
toggle
=
true
tabs
.
currentTab
=
TabConstants
.
systemManagementTab
;
// tabs.changeTab();
console.log(tabs.currentTab);
}
*/
onReleased
:
tabButtons
.
toggle
=
false
}
TopMenuBut.TextButton
{
...
...
@@ -168,6 +164,20 @@ Rectangle {
}
TopMenuBut.TextButton
{
id
:
testbut2
text
:
"Test"
//font.pixelSize: 60
//height:Math.ceil(tabs.height/100 * 10)
onClicked
:
function
(){
tabButtons
.
x
=
tabButtons
.
tempX
tabButtons
.
changeButtonActiveTab
(
this
)
tabButtons
.
toggle
=
true
}
onReleased
:
tabButtons
.
toggle
=
false
}
}
Image
{
...
...
@@ -186,78 +196,47 @@ Rectangle {
}
}
// Заглушка Системных настроек
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
// Заглушка Системных настроек
Grid
{
id
:
systemManagementGrid
visible
:
tabs
.
currentTab
==
TabConstants
.
systemManagementTab
columns
:
1
columns
:
3
spacing
:
2
anchors.centerIn
:
parent
anchors.left
:
parent
.
left
anchors.right
:
parent
.
right
anchors.top
:
parent
.
top
anchors.bottom
:
parent
.
bottom
Layout.topMargin
:
190
// anchors.rightMargin: 0
// anchors.leftMargin: 0
// anchors.bottomMargin: 90
anchors.rightMargin
:
0
anchors.leftMargin
:
0
anchors.bottomMargin
:
90
Row
{
Text
{
font.family
:
globalFont
.
font
font.weight
:
400
font.styleName
:
globalFont
.
font
.
styleName
font.pointSize
:
16
text
:
"Полный экран при запуске:"
color
:
'white'
opacity
:
0.8
}
CheckBox
{
onCheckedChanged
:
{
if
(
checked
)
{
window
.
visibility
=
Window
.
FullScreen
}
else
{
window
.
visibility
=
Window
.
Windowed
}
}
}
anchors.bottomMargin
:
90
Rectangle
{
color
:
"red"
;
width
:
50
;
height
:
50
;
}
Row
{
Text
{
font.family
:
globalFont
.
font
font.weight
:
400
font.styleName
:
globalFont
.
font
.
styleName
font.pointSize
:
16
color
:
'white'
opacity
:
0.8
text
:
"Каталог PortProton"
}
TextField
{
id
:
pathTextField
width
:
150
readOnly
:
true
text
:
"Выберите каталог"
}
Button
{
width
:
50
text
:
"Выбрать"
onClicked
:
fileDialog
.
open
()
}
Rectangle
{
color
:
"green"
;
width
:
20
;
height
:
50
;
}
FileDialog
{
id
:
fileDialog
title
:
"Выберите каталог"
currentFolder
:
"/"
fileMode
:
FileDialog
.
Directory
onAccepted
:
{
pathTextField
.
text
=
fileDialog
.
currentFolder
}
Rectangle
{
color
:
"blue"
;
width
:
50
;
height
:
20
;
}
Rectangle
{
color
:
"cyan"
;
width
:
50
;
height
:
50
;
}
Rectangle
{
color
:
"magenta"
;
width
:
10
;
height
:
10
;
}
}
...
...
@@ -312,7 +291,6 @@ Rectangle {
// Повторитель
Repeater
{
id
:
gamesGridRepeater
model
:
core_app
.
games
// Карточка игры
Game
{
...
...
@@ -366,7 +344,6 @@ Rectangle {
// LOGIC
property
int
focusedItems
:
0
;
property
int
focusedTabs
:
0
;
...
...
@@ -401,14 +378,17 @@ Rectangle {
if
(
window
.
scene
!==
S
.
homeScene
)
return
;
let
c
=
gamesGrid
.
children
;
let
l
=
c
.
length
-
1
;
// exclude QQuickRepeater
tabs
.
focusedItems
+=
inc
;
if
(
tabs
.
focusedItems
>=
c
.
length
)
tabs
.
focusedItems
=
0
;
if
(
tabs
.
focusedItems
<
0
)
tabs
.
focusedItems
=
c
.
length
-
1
;
// console.log(tabs.focusedItems);
if
(
tabs
.
focusedItems
+
inc
>=
l
)
{
tabs
.
focusedItems
=
(
c
.
focusedItems
+
inc
===
l
-
1
)
?
0
:
l
-
1
;
}
else
if
(
tabs
.
focusedItems
+
inc
<
0
)
{
tabs
.
focusedItems
=
(
c
.
focusedItems
+
inc
===
0
)
?
l
-
1
:
0
;
//;
}
else
{
tabs
.
focusedItems
+=
inc
;
}
c
[
tabs
.
focusedItems
].
forceActiveFocus
();
// gamesScroller.contentY = c[tabs.focusedItems].y; // not working
// c[tabs.focusedItems].clicked();
...
...
@@ -422,7 +402,14 @@ Rectangle {
function
onGamepadClickedRB
(
args
){
tabs
.
applyTabsFocus
(
1
)
}
function
onGamepadAxisLeft
(
args
){
function
onGamepadAxisUp
(
done
){
tabs
.
applyItemsFocus
(
-
gamesGrid
.
columns
);
}
function
onGamepadAxisDown
(
done
){
tabs
.
applyItemsFocus
(
gamesGrid
.
columns
);
}
function
onGamepadAxisLeft
(
done
){
tabs
.
applyItemsFocus
(
-
1
)
}
function
onGamepadAxisRight
(
args
){
...
...
qml/qml.qml
View file @
f998d93a
...
...
@@ -46,6 +46,12 @@ Window {
function
onGamepadAxisRight
(
done
){
window
.
_trigger
(
"onGamepadAxisRight"
,
done
);
}
function
onGamepadAxisUp
(
done
){
window
.
_trigger
(
"onGamepadAxisUp"
,
done
);
}
function
onGamepadAxisDown
(
done
){
window
.
_trigger
(
"onGamepadAxisDown"
,
done
);
}
function
onGamepadClickedApply
(
done
){
window
.
_trigger
(
"onGamepadClickedApply"
,
done
);
}
...
...
@@ -65,6 +71,8 @@ Window {
let
d
=
scenes
[
scene
];
// console.log("CALLUP " + _method);
if
(
d
!==
null
&&
d
[
_method
]
!==
undefined
&&
d
[
_method
]
!==
null
)
d
[
_method
](
args
);
}
...
...
qml/scenes/GameInfoScene.qml
View file @
f998d93a
...
...
@@ -95,7 +95,7 @@ Rectangle {
}
ColumnLayout
{
ColumnLayout
{
// anchors.fill:parent
anchors.left
:
parent
.
left
anchors.top
:
parent
.
top
...
...
@@ -107,7 +107,7 @@ Rectangle {
anchors.topMargin
:
parent
.
height
/
100
*
3
spacing
:
6
ItemGroup
{
ItemGroup
{
id
:
topPanel
Button
{
id
:
back
...
...
@@ -178,7 +178,7 @@ Rectangle {
}
}
}
Rectangle
{
Rectangle
{
// Start pos
Layout.fillWidth
:
true
Layout.fillHeight
:
true
...
...
@@ -390,6 +390,13 @@ Rectangle {
description
.
text
=
"Наименование игры:
\
n"
+
result
[
'title'
]
+
"
\
n
\
nОписание игры:
\
n"
+
result
[
'desc'
]
}
function
onGamepadAxisUp
(
done
){
root
.
onGamepadAxisLeft
(
done
);
}
function
onGamepadAxisDown
(
done
){
root
.
onGamepadAxisRight
(
done
);
}
function
onGamepadAxisLeft
(
done
){
if
(
window
.
scene
!==
S
.
gameInfoScene
)
return
;
root
.
applyItemsFocus
(
-
1
)
...
...
qml/scenes/HomeScene.qml
View file @
f998d93a
...
...
@@ -11,6 +11,7 @@ Rectangle {
color
:
"#00000000"
onVisibleChanged
:
{
tabs
.
visible
=
container
.
visible
;
}
...
...
@@ -59,5 +60,11 @@ Rectangle {
function
onGameListDetailsRetrievingProgress
(
args
){
tabs
.
onGameListDetailsRetrievingProgress
(
args
)
}
function
onGamepadAxisUp
(
args
){
tabs
.
onGamepadAxisUp
(
args
)
}
function
onGamepadAxisDown
(
args
){
tabs
.
onGamepadAxisDown
(
args
)
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment