Skip to content

Commit

Permalink
Inserted visual elements of title screen
Browse files Browse the repository at this point in the history
Used pygame to insert images corresponding to the "Play" and "Info"
buttons, and created a "DreadNought" logo. Also added a background
image of a Navy Ship. Made sure that all images used were copyright
free
  • Loading branch information
brdllws committed Oct 28, 2019
1 parent fa8f0f4 commit 4b6e4e0
Show file tree
Hide file tree
Showing 13 changed files with 256 additions and 16 deletions.
12 changes: 12 additions & 0 deletions .idea/CSC290Battleship.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions .idea/encodings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

181 changes: 181 additions & 0 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions .project
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>CSC290Battleship</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
</buildSpec>
<natures>
</natures>
</projectDescription>
6 changes: 3 additions & 3 deletions src/controller/dreadnoughtcontroller.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
class dreadnought_controller:
class DreadnoughtController:

def __init__(self):
pass

Expand All @@ -10,4 +10,4 @@ def get_board(self, player = None):
pass

def move(self, x, y):
pass
pass
40 changes: 27 additions & 13 deletions src/gui/app.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import pygame, crayons
import pygame
import crayons


class App:

fill_color = (0, 0, 0) # RGB black
fill_color = (0, 0, 0) # RGB black

def __init__(self):
self._running = False
Expand Down Expand Up @@ -50,41 +52,53 @@ def cleanup(self):
"""Quits pygame and cleans up"""

pygame.quit()

print(crayons.green('Game loop exited, PyGame quit'))

print(crayons.green('Game loop exited, PyGame quit'))

def logic(self):
"""Handles the game logic on each loop"""
pass

def render(self):

self.screen.fill( self.fill_color ) # Clear screen

# Begin drawing code

pygame.draw.rect(self.screen, (255, 255, 255), (0, 0, 100, 100)) # Draw rect, just a test
self.screen.fill(self.fill_color) # Clear screen
title_screen_rendered = False

# Begin drawing code
if title_screen_rendered:
# Render Game
pass
else:
# Render Title Screen
background = pygame.image.load('background.jpg')
title = pygame.image.load('title.png')
play_button = pygame.image.load('play.png')
info_button = pygame.image.load('info.png')
self.screen.blit(background, (0, 0))
self.screen.blit(title, (235, 150))
self.screen.blit(play_button, (300, 450))
self.screen.blit(info_button, (300, 600))

# End drawing code

pygame.display.flip() # Render
pygame.display.flip() # Render

def loop(self):
"""Main game loop"""

while self._running:

self.handle_events()

self.logic()

self.render()

self.cleanup()


if __name__ == '__main__':

app = App()

app.start()
app.start()
Binary file added src/gui/background.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/gui/info.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/gui/play.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/gui/title.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 4b6e4e0

Please sign in to comment.