Skip to content

Instantly share code, notes, and snippets.

View alexesDev's full-sized avatar

Alexey Yurchenko alexesDev

  • nonono
View GitHub Profile
manualObject->begin("Island", Ogre::RenderOperation::OT_TRIANGLE_LIST);
for(uint z = 0; z < mapSize; ++z)
{
for(uint x = 0; x < mapSize; ++x)
{
if(mapData[z * mapSize + x] == 0)
continue;
//TOP AND DOWN QUADS
@alexesDev
alexesDev / gist:3028102
Created July 1, 2012 11:40
Island mesh
for(uint z = 0; z < mapSize; ++z)
{
for(uint x = 0; x < mapSize; ++x)
{
int index = z * mapSize + x;
if(mapData[index] == 0)
continue;
positionsMap[index] = Vector3(x, mapData[index] * 0.05, z);
(function(j, b, u){
var ItemsCollection = b.Collection.extend({
setSelectedModel: function(model){
this.each(function(model){
model.set('selected', false);
});
model.set('selected', true);
model.trigger('selected');
},
[{
label: '1',
items: [{
label: '1 - 1'
}, {
label: '1 - 2',
items: [{
label: '1 - 2 - 1'
}, {
label: '1 - 2 - 2',
(function(j, b, u){
var ItemModel = b.Model.extend({
itemsCollection: null,
defaults: {
label: '-',
items: [],
selected: false
},
@alexesDev
alexesDev / gist:3349185
Created August 14, 2012 13:19
Send BufferProtocol message in Qt
Protocol::Request request;
request.mutable_island()->mutable_binoms()->set_id(99999);
request.mutable_island()->mutable_heigthmap()->set_id(1111);
std::ostringstream messageStream;
request.SerializeToOstream(&messageStream);
QByteArray block;
QDataStream out(&block, QIODevice::WriteOnly);
out.setVersion(QDataStream::Qt_4_8);
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QtGui/QMainWindow>
#include <QPainter>
class MainWindow : public QMainWindow
{
Q_OBJECT
#include "MainWindow.h"
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent)
{
}
MainWindow::~MainWindow()
{
}
#include <QtGui/QApplication>
#include "MainWindow.h"
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
MainWindow w;
w.show();
@alexesDev
alexesDev / gist:3420709
Created August 22, 2012 00:09
Awesome config
-- Standard awesome library
require("awful")
require("awful.autofocus")
require("awful.rules")
-- Theme handling library
require("beautiful")
-- Notification library
require("naughty")
-- {{{ Error handling