Results 1 to 10 of 14

Thread: Arkanoid port (C)

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Quote Originally Posted by Ñuño Martínez View Post
    I think that's a bad idea: " destructor Destroy; reintroduce;". You should use "DESTRUCTOR Destroy; OVERRIDE;". Destructor should be virtual always. Note that compiler might do some magic with constructor and destructor (I.e. calling parent constructor or destructor if you forgot to call them). I'm not sure if reintroducing the destructor broke that magic, but I don't like to play that way.

    BTW, good idea to use ARRAY instead of pointer to store lists. Pointers can be used in Pascal almost like in C, but dynamic arrays are much better.
    I thought that 'reintroduce' was roughly the same until I read the wiki about it, so it's already changed I'm still learning the syntax and I do get alot of errors when I forget to use ':=' when assigning, or '==' when comparing, but overall I do see that Pascal has it's advantages.

    Quote Originally Posted by de_jean_7777
    For someone getting introduced to a language it's ambitious, but then again that's how I would've done it. First get it functional, then you can improve on it. Not sure what the rest of the code is but I see a
    Code:
    PArkanoid = ^TArkanoid;

    in the code, and this could probably also be replaced by a class. If it's already a class, then you don't need the PArkanoid type, as a object reference is already a pointer of sorts, so ArkGame can be of type TArkanoid, just assign it your main TArkanoid instance.
    That was added just to the snippet just so it would be clear what the 'ArkGame: PArkanoid' field was refering to, not in actual source Again, the wiki told me that TArkanoid is already a pointer to a class object, so it's left out in the 'real' code. 'Learning by doing' produces alot of interesting errors, warnings and hints...
    Last edited by Rickmeister; 30-03-2016 at 09:19 AM.

  2. #2
    Ironed out a few wrinkles and now I've ported most of the GUi code to Pascal, when I feel that it's more or less 'complete' I'll share it with you all on github.

    The GUI is quite simple, and the screenshot shows the main menu screen with a few menu items to choose between - From the center and out it's Play, Home/Exit, Highscore/Sound. The original game was controlled by gamepad (and keyboard as a fallback), and ran fine on a Raspberry Pi3 with a PS3 controller attached. By the looks of it SDL2 supports force feedback, so I'll try to 'extend' the Pascal version with that.

    Haven't fiddled with supporting controllers yet, so for now It's keyboard controls only. The GUI buttons 'rotate' right and left and the selected option is always centered, scaled and highlighted. Looks more advanced then it really is Running a quite fresh install of Fedora so I haven't got any video-capture software to show it in action, will fix that later (when the GUI is more complete).

    The game always run in '½HD' resolution (640*360) and is scaled to 720p or 1080p, I like the 'blocky' look it gets then. The C version only supports fullscreen mode on the RPi (HDMI, 720p and 1080p), and my son is currently the leaderboard champion



    [edit] In case you didn't notice, the button sprites aren't colorkeyed yet It's not a bug, it's a 'feature'!
    Attached Images Attached Images
    Last edited by Rickmeister; 30-03-2016 at 02:08 PM.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •