Logging bug fix and some warning fixes.

This commit is contained in:
Henrik Rydgard 2013-08-27 19:43:40 +02:00
parent bb8f38a145
commit b063724c9e
8 changed files with 19 additions and 8 deletions

View File

@ -645,6 +645,7 @@ int main(int argc, char *argv[]) {
input_state.pointer_y[0] = my;
//input_state.mouse_buttons_down = 1;
input_state.pointer_down[0] = true;
input_state.mouse_valid = true;
TouchInput input;
input.x = mx;
input.y = my;
@ -685,6 +686,7 @@ int main(int argc, char *argv[]) {
if (input_state.pointer_down[0]) {
input_state.pointer_x[0] = mx;
input_state.pointer_y[0] = my;
input_state.mouse_valid = true;
TouchInput input;
input.x = mx;
input.y = my;
@ -700,6 +702,7 @@ int main(int argc, char *argv[]) {
input_state.pointer_x[0] = mx;
input_state.pointer_y[0] = my;
input_state.pointer_down[0] = false;
input_state.mouse_valid = true;
//input_state.mouse_buttons_up = 1;
TouchInput input;
input.x = mx;

View File

@ -25,6 +25,7 @@ void OutputDebugStringUTF8(const char *p) {
int len = std::min(2047, (int)strlen(p));
int size = (int)MultiByteToWideChar(CP_UTF8, 0, p, len, NULL, 0);
MultiByteToWideChar(CP_UTF8, 0, p, len, temp, size);
temp[size] = 0;
OutputDebugString(temp);
}

View File

@ -7,6 +7,7 @@
#include "base/display.h"
#include "gfx/gl_lost_manager.h"
#include "gfx/texture_atlas.h"
#include "math/geom2d.h"
struct Atlas;
@ -102,6 +103,9 @@ public:
void MeasureImage(ImageID atlas_image, float *w, float *h);
void DrawImage(ImageID atlas_image, float x, float y, float scale, Color color = COLOR(0xFFFFFF), int align = ALIGN_TOPLEFT);
void DrawImageStretch(ImageID atlas_image, float x1, float y1, float x2, float y2, Color color = COLOR(0xFFFFFF));
void DrawImageStretch(int atlas_image, const Bounds &bounds, Color color = COLOR(0xFFFFFF)) {
DrawImageStretch(atlas_image, bounds.x, bounds.y, bounds.x2(), bounds.y2(), color);
}
void DrawImageRotated(ImageID atlas_image, float x, float y, float scale, float angle, Color color = COLOR(0xFFFFFF), bool mirror_h = false); // Always centers
void DrawTexRect(float x1, float y1, float x2, float y2, float u1, float v1, float u2, float v2, Color color);
// Results in 18 triangles. Kind of expensive for a button.

View File

@ -61,7 +61,7 @@ enum {
};
#ifndef MAX_POINTERS
#define MAX_POINTERS 8
#define MAX_POINTERS 10
#endif
#ifndef MAX_KEYQUEUESIZE

View File

@ -48,6 +48,7 @@ public:
void ActivateTopScissor();
DrawBuffer *Draw() const { return uidrawbuffer_; }
DrawBuffer *DrawTop() const { return uidrawbufferTop_; }
const UI::Theme *theme;

View File

@ -281,9 +281,9 @@ public:
// Please note that Touch is called ENTIRELY asynchronously from drawing!
// Can even be called on a different thread! This is to really minimize latency, and decouple
// touch response from the frame rate.
virtual void Key(const KeyInput &input) = 0;
virtual void Touch(const TouchInput &input) = 0;
// touch response from the frame rate. Same with Key and Axis.
virtual void Key(const KeyInput &input) {}
virtual void Touch(const TouchInput &input) {}
virtual void Axis(const AxisInput &input) {}
virtual void Update(const InputState &input_state) {}
@ -400,7 +400,7 @@ class Button : public Clickable {
public:
Button(const std::string &text, LayoutParams *layoutParams = 0)
: Clickable(layoutParams), text_(text) {}
virtual void Draw(UIContext &dc);
virtual void GetContentDimensions(const UIContext &dc, float &w, float &h) const;
const std::string &GetText() const { return text_; }

View File

@ -871,10 +871,10 @@ EventReturn ChoiceStrip::OnChoiceClick(EventParams &e) {
void ChoiceStrip::SetSelection(int sel) {
int prevSelected = selected_;
if (selected_ < views_.size())
if (selected_ < (int)views_.size())
static_cast<StickyChoice *>(views_[selected_])->Release();
selected_ = sel;
if (selected_ < views_.size())
if (selected_ < (int)views_.size())
static_cast<StickyChoice *>(views_[selected_])->Press();
if (topTabs_ && prevSelected != selected_) {
EventParams e;
@ -887,7 +887,7 @@ void ChoiceStrip::Key(const KeyInput &input) {
if (input.flags & KEY_DOWN) {
if (input.keyCode == NKCODE_BUTTON_L1 && selected_ > 0) {
SetSelection(selected_ - 1);
} else if (input.keyCode == NKCODE_BUTTON_R1 && selected_ < views_.size() - 1) {
} else if (input.keyCode == NKCODE_BUTTON_R1 && selected_ < (int)views_.size() - 1) {
SetSelection(selected_ + 1);
}
}

View File

@ -284,6 +284,8 @@ public:
tabs_[currentTab_]->SetVisibility(V_VISIBLE);
}
int GetCurrentTab() const { return currentTab_; }
private:
EventReturn OnTabClick(EventParams &e);