demo: El teclado se crea y se destruye según se use o no
This commit is contained in:
8
main.cpp
8
main.cpp
@@ -17,7 +17,9 @@ Código fuente creado por JailDesigner
|
|||||||
#include "units/input.h"
|
#include "units/input.h"
|
||||||
#include "units/on_screen_keyboard.h"
|
#include "units/on_screen_keyboard.h"
|
||||||
#include "quickcg.h"
|
#include "quickcg.h"
|
||||||
|
|
||||||
using namespace QuickCG;
|
using namespace QuickCG;
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
// Punteros
|
// Punteros
|
||||||
SDL_Event *event;
|
SDL_Event *event;
|
||||||
@@ -311,7 +313,7 @@ void initFire()
|
|||||||
// Hue goes from 0 to 85: red to yellow
|
// Hue goes from 0 to 85: red to yellow
|
||||||
// Saturation is always the maximum: 255
|
// Saturation is always the maximum: 255
|
||||||
// Lightness is 0..255 for x=0..128, and 255 for x=128..255
|
// Lightness is 0..255 for x=0..128, and 255 for x=128..255
|
||||||
ColorRGB color = HSLtoRGB(ColorHSL(x / 3, 255, std::min(255, x * 2)));
|
ColorRGB color = HSLtoRGB(ColorHSL(x / 3, 255, min(255, x * 2)));
|
||||||
|
|
||||||
// Pon en la paleta el color calculado
|
// Pon en la paleta el color calculado
|
||||||
palette[x] = (Uint32)16777216 * 255 + 65536 * color.r + 256 * color.g + color.b;
|
palette[x] = (Uint32)16777216 * 255 + 65536 * color.r + 256 * color.g + color.b;
|
||||||
@@ -390,12 +392,12 @@ void checkEvents()
|
|||||||
|
|
||||||
case SDL_SCANCODE_F3:
|
case SDL_SCANCODE_F3:
|
||||||
--fireModifier;
|
--fireModifier;
|
||||||
fireModifier = std::max(0, fireModifier);
|
fireModifier = max(0, fireModifier);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SDL_SCANCODE_F4:
|
case SDL_SCANCODE_F4:
|
||||||
++fireModifier;
|
++fireModifier;
|
||||||
fireModifier = std::min(30, fireModifier);
|
fireModifier = min(30, fireModifier);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SDL_SCANCODE_SPACE:
|
case SDL_SCANCODE_SPACE:
|
||||||
|
|||||||
@@ -172,8 +172,6 @@ void OnScreenKeyboard::setLayout()
|
|||||||
key.caption = allChars.substr(i, 1);
|
key.caption = allChars.substr(i, 1);
|
||||||
layout.push_back(key);
|
layout.push_back(key);
|
||||||
|
|
||||||
// std::cout << key.caption << " " << key.col << " " << key.row << " " << std::endl;
|
|
||||||
|
|
||||||
++index_col;
|
++index_col;
|
||||||
if (index_col == columns)
|
if (index_col == columns)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user