Skip to content

Commit

Permalink
Visual changes and text on the bottom screen (including transient sco…
Browse files Browse the repository at this point in the history
…res)
  • Loading branch information
BHSPitMonkey committed Sep 18, 2015
1 parent 26c9a9b commit 4a24492
Show file tree
Hide file tree
Showing 6 changed files with 67 additions and 8 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,6 @@ Network Trash Folder
Temporary Items
.apdisk
/build/

*.zip
3ds/
8 changes: 7 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions -std=gnu++11
ASFLAGS := -g $(ARCH)
LDFLAGS = -specs=3dsx.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map)

LIBS := -lsfil -lpng -lsf2d -lctru -lz -lm
LIBS := -lsftd -lfreetype -lsfil -lpng -lz -lsf2d -lctru -lm

#---------------------------------------------------------------------------------
# list of directories containing libraries, this must be the top level containing
Expand Down Expand Up @@ -163,6 +163,12 @@ $(OUTPUT).elf : $(OFILES)
@echo $(notdir $<)
@$(bin2o)

#---------------------------------------------------------------------------------
%.ttf.o : %.ttf
#---------------------------------------------------------------------------------
@echo $(notdir $<)
@$(bin2o)

# WARNING: This is not the right way to do this! TODO: Do it right!
#---------------------------------------------------------------------------------
%.vsh.o : %.vsh
Expand Down
20 changes: 17 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

A homebrew port of Helii from the Nintendo Wii to the Nintendo 3DS.

## Download

Builds can be downloaded from the [Releases page](https://github.com/BHSPitMonkey/Helii3DS/releases).

## Build

You'll need the following to be installed properly:
Expand Down Expand Up @@ -32,16 +36,26 @@ Place the files onto your SD card like so:
## Projects used

* devkitPro (homebrew toolchain)
* smea/libctru (3DS core functionality)
* xerpi/libsf2d (for drawing)
* xerpi/libsfil (for image loading)
* [smea/libctru](https://github.com/smea/libctru) (3DS core functionality)
* [xerpi/libsf2d](https://github.com/xerpi/libsf2d) (for drawing)
* [xerpi/libsfil](https://github.com/xerpi/libsfil) (for image loading)
* libpng (for image decoding)

## Artwork used

* https://openclipart.org/detail/10814/helicopter
* https://openclipart.org/detail/23803/fire
* [Knewave font](https://github.com/theleagueof/knewave), used under the terms of the SIL Open Font License:

Copyright (c) 2010, Tyler Finck <hello@sursly.com>, with Reserved Font Name: "Knewave".
This Font Software is licensed under the SIL Open Font License, Version 1.1.
This license is copied below, and is also available with a FAQ at:
http://scripts.sil.org/OFL
Version 1.1 - 26 February 2007

## License

TBD

Binary file added data/knewave.ttf
Binary file not shown.
4 changes: 2 additions & 2 deletions source/Column.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ extern Player thePlayer;
Column::Column()
{
// Column width and height
theRect.width = COL_WIDTH - 1; // Equal column width (+1 to seal gaps)
theRect.width = COL_WIDTH + 1; // Equal column width (+1 to seal gaps)
theRect.height = 100; // gets randomized when spawned

// Set up column appearance
theQuad.SetFillColor(0, 255, 0); // Green fill!
theQuad.SetFillColor(105, 84, 27); // Brown
// theQuad.SetBorder(true);
// theQuad.SetBorderWidth(2);
// theQuad.SetBorderColor((GXColor){ 0, 0, 0, 255 }); // Black border!
Expand Down
40 changes: 38 additions & 2 deletions source/Main.cpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
#include <string.h>
#include <stdio.h>
#include <3ds.h>
#include <sftd.h>
#include <sf2d.h> // Move to Drawing
#include "globals.h"
#include "Player.h"
#include "CaveManager.h"
#include "Drawing.h"
#include "knewave_ttf.h"

// Global variables
unsigned int g_ticks = 0; // Counts how many frames we've drawn, period
Expand All @@ -13,6 +16,11 @@ unsigned int g_currentStateTime = 0; // Counts how many frames have passed in cu
GameState g_currentState; // Decides what state or mode the game is in
Player thePlayer;
CaveManager theCave;
unsigned int g_highScore = 0;

// Colors
u32 white = RGBA8(255, 255, 255, 255);
u32 white_80 = RGBA8(255, 255, 255, (int)(255*.8));

unsigned int getScore()
{
Expand Down Expand Up @@ -56,10 +64,16 @@ void setGameState(GameState newState)
int main()
{
Drawing::Init();
Drawing::SetClearColor(0x00, 0x30, 0x00); // Green background
Drawing::SetClearColor(0x24, 0x1E, 0x0E); // Brown

// Font loading
sftd_init();
sftd_font *font = sftd_load_font_mem(knewave_ttf, knewave_ttf_size);
char currentScoreString[7];
char highScoreString[7];

//Initialize console on lower screen. Using NULL as the second argument tells the console library to use the internal console structure as current one
consoleInit(GFX_BOTTOM, NULL);
//consoleInit(GFX_BOTTOM, NULL);
printf("Helii!\n\n");
printf("Ported with love by BHSPitMonkey.\n\n");
printf("Press A to fly or reset.\n");
Expand Down Expand Up @@ -157,6 +171,28 @@ int main()

Drawing::EndFrame();

// Start drawing the bottom screen
sf2d_start_frame(GFX_BOTTOM, GFX_LEFT);

sftd_draw_text(font, 120, 45, white, 40, "Helii");
sftd_draw_text(font, 100, 88, white_80, 12, "by BHSPitMonkey");
sftd_draw_text(font, 80, 120, white, 22, "A to fly or reset");
sftd_draw_text(font, 80, 148, white, 22, "START to pause");
sftd_draw_text(font, 80, 176, white, 22, "SELECT to exit");

// Draw the score
unsigned int score = getScore();
snprintf(currentScoreString, 7, "%06d", score);
sftd_draw_text(font, 251, 4, white, 14, currentScoreString);
if (score > g_highScore) {
g_highScore = score;
}
snprintf(highScoreString, 7, "%06d", g_highScore);
sftd_draw_text(font, 251, 18, white, 14, highScoreString);

// Done drawing the bottom screen
sf2d_end_frame();

g_ticks++;
g_currentStateTime++;

Expand Down

0 comments on commit 4a24492

Please sign in to comment.