Re: SFML2 Demo Dilema - Solved

new topic     » goto parent     » topic index » view thread      » older message » newer message
ghaberek said...

One more.

typedef struct 
{ 
  unsigned int width; 
  unsigned int height; 
  unsigned int bitsPerPixel; 
} sfVideoMode; 

Traditional method..

-- struct sfVideoMode 
public constant 
    sfVideoMode__width        =  0, -- unsigned int 
    sfVideoMode__height       =  4, -- unsigned int 
    sfVideoMode__bitsPerPixel =  8, -- unsigned int 
    SIZEOF_SFVIDEOMODE        = 12, 
$ 
 
-- example 
atom mode = allocate_data( SIZEOF_SFVIDEOMODE, 1 ) 
atom width  = peek4u( mode + sfVideoMode__width ) 
atom height = peek4u( mode + sfVideoMode__heigth ) 
-- etc. 

and 4.1 with memstruct...

public memstruct sfVideoMode 
    unsigned int width 
    unsigned int height 
    unsigned int bitsPerPixel 
end memstruct 
 
-- example: 
atom mode = allocate_data( sizeof(sfVideoMode) ) 
atom width  = mode.sfVideoMode.width 
atom height = mode.sfVideoMode.height 
-- etc. 

I think you get the point. smile

-Greg

Greg,... I'm not a C programmer but I get the point. It's very sad actually, from my point of view.

The traditional method is Euphoria code, clear, easy, works just fine. 4.1 memstruct is certainly not a breakthrough, yet it's overloading the language with additional C syntax.

Instead, you could just add a short tutorial to the manual for doing it right, and how to avoid crash. Or just add some safer utility to the STD library, written in "traditional" Euphoria.

It may avoid some peeking errors, but come on. Why don't you add string type to the language as well?...

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu