Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

the fullscreen mode ! #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions logic/board.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,21 +37,20 @@ namespace Tanks {
// That's where we want to split out blocks even more.
// For example when just half a brick is breakable by bullet
// or tank moves just half a brick at a time
#define MAP_SCALE_FACTOR 2

#define MAP_SCALE_FACTOR 2
Board::Board(QObject *parent) : QObject(parent) { }

bool Board::loadMap(AbstractMapLoader *loader)
{
if (!loader->open()) {
return false;
}
//_dynBlocks.clear();
// _dynBlocks.clear();
_size = loader->dimensions() * MAP_SCALE_FACTOR;
_size = _size.boundedTo(QSize(1024, 1024));
QRect boardRect(QPoint(0, 0), _size);
_map.resize(_size.width() * _size.height());
_map.fill(0);
_size = _size.boundedTo(QSize( 2160,4440));
QRect boardRect(QPoint(10,10), _size);
_map.resize(4096*2160);


while (loader->hasNext()) {
MapObject block = loader->next();
Expand Down
14 changes: 12 additions & 2 deletions logic/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,22 @@
#include "qmlmain.h"

#include <QGuiApplication>

#include <QQuickView>
int main(int argc, char *argv[])
{

QGuiApplication app(argc, argv);
QQuickView viewer;

viewer.setSource(QUrl("qrc/:MainForm.qml"));

viewer.showFullScreen();



Tanks::QMLMain q;

return app.exec();


return app.exec();
}
24 changes: 19 additions & 5 deletions render/MainForm.qml
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,32 @@ import QtMultimedia
import com.rsoft.tanks 1.0

Row {
anchors.fill: parent


anchors {
centerIn: parent
topMargin: 10
rightMargin: -100
bottomMargin: 100
leftMargin: 25
}


Rectangle {
id: battleField

//anchors.left: otherItem.left

// anchors.left: otherItem.left

property alias mouseArea: lowerLayer

width: 200
height: 200

color: "red"

width: parent.width/10.0
height: parent.height

color: '#444444'




Expand Down
3 changes: 2 additions & 1 deletion render/StartButton.ui.qml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import QtQuick 2.0

Item {

id: button
width: 92
height: 27
Expand All @@ -13,7 +14,7 @@ Item {
id: rectangle1
x: 0
y: 9
width: 90
width: parent.width
height: 25
radius: 13
anchors.horizontalCenter: parent.horizontalCenter
Expand Down
18 changes: 13 additions & 5 deletions render/main.qml
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,23 @@

import QtQuick 2.6
import QtQuick.Window 2.2
import QtQuick.Controls 2.15

Window {
id : root
visible: true
width: 900
height: 800

visibility: "FullScreen"

width : Screen.width
height : Screen.height

title: qsTr("Battle City: The War")

MainForm {
anchors.fill: parent
}

MainForm {

anchors.centerIn: parent
}

}