English Amiga Board


Go Back   English Amiga Board > Coders > Coders. Language > Coders. C/C++

 
 
Thread Tools
Old 02 December 2020, 21:42   #1
Ernst Blofeld
<optimized out>

Ernst Blofeld's Avatar
 
Join Date: Sep 2020
Location: <optimized out>
Posts: 304
C99 things

Does this:

Code:
    Polygon2D triangle = {
        .numVertices = 3,
        .vertices = (Point2D []) {
            topVertex,
            rightVertex,
            { DISPLAY_WIDTH - 1, 0 }
        }
    };
look sensible, given:

Code:
    typedef struct {
        WORD x;
        WORD y;
    } Point2D;
and

Code:
    typedef struct {
        WORD numVertices;
        Point2D * vertices;
    } Polygon2D;
and previously defined topVertex and rightVertex along these lines:

Code:
    Point2D topVertex = (Point2D) { topY + DISPLAY_WIDTH / 2, 0 };
    Point2D rightVertex = (Point2D) { DISPLAY_WIDTH - 1, rightZ + displayHeight / 2 };
Am I doing it right?

And the thing that's bothering me at the moment, how can I turn this:

Code:
    static Point2D points [20];
    static Polygon2D polygon = { .vertices = points };
into a single line and not have that extra points variable?

Last edited by Ernst Blofeld; 08 December 2020 at 13:29.
Ernst Blofeld is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
Non-Amiga things that remind you of Amiga things? Fingerlickin_B Retrogaming General Discussion 938 29 January 2021 15:22
It's the little things... Havie Coders. Blitz Basic 0 29 April 2017 23:37
Linking errors with vbcc when not using C99 tygre Coders. C/C++ 5 25 December 2015 21:01
vbcc C99 math for the 68k FPU matthey Coders. C/C++ 0 12 August 2014 18:53
2 things Kodoichi project.EAB 9 29 November 2001 01:15

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 16:14.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, vBulletin Solutions Inc.
Page generated in 0.07252 seconds with 15 queries