Author: jquelin
Date: Wed Oct  3 10:19:58 2007
New Revision: 21795

Modified:
   branches/pdd15oo/examples/sdl/tetris/app.pir
   branches/pdd15oo/examples/sdl/tetris/block.pir
   branches/pdd15oo/examples/sdl/tetris/board.pir
   branches/pdd15oo/examples/sdl/tetris/boarddata.pir
   branches/pdd15oo/examples/sdl/tetris/tetris.pir

Log:
more find_type removal

Modified: branches/pdd15oo/examples/sdl/tetris/app.pir
==============================================================================
--- branches/pdd15oo/examples/sdl/tetris/app.pir        (original)
+++ branches/pdd15oo/examples/sdl/tetris/app.pir        Wed Oct  3 10:19:58 2007
@@ -6,8 +6,7 @@
 
 =head1 SYNOPSIS
 
-    find_type $I0, "Tetris::App"
-    new app, $I0
+    app = new "Tetris::App"
 
     app."run"()
     app."shutdown"()
@@ -103,8 +102,7 @@
     $P0["flags"]  =   1
 
     # create the SDL object
-    find_type $I0, "SDL::App"
-    $P0 = new $I0, $P0
+    $P0 = new "SDL::App", $P0
 
     # store the SDL object
     classoffset $I0, self, "Tetris::App"
@@ -118,8 +116,7 @@
     self."initTimer"()
 
     # init the SDL event handler
-    find_type $I0, "Tetris::EventHandler"
-    $P0 = new $I0, self
+    $P0 = new "Tetris::EventHandler", self
     classoffset $I0, self, "Tetris::App"
     add $I0, tEventHandler
     setattribute self, $I0, $P0
@@ -201,8 +198,7 @@
     add $I0, tEventHandler
     getattribute eh, self, $I0
 
-    find_type $I0, "SDL::Event"
-    loop = new $I0
+    loop = new "SDL::Event"
 
     self."enableTimer"()
     loop."process_events"( 0.1, eh, self )
@@ -345,9 +341,7 @@
     .local int g
     .local int b
     .local int l
-    .local int color_id
 
-    color_id = find_type "SDL::Color"
     palette = new 'ResizablePMCArray'
     hash = new 'Hash'
 
@@ -371,7 +365,7 @@
     hash["r"] = r
     hash["g"] = g
     hash["b"] = b
-    color = new color_id, hash
+    color = new "SDL::Color", hash
 
     push palette, color
     inc i
@@ -887,8 +881,7 @@
     rect["height"] = 480
     rect["x"] = 0
     rect["y"] = 0
-    find_type $I0, "SDL::Rect"
-    temp = new $I0, rect
+    temp = new "SDL::Rect", rect
     color = self."color"( 3 )
 
     screen."fill_rect"( temp, color )
@@ -907,8 +900,7 @@
     rect["height"] = 480
     rect["x"] = 0
     rect["y"] = 0
-    find_type $I0, "SDL::Rect"
-    temp = new $I0, rect
+    temp = new "SDL::Rect", rect
     screen."update_rect"( temp )
 
     self."enableTimer"()
@@ -1083,9 +1075,8 @@
 
 NEWGAME_NEW_BOARD:
     if players <= 0 goto NEWGAME_END
-    find_type $I0, "Tetris::Board"
     print "new board...\n"
-    temp = new $I0, self
+    temp = new "Tetris::Board", self
     print "new board done.\n"
     temp."setPosition"( xpos, 10 )
     add xpos, 320

Modified: branches/pdd15oo/examples/sdl/tetris/block.pir
==============================================================================
--- branches/pdd15oo/examples/sdl/tetris/block.pir      (original)
+++ branches/pdd15oo/examples/sdl/tetris/block.pir      Wed Oct  3 10:19:58 2007
@@ -5,8 +5,7 @@
 =head1 SYNOPSIS
 
     # create a new block
-    find_type $I0, "Tetris::Block"
-    new block, $I0
+    block = new "Tetris::Block"
     block."init"( board )
 
     # let the block fall down fast
@@ -481,8 +480,7 @@
     rect["y"] = yp
     rect["width"] = i
     rect["height"] = i
-    find_type $I0, "SDL::Rect"
-    temp = new $I0, rect
+    temp = new "SDL::Rect", rect
 
     surface."fill_rect"( temp, color )
     sub i, 2
@@ -493,8 +491,7 @@
     rect["y"] = yp
     rect["width"] = i
     rect["height"] = i
-    find_type $I0, "SDL::Rect"
-    temp = new $I0, rect
+    temp = new "SDL::Rect", rect
 
     # lookup the color value
     $P0 = app."color"( 0 )
@@ -522,8 +519,7 @@
     rect["y"] = yp
     rect["width"] = extent
     rect["height"] = extent
-    find_type $I0, "SDL::Rect"
-    temp = new $I0, rect
+    temp = new "SDL::Rect", rect
     inc extent
     surface."fill_rect"( temp, color )
 SKIP:

Modified: branches/pdd15oo/examples/sdl/tetris/board.pir
==============================================================================
--- branches/pdd15oo/examples/sdl/tetris/board.pir      (original)
+++ branches/pdd15oo/examples/sdl/tetris/board.pir      Wed Oct  3 10:19:58 2007
@@ -8,8 +8,7 @@
     app = global "Tetris::App"
 
     # create a new board
-    find_type $I0, "Tetris::Board"
-    board = new $I0, app
+    board = new "Tetris::Board", app
 
     # let the current block of the board fall down fast
     board."fall"()
@@ -77,8 +76,7 @@
     self."fill"( 0 )
 
     # setup the cache
-    find_type $I0, "Tetris::BoardData"
-    new temp, $I0
+    temp = new "Tetris::BoardData"
     temp."init"( w, h )
     temp."fill"( -1 )
     setprop self, "cache", temp
@@ -647,8 +645,7 @@
     rect["y"] = ypos
     rect["width"] = xp
     rect["height"] = yp
-    find_type $I0, "SDL::Rect"
-    temp = new $I0, rect
+    temp = new "SDL::Rect", rect
     color = palette[15]
     surface."fill_rect"( temp, color )
 NO_FIELDBACKGROUND:
@@ -682,8 +679,7 @@
     rect["y"] = yp
     rect["width"] = $I0
     rect["height"] = $I0
-    find_type $I0, "SDL::Rect"
-    temp = new $I0, rect
+    temp = new "SDL::Rect", rect
 
     $I0 = self[i]
     $I1 = cache[i]
@@ -735,8 +731,7 @@
     rect["y"] = yp
     rect["width"] = w
     rect["height"] = h
-    find_type $I0, "SDL::Rect"
-    temp = new $I0, rect
+    temp = new "SDL::Rect", rect
     color = palette[15]
     surface."fill_rect"( temp, color )
     inc xp
@@ -747,8 +742,7 @@
     rect["y"] = yp
     rect["width"] = w
     rect["height"] = h
-    find_type $I0, "SDL::Rect"
-    temp = new $I0, rect
+    temp = new "SDL::Rect", rect
     color = palette[0]
     surface."fill_rect"( temp, color )
     getprop temp, "nextblock", self

Modified: branches/pdd15oo/examples/sdl/tetris/boarddata.pir
==============================================================================
--- branches/pdd15oo/examples/sdl/tetris/boarddata.pir  (original)
+++ branches/pdd15oo/examples/sdl/tetris/boarddata.pir  Wed Oct  3 10:19:58 2007
@@ -5,8 +5,7 @@
 =head1 SYNOPSIS
 
     # create the board data
-    find_type $I0, "BoardData"
-    new data, $I0
+    data = new "BoardData"
     data."new"( 10, 20 )
 
     # fill the board

Modified: branches/pdd15oo/examples/sdl/tetris/tetris.pir
==============================================================================
--- branches/pdd15oo/examples/sdl/tetris/tetris.pir     (original)
+++ branches/pdd15oo/examples/sdl/tetris/tetris.pir     Wed Oct  3 10:19:58 2007
@@ -34,8 +34,7 @@
     load_bytecode "examples/sdl/tetris/app.pir"
     
     # create the tetris app
-    find_type $I0, "Tetris::App"
-    new app, $I0
+    app = new "Tetris::App"
     
     app."flag"( "show blocksize", 1 )
     # run the tetris app

Reply via email to