0
/*
// ORIGINAL C Code
#define SSIZEX 20
#define SSIZEY 13

typedef struct FCELL
{
    short Backdrop;
    char  Platform;
    char  DomiType;
    char  Spare[2];
}_FCELL;

typedef struct SCREENINFO
{
    charTheme[10];
    char    Tune[10];
    char    StartX;
    char    StartY;
    char    ExitX;
    char    ExitY;
    char    Author[4];
    char    Hints[4][5][16];
    char    TargetMins;
    char    TargetSecs;
    char    Keys[0x800];
}_SCREENINFO;

typedef struct  SCREEN
{
    FCELL       Screen[SSIZEY][SSIZEX];
    SCREENINFO  ScrInfo;
}_SCREEN;
*/

// Swift code
let SSIZEX          = 20
let SSIZEY          = 13

struct  _FCELL
{
    var Backdrop: Int
    var Platform: Int
    var DomiType: Int
    var Spare:    Int
}
struct  _SCREENINFO
{
    var Theme:       String
    var Tune:        String
    var StartX:      Int
    var StartY:      Int
    var ExitX:       Int
    var ExitY:       Int
    var Author:      String
    var Hint:        String
    var TargetMins:  Int
    var TargetSecs:  Int
    var Keys:        String
}
struct _SCREEN
{
}

Hi I have the original C Code ( above ) the I'm trying to convert to Swift 4. The FCELL & _SCREENINFO are easy to convert, but I'm struggling to try to make the _SCREEN struct. Is it possible ? I would like to keep it as close to the original as possible so there will be minimise changes to the rest of the code.

0 Answers0