Форум программистов, компьютерный форум, киберфорум
C++/CLI Windows Forms
Войти
Регистрация
Восстановить пароль
Блоги Сообщество Поиск Заказать работу  
 
0 / 0 / 0
Регистрация: 27.02.2016
Сообщений: 21

Периодическое обновление ячеек в игре

20.06.2016, 11:44. Показов 1077. Ответов 0
Метки нет (Все метки)

Студворк — интернет-сервис помощи студентам
Это игра, нужно успать нажать на кнопку пока она активна, но через она исчезает, когда активна другая(для летней практики в вузе доп. задание).
ребят ну вопрос такой: есть ли какой то процесс в самой форме который всё время запрашивается, не такой как при загрузке, когда один раз пробежит и по нему и всё, а чтобы всё время обновлялось?
Ну вообще я изначально делал в кнопке старт, но тогда я не уверен что во время этого можно будет нажимать другие кнопки, а если можно то как проверить нажата ли кнопка пока идёт время игры(минута даётся на неё).
И ещё как узнать что таймер закончил работу.
C++
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
#pragma once
#include "ctime"
#include "iostream"
 
using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;
 
 
namespace Летняяпрактика {
 
    /// <summary>
    /// Сводка для Form_Game
    ///
    /// Внимание! При изменении имени этого класса необходимо также изменить
    ///          свойство имени файла ресурсов ("Resource File Name") для средства компиляции управляемого ресурса,
    ///          связанного со всеми файлами с расширением .resx, от которых зависит данный класс. В противном случае,
    ///          конструкторы не смогут правильно работать с локализованными
    ///          ресурсами, сопоставленными данной форме.
    /// </summary>
    public ref class Form_Game : public System::Windows::Forms::Form
    {
    public:
        Form_Game(void)
        {
            InitializeComponent();
            //
            //TODO: добавьте код конструктора
            //
        }
 
    protected:
        /// <summary>
        /// Освободить все используемые ресурсы.
        /// </summary>
        ~Form_Game()
        {
            if (components)
            {
                delete components;
            }
        }
    private: System::Windows::Forms::Button^  button1;
    protected: 
    private: System::Windows::Forms::Button^  button2;
    private: System::Windows::Forms::Button^  button3;
    private: System::Windows::Forms::Button^  button4;
    private: System::Windows::Forms::Button^  button5;
    private: System::Windows::Forms::Button^  button6;
    private: System::Windows::Forms::Button^  button7;
    private: System::Windows::Forms::Button^  button8;
    private: System::Windows::Forms::Button^  button9;
    private: System::Windows::Forms::Button^  button10;
    private: System::Windows::Forms::Button^  button11;
    private: System::Windows::Forms::Button^  button12;
    private: System::Windows::Forms::Button^  button13;
    private: System::Windows::Forms::Button^  button14;
    private: System::Windows::Forms::Button^  button15;
    private: System::Windows::Forms::Button^  button16;
    private: System::Windows::Forms::Button^  button_start;
    private: System::Windows::Forms::Button^  button_out;
    private: System::Windows::Forms::Timer^  timer_game;
    private: System::ComponentModel::IContainer^  components;
 
 
 
    private:
        /// <summary>
        /// Требуется переменная конструктора.
        /// </summary>
 
 
#pragma region Windows Form Designer generated code
        /// <summary>
        /// Обязательный метод для поддержки конструктора - не изменяйте
        /// содержимое данного метода при помощи редактора кода.
        /// </summary>
        void InitializeComponent(void)
        {
            this->components = (gcnew System::ComponentModel::Container());
            this->button1 = (gcnew System::Windows::Forms::Button());
            this->button2 = (gcnew System::Windows::Forms::Button());
            this->button3 = (gcnew System::Windows::Forms::Button());
            this->button4 = (gcnew System::Windows::Forms::Button());
            this->button5 = (gcnew System::Windows::Forms::Button());
            this->button6 = (gcnew System::Windows::Forms::Button());
            this->button7 = (gcnew System::Windows::Forms::Button());
            this->button8 = (gcnew System::Windows::Forms::Button());
            this->button9 = (gcnew System::Windows::Forms::Button());
            this->button10 = (gcnew System::Windows::Forms::Button());
            this->button11 = (gcnew System::Windows::Forms::Button());
            this->button12 = (gcnew System::Windows::Forms::Button());
            this->button13 = (gcnew System::Windows::Forms::Button());
            this->button14 = (gcnew System::Windows::Forms::Button());
            this->button15 = (gcnew System::Windows::Forms::Button());
            this->button16 = (gcnew System::Windows::Forms::Button());
            this->button_start = (gcnew System::Windows::Forms::Button());
            this->button_out = (gcnew System::Windows::Forms::Button());
            this->timer_game = (gcnew System::Windows::Forms::Timer(this->components));
            this->SuspendLayout();
            // 
            // button1
            // 
            this->button1->Location = System::Drawing::Point(57, 71);
            this->button1->Name = L"button1";
            this->button1->Size = System::Drawing::Size(75, 64);
            this->button1->TabIndex = 0;
            this->button1->UseVisualStyleBackColor = true;
            // 
            // button2
            // 
            this->button2->Location = System::Drawing::Point(166, 71);
            this->button2->Name = L"button2";
            this->button2->Size = System::Drawing::Size(75, 64);
            this->button2->TabIndex = 1;
            this->button2->UseVisualStyleBackColor = true;
            // 
            // button3
            // 
            this->button3->Location = System::Drawing::Point(276, 71);
            this->button3->Name = L"button3";
            this->button3->Size = System::Drawing::Size(75, 64);
            this->button3->TabIndex = 2;
            this->button3->UseVisualStyleBackColor = true;
            // 
            // button4
            // 
            this->button4->Location = System::Drawing::Point(382, 71);
            this->button4->Name = L"button4";
            this->button4->Size = System::Drawing::Size(75, 64);
            this->button4->TabIndex = 3;
            this->button4->UseVisualStyleBackColor = true;
            // 
            // button5
            // 
            this->button5->Location = System::Drawing::Point(57, 153);
            this->button5->Name = L"button5";
            this->button5->Size = System::Drawing::Size(75, 64);
            this->button5->TabIndex = 4;
            this->button5->UseVisualStyleBackColor = true;
            // 
            // button6
            // 
            this->button6->Location = System::Drawing::Point(166, 153);
            this->button6->Name = L"button6";
            this->button6->Size = System::Drawing::Size(75, 64);
            this->button6->TabIndex = 5;
            this->button6->UseVisualStyleBackColor = true;
            // 
            // button7
            // 
            this->button7->Location = System::Drawing::Point(276, 153);
            this->button7->Name = L"button7";
            this->button7->Size = System::Drawing::Size(75, 64);
            this->button7->TabIndex = 6;
            this->button7->UseVisualStyleBackColor = true;
            // 
            // button8
            // 
            this->button8->Location = System::Drawing::Point(382, 153);
            this->button8->Name = L"button8";
            this->button8->Size = System::Drawing::Size(75, 64);
            this->button8->TabIndex = 7;
            this->button8->UseVisualStyleBackColor = true;
            // 
            // button9
            // 
            this->button9->Location = System::Drawing::Point(57, 243);
            this->button9->Name = L"button9";
            this->button9->Size = System::Drawing::Size(75, 64);
            this->button9->TabIndex = 8;
            this->button9->UseVisualStyleBackColor = true;
            // 
            // button10
            // 
            this->button10->Location = System::Drawing::Point(166, 243);
            this->button10->Name = L"button10";
            this->button10->Size = System::Drawing::Size(75, 64);
            this->button10->TabIndex = 9;
            this->button10->UseVisualStyleBackColor = true;
            // 
            // button11
            // 
            this->button11->Location = System::Drawing::Point(276, 243);
            this->button11->Name = L"button11";
            this->button11->Size = System::Drawing::Size(75, 64);
            this->button11->TabIndex = 10;
            this->button11->UseVisualStyleBackColor = true;
            // 
            // button12
            // 
            this->button12->Location = System::Drawing::Point(382, 243);
            this->button12->Name = L"button12";
            this->button12->Size = System::Drawing::Size(75, 64);
            this->button12->TabIndex = 11;
            this->button12->UseVisualStyleBackColor = true;
            // 
            // button13
            // 
            this->button13->Location = System::Drawing::Point(57, 335);
            this->button13->Name = L"button13";
            this->button13->Size = System::Drawing::Size(75, 64);
            this->button13->TabIndex = 12;
            this->button13->UseVisualStyleBackColor = true;
            // 
            // button14
            // 
            this->button14->Location = System::Drawing::Point(166, 335);
            this->button14->Name = L"button14";
            this->button14->Size = System::Drawing::Size(75, 64);
            this->button14->TabIndex = 13;
            this->button14->UseVisualStyleBackColor = true;
            // 
            // button15
            // 
            this->button15->Location = System::Drawing::Point(276, 335);
            this->button15->Name = L"button15";
            this->button15->Size = System::Drawing::Size(75, 64);
            this->button15->TabIndex = 14;
            this->button15->UseVisualStyleBackColor = true;
            // 
            // button16
            // 
            this->button16->Location = System::Drawing::Point(382, 335);
            this->button16->Name = L"button16";
            this->button16->Size = System::Drawing::Size(75, 64);
            this->button16->TabIndex = 15;
            this->button16->UseVisualStyleBackColor = true;
            // 
            // button_start
            // 
            this->button_start->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 11, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point, 
                static_cast<System::Byte>(204)));
            this->button_start->Location = System::Drawing::Point(-1, -1);
            this->button_start->Name = L"button_start";
            this->button_start->Size = System::Drawing::Size(133, 40);
            this->button_start->TabIndex = 16;
            this->button_start->Text = L"Старт!";
            this->button_start->UseVisualStyleBackColor = true;
            this->button_start->Click += gcnew System::EventHandler(this, &Form_Game::button_start_Click);
            // 
            // button_out
            // 
            this->button_out->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 11, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point, 
                static_cast<System::Byte>(204)));
            this->button_out->Location = System::Drawing::Point(382, -1);
            this->button_out->Name = L"button_out";
            this->button_out->Size = System::Drawing::Size(133, 40);
            this->button_out->TabIndex = 17;
            this->button_out->Text = L"Выход!";
            this->button_out->UseVisualStyleBackColor = true;
            this->button_out->Click += gcnew System::EventHandler(this, &Form_Game::button_out_Click);
            // 
            // timer_game
            // 
            this->timer_game->Interval = 60000;
            // 
            // Form_Game
            // 
            this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
            this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
            this->ClientSize = System::Drawing::Size(514, 436);
            this->Controls->Add(this->button_out);
            this->Controls->Add(this->button_start);
            this->Controls->Add(this->button16);
            this->Controls->Add(this->button15);
            this->Controls->Add(this->button14);
            this->Controls->Add(this->button13);
            this->Controls->Add(this->button12);
            this->Controls->Add(this->button11);
            this->Controls->Add(this->button10);
            this->Controls->Add(this->button9);
            this->Controls->Add(this->button8);
            this->Controls->Add(this->button7);
            this->Controls->Add(this->button6);
            this->Controls->Add(this->button5);
            this->Controls->Add(this->button4);
            this->Controls->Add(this->button3);
            this->Controls->Add(this->button2);
            this->Controls->Add(this->button1);
            this->Name = L"Form_Game";
            this->Text = L"Form_Game";
            this->Load += gcnew System::EventHandler(this, &Form_Game::Form_Game_Load);
            this->ResumeLayout(false);
 
        }
