Skip to content

Instantly share code, notes, and snippets.

@kw0006667
kw0006667 / CXmlStream.cpp
Last active July 1, 2016 18:52
Cocos2d-x Read/Write XML file
#include "CXmlStream.h"
CXmlStream::CXmlStream(const char* dicFilename)
{
this->m_dictionary = CCDictionary::createWithContentsOfFile(dicFilename);
}
CXmlStream::~CXmlStream()
{
@kw0006667
kw0006667 / main.cpp
Created May 3, 2013 04:51
C++ STL list 的簡單使用 將實體丟入list 後,即使在 list 中移除,原來的實體還是會在
#include <iostream>
#include <list>
#include <algorithm>
#include <string>
using namespace std;
class Sprite
{
public:
<dict>
<key>HomeScene</key>
<string>首頁</string>
<key>MainScene</key>
<string>主頁</string>
<key>BookScene</key>
<string>百科</string>
<key>GameScene</key>
<string>遊戲</string>
<key>AnimScene</key>
#ifdef GL_ES
precision mediump float;
#endif
uniform vec2 pointMain[225];
uniform int pointNumber;
float Blob(vec2 position, vec2 point, float radius)
{
float temp = pow(position.x - point.x, 2.0) + pow(position.y - point.y, 2.0);
@kw0006667
kw0006667 / chart.js
Last active March 16, 2020 00:04
Select point by calling select() method in Highcharts
var searchText = 'US';
var chart = new Highcharts.chart('container', {
series: [{
name: 'Asia',
data: [{
name: 'Taiwan',
value: 87
}, {
name: 'Japan',
value: 86
@kw0006667
kw0006667 / search.js
Created March 16, 2020 00:33
Select points by changing opacity of points in Highcharts
let searchInput = document.getElementById('search');
searchInput.oninput = function(event) {
currentSearch = this.value;
chart.series.forEach(serie => {
serie.points.forEach(point => {
point.update({ color: Highcharts.theme.colors[point.colorIndex] }, false);
});
});
chart.redraw();
@kw0006667
kw0006667 / theme.js
Created March 16, 2020 00:52
Set theme for your Highcharts
Highcharts.theme = {
colors: ['#2b908f', '#90ee7e', '#f45b5b', '#7798BF', '#aaeeee', '#ff0066',
'#eeaaee', '#55BF3B', '#DF5353', '#7798BF', '#aaeeee'
]};
Highcharts.setOptions(Highcharts.theme);