Jump to content
Sign in to follow this  
Andreik

Graphic Control problem

Recommended Posts

Andreik

How can I draw in a graphic control a triangle with all angles of 60 degrees?

Edited by Andreik

When the words fail... music speaks

Share this post


Link to post
Share on other sites
AdmiralAlkex

You can use GDI drawing instead.

There is API function Polygon.

Look at MSDN for details.

SDL can do this too, but you want to use trigon instead of polygon (it's easier).

#cs
Click somewhere to exit.
#ce
#Include "SDL_sprig.au3"
#Include "SDL.au3"

_SDL_Init($_SDL_INIT_VIDEO)
_SDL_Startup_sprig()

$pSurface = _SDL_GuiCreate("Triangle demo", 600, 600, 32, $_SDL_SWSURFACE)

_SPG_PushAA(1)  ;Enable anti-aliasing ;)

_SPG_TrigonFilled($pSurface, 100, 500, 500, 500, 200, 400, 0xFFFFFF)
_SDL_Flip($pSurface)

While 1
    $tRet = _SDL_PollEventEasy()
    Select
        Case $tRet = 0
            Sleep(10)
        Case $tRet[0] = $_SDL_MOUSEBUTTONDOWN
            ExitLoop
    EndSelect
WEnd

ConsoleWrite("I am exiting now, bye!" & @CRLF)
_SDL_Quit()
_SDL_Shutdown_sprig()

(I seem to have forgot how to calculate the triangle position, but I am sure you can come up with something)

There is also trigon stuff in SDL_gfx and SDL_sge, take your pick.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×