#pragma endregion
        void BtnFalse() {
            this->button_out->Enabled = false;
            this->button_start->Enabled = true;
            this->button1->Enabled = false;
            this->button2->Enabled = false;
            this->button3->Enabled = false;
            this->button4->Enabled = false;
            this->button5->Enabled = false;
            this->button6->Enabled = false;
            this->button7->Enabled = false;
            this->button8->Enabled = false;
            this->button9->Enabled = false;
            this->button10->Enabled = false;
            this->button11->Enabled = false;
            this->button12->Enabled = false;
            this->button13->Enabled = false;
            this->button14->Enabled = false;
            this->button15->Enabled = false;
            this->button16->Enabled = false;
        }
    private: System::Void Form_Game_Load(System::Object^  sender, System::EventArgs^  e) {
                 BtnFalse();
             }
private: System::Void button_start_Click(System::Object^  sender, System::EventArgs^  e) {
             this->button_out->Enabled = true;
             this->button_start->Enabled = false;
             this->timer_game->Start();
             int limit = 60000;
             while (/*пока время в таймере не ноль, как?*/) {
                 srand(time(0));
                 int cube = 1 + rand()%16; // для активации рандомной кнопки
                 if ((this->button_out->Tag) == 1) { //пытался сделать проверку нажати кнопки
                     this->button_start->Enabled = true;
                     break;
                 }
             }
                 this->button1->Enabled = true;// решил проверить правильность работы
         }
private: System::Void button_out_Click(System::Object^  sender, System::EventArgs^  e) {
             this->button_out->Tag = 1;
         }
};
}
Миниатюры
Периодическое обновление ячеек в игре  
0
cpp_developer
Эксперт
20123 / 5690 / 1417
Регистрация: 09.04.2010
Сообщений: 22,546
Блог
20.06.2016, 11:44
Ответы с готовыми решениями:

Периодическое обновление ListView
Привет всем! Есть задача, вывести на экран список, данные берутся с сервера, а потом с какой то периодичностью обновлять его с сервера. ...

Периодическое произвольное обновление рабочего стола
Добрый вечер, ребята. Столкнулся со следующей проблемой. Обновляется рабочий стол произвольно, сам по себе с периодичностью ~ 1м. Не важно,...

Пользовательская адресации ячеек массива в игре
Добрый вечер, уважаемые форумчане! В своей консольной игре использую двумерный массив 6x6. Пользователь заполняет ячейки этого массива...

0
Надоела реклама? Зарегистрируйтесь и она исчезнет полностью.
raxper
Эксперт
30234 / 6612 / 1498
Регистрация: 28.12.2010
Сообщений: 21,154
Блог
20.06.2016, 11:44
Помогаю со студенческими работами здесь

Как сделать обновление карты в игре
Наше такую штуку. Допустим есть функция draw_map() - рисует карту, и чтобы она обновлялась её пихают в цикл, например: while(1) { ...

Обновление ячеек
Добрый день, коллеги! В ячейках вбиты формулы для генерации случайных чисел в заданных диапазонах. Они обновляются (создают новое...

Обновление ячеек на Ajax
setInterval(function() { var cells_length = document.getElementsByClassName('cell').length; //Кол ячеек var i = 0; var name...

Обновление ячеек таблицы
Здравствуйте. Скажем, у нас имеется в таблице 1000 ячеек и мы их собираемся обновить(всех разом). Вопрос. Влияет ли количество...

Исправить заливку ячеек и обновление данных
Здравствуйте, столкнулась с проблемой, что при переносе данных на другой лист, первая ячейка в массиве закрашивается в красный. И все бы...


Искать еще темы с ответами

Или воспользуйтесь поиском по форуму:
1
Ответ Создать тему
Новые блоги и статьи
Мысли в слух. Про "навсегда".
kumehtar 16.04.2026
Подумалось тут, что наверное очень глупо использовать во всяких своих установках понятие "навсегда". Это очень сильное понятие, и я только начинаю понимать край его смысла, не смотря на то что давно. . .
My Business CRM
MaGz GoLd 16.04.2026
Всем привет, недавно возникла потребность создать CRM, для личных нужд. Собственно программа предоставляет из себя базу данных клиентов, в которой можно фиксировать звонки, стадии сделки, а также. . .
Знаешь почему 90% людей редко бывают счастливыми?
kumehtar 14.04.2026
Потому что они ждут. Ждут выходных, ждут отпуска, ждут удачного момента. . . а удачный момент так и не приходит.
Фиксация колонок в отчете СКД
Maks 14.04.2026
Фиксация колонок в СКД отчета типа Таблица. Задача: зафиксировать три левых колонки в отчете. Процедура ПриКомпоновкеРезультата(ДокументРезультат, ДанныеРасшифровки, СтандартнаяОбработка) / / . . .
Настройки VS Code
Loafer 13.04.2026
{ "cmake. configureOnOpen": false, "diffEditor. ignoreTrimWhitespace": true, "editor. guides. bracketPairs": "active", "extensions. ignoreRecommendations": true, . . .
Оптимизация кода на разграничение прав доступа к элементам формы
Maks 13.04.2026
Алгоритм из решения ниже реализован на нетиповом документе, разработанного в конфигурации КА2. Задачи, как таковой, поставлено не было, проделанное ниже исключительно моя инициатива. Было так:. . .
Контроль заполнения и очистка дат в зависимости от значения перечислений
Maks 12.04.2026
Алгоритм из решения ниже реализован на примере нетипового документа "ПланированиеПерсонала", разработанного в конфигурации КА2. Задача: реализовать контроль корректности заполнения дат назначения. . .
Архитектура слоя интернета для сервера-слоя.
Hrethgir 11.04.2026
В продолжение https:/ / www. cyberforum. ru/ blogs/ 223907/ 10860. html Знаешь что я подумал? Раз мы все источники пишем в голове ветки, то ничего не мешает добавить в голову такой источник, который сам. . .
КиберФорум - форум программистов, компьютерный форум, программирование
Powered by vBulletin
Copyright ©2000 - 2026, CyberForum.ru