TinyCircuits

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - kuran_kuran

Pages: [1]
1
Tiny Arcade / New game for TinyArcade
« on: July 24, 2017, 10:24:26 AM »
It is New!
*KemonoRogue Version 1.00
It is an rogue-like game of animation 'Kemono Friends'.
http://daimonsoft.info/kuran_kuran/index.php?TinyArcade%2FKemonoRogue

Update.
*TinySTG Version 1.02
Added new stage.
http://daimonsoft.info/kuran_kuran/index.php?TinyArcade%2FTinySTG

There is also an Android version.
*KemonoRogue
https://play.google.com/store/apps/details?id=info.daimonsoft.kemonorogue
*TinySTG
https://play.google.com/store/apps/details?id=info.daimonsoft.tinystg

2
Do you know how to write data to SD card with TinyArcade?
I want to save game data with SdFat library but I will fail by mistake.
If Sample.txt exists on the SD card, only 1st succeeds. 2nd will fail.
If Sample.txt does not exist, both 1st and 2nd will fail. zero byte Sample.txt is created.


#include <TinyScreen.h>
#include "SdFat.h"

TinyScreen tiny_screen = TinyScreen(TinyScreenPlus);
SdFat sd_fat;
int write_bytes1 = -1;
int write_bytes2 = -1;

void setup()
{
   // Initialize SD card
   sd_fat.begin(10, SPI_FULL_SPEED);
   // Initialize screen
   tiny_screen.begin();
   tiny_screen.setBitDepth(TSBitDepth8);
   tiny_screen.setBrightness( 8 );
   tiny_screen.setFont(liberationSansNarrow_12ptFontInfo);
   tiny_screen.fontColor(TS_8b_White, TS_8b_Black);
   // Write file 1st
   SdFile file1;
   if(file1.open("Sample.txt", O_RDWR | O_CREAT))
   {
      char text[128];
      sprintf(text, "123456 text");
      write_bytes1 = file1.write(text, 12);
      file1.close();
   }
   // Write file 2nd
   SdFile file2;
   if(file2.open("Sample.txt", O_RDWR | O_CREAT))
   {
      char text[128];
      sprintf(text, "654321 text");
      write_bytes2 = file2.write(text, 12);
      file2.close();
   }
}

void loop()
{
   char text[128];
   sprintf(text, "1st %dbytes", write_bytes1);
   tiny_screen.setCursor(0, 0);
   tiny_screen.print(text);
   sprintf(text, "2nd %dbytes", write_bytes2);
   tiny_screen.setCursor(0, 14);
   tiny_screen.print(text);
}

Pages: [1]