赞 | 1 |
VIP | 0 |
好人卡 | 1 |
积分 | 1 |
经验 | 5436 |
最后登录 | 2023-1-31 |
在线时间 | 585 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 68
- 在线时间
- 585 小时
- 注册时间
- 2013-5-25
- 帖子
- 1524
|
上下各开一个洞- @command_window.height = 350
- @command_window.contents = Bitmap.new(@command_window.width-32,@command_window.height-32)
- class<<@command_window
- def draw_item(index, color)
- self.contents.font.color = color
- rect = Rect.new(4, 32 * index - @item_max*32 / 2 + self.height/2-16, self.contents.width - 8, 32)
- self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
- self.contents.draw_text(rect, @commands[index])
- end
- def update_cursor_rect
- if @index < 0
- self.cursor_rect.empty
- return
- end
- row = @index / @column_max
- if row < self.top_row
- self.top_row = row
- end
- if row > self.top_row + (self.page_row_max - 1)
- self.top_row = row - (self.page_row_max - 1)
- end
- cursor_width = self.width / @column_max - 32
- x = @index % @column_max * (cursor_width + 32)
- y = @index / @column_max * 32 - self.oy - @item_max*32 / 2 + self.height/2 - 16
- self.cursor_rect.set(x, y, cursor_width, 32)
- end
- end
- @command_window.refresh
- @command_window.update_cursor_rect
复制代码 |
评分
-
查看全部评分
|