【问题标题】:Fill Rectangles based on Starting Point but must be in a line根据起点填充矩形,但必须在一条线上
【发布时间】:2013-02-20 12:49:23
【问题描述】:

我知道有人可以帮助我。

我正忙于开发一个选择文字游戏,但我不确定如何突出显示选定的字母。

我目前正在创建一个块网格。

Then when the user clicks and moves the mouse from on block to another I use the Rect to check if they intersect when they do I mark that block as selected but I need to ignore the block number 2 when block number 3 is selected选择块号 4 时也会发生同样的情况。所以那个模式是:1,3,5,7 块数 2,4,6 不应该被选中。

亲切的问候,

约翰

【问题讨论】:

    标签: c# drawing rectangles


    【解决方案1】:

    我假设这是一个标准的猜词游戏,其中单词字母总是落在站立线上、睡眠线上或 45 度角线上的盒子里。在这种情况下,您只需要用户输入的开始框和结束框,您可以通过添加 +1 来选择/标记从开始框开始的所有框,直到到达最后一个框。

    假设用户盯着 startBox(rowStart,colStart) 直到 lastBox(rowLast,colLast) 所以你需要做的就是

    rowPos = startBox.rowStart;
    colPos = startBox.colStart;
    
    do{
      mark startBox(rowPos, colPos)
      rowPos++;
      colPos++;
    } while(rowPos<=rowLast && colPos<=colLast)
    

    注意:您必须评估 startBox 和 lastBox 以确定用户是右下角、左下角、右上角还是左上角,并相应地在行和/或列上加/减 1。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2011-06-30
      • 1970-01-01
      • 2012-10-19
      • 2012-07-23
      • 2011-02-15
      • 1970-01-01
      • 2018-01-22
      相关资源
      最近更新 更多