1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97
|
(* ****** ****** *)
//
// Trying libatscc2py3/PYgame
//
// Author: Hongwei Xi
// Authoremail: gmhwxiATgmailDOTcom
// Starting time: May 23, 2016
//
(* ****** ****** *)
//
#include"./../../staloadall.hats"
//
(* ****** ****** *)
//
staload "./../../SATS/PYGAME/pygame.sats"
//
(* ****** ****** *)
//
extern
fun
test01_main
(
// argless
) : void = "mac#"
//
implement
test01_main() =
{
//
val npnf = pygame_init_ret()
val ((*void*)) = println! ("np = ", npnf.0)
val ((*void*)) = println! ("nf = ", npnf.1)
//
val res = $tup(500,500)
val screen = display_set_mode(res)
val _(*Rect*) = screen.fill(Color(0, 0, 0))
//
val screen2 = Surface(screen.get_size(), SRCALPHA, 32)
//
(*
val () = println! ("screen2_width = ", screen2.get_width())
val () = println! ("screen2_height = ", screen2.get_height())
*)
//
val c1 = Color(200, 200, 200)
//
val r0 = Rect(100, 100, 300, 300)
//
val _rect_ = screen2.fill(c1, r0, 0)
//
val _rect_ =
draw_circle(screen2, Color(0,0,0), $tup(250,250), 100)
//
val _rect_ =
screen.blit(screen2, $tup(0, 0))
//
val ((*void*)) = display_flip((*void*))
//
val () = loop() where
{
fun
loop(): void = let
val e = event_wait()
val t = e.type()
in
ifcase
| t = QUIT => ()
| t = KEYDOWN => ()
| _(*else*) => loop()
end // end of [loop]
}
//
val ((*void*)) = pygame_quit((*void*))
//
} (* end of [test01_main] *)
//
(* ****** ****** *)
%{^
######
from libatscc2py3_all import *
######
from ats2py_pygame_pyame_cats import *
######
sys.setrecursionlimit(1000000)
######
%} // end of [%{^]
(* ****** ****** *)
%{$
if __name__ == '__main__': test01_main()
%} // end of [%{$]
(* ****** ****** *)
(* end of [test01.dats] *)
|