小编Nic*_*las的帖子

获取数组中的第一个和最后一个元素,ES6方式

let array = [1,2,3,4,5,6,7,8,9,0]

文档是这样的

[first, ...rest] = array 将输出1和阵列的其余部分

现在是有办法只有采取第一和最后一个元素1 & 0Destructuring

例如: [first, ...middle, last] = array

我知道如何以另一种方式获取第一个和最后一个元素,但我想知道是否可以使用es6

javascript arrays function ecmascript-6

18
推荐指数
1
解决办法
3万
查看次数

OpenGL SuperBible第6版,头文件sb6.h缺失

最近我开始学习OpenGL和; 反过来,开始阅读使用OpenGL 4.3的OpenGL SuperBible第6版.

我的问题出现在sb6.h头文件中,因为在本书中写道,这是一个c ++头文件,它定义了一个名为sb6的命名空间,它包含了一个应用程序类的声明.

当我尝试编译我的程序时,我的C++ IDE(Visual Studio 2010)会抛出一个错误,指出无法找到这样的头文件.

所以也许你们其中一个人听说过这个问题,或者也开始阅读这本书并知道如何解决这个问题; 如果是的话请回复.

#include "sb6.h"

//derive my_application from sb6:application

class my_application : public sb6.application
{
public : 

   //Rendering function
   void render(double currentTime){

   //Simply clear the window red
   static const GLfloat red[] = {1.0f , 0.0f , 0.0f , 1.0f};

  glClearBufferfv(GL_COLOR, 0 , red) ; 
}
Run Code Online (Sandbox Code Playgroud)

c++ opengl opengl-4

4
推荐指数
1
解决办法
3559
查看次数

Unity和Eclipse的集成

嘿伙计们,我需要一点帮助将Unity集成到Eclipse中

我的参考页面是这里=> 这里

我有Unity3D Pro版和Android插件专业版

  • 像往常一样设置Unity Android项目并点击Build.
  • 输入您的项目文件夹,转到Temp/StagingArea.
  • 将所有项目文件复制到新文件夹.
  • 将此文件夹作为Eclipse中的新Android项目导入.
  • 将此项目标记为项目属性窗口中的库.(右键单击项目名称,转到Properties-> Android并标记"Is Library".)
  • 在Eclipse中创建一个新的Android项目.这将构成项目的Java部分.
  • 将Unity Android项目作为库添加到新项目中.(右键单击项目名称,转到Properties-> Android,选择"Add ...",添加项目.)
  • 将classes.jar库添加到新项目的库引用中.(在属性中,转到Java_Build_path-> Libraries,选择"Add External Jar ...",导航到UNITY_INSTALLATION\Editor\Data\PlaybackEngines \和roidplayer\bin并添加classes.jar)

到现在为止,如果我将这个小项目运行到我的设备中,我会得到类似的东西

您可以通过此链接查看图片.

https://copy.com/vVaCyQTEUECV

下一步是这样的:

  • 将assets文件夹从库项目移动到新项目.(Android不允许在库中使用资源,并且每当重建Unity项目时都必须重复这最后一步.)

我正在将资产文件夹和res文件夹从库项目移动到新项目.

之后我将从库移动AndroidMnifest.xml并替换项目

这是我的MainActivity.java代码

package com.Developer.PackMan;

import com.unity3d.player.UnityPlayerNativeActivity;


import android.os.Bundle;

public class MainActivity extends UnityPlayerNativeActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

}
}
Run Code Online (Sandbox Code Playgroud)

这是Manifest.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.Developer.PackMan" android:theme="@android:style/Theme.NoTitleBar" android:versionName="1.0" android:versionCode="1" android:installLocation="preferExternal">
  <supports-screens android:smallScreens="true" android:normalScreens="true" android:largeScreens="true" android:xlargeScreens="true" android:anyDensity="true" />
  <application android:icon="@drawable/app_icon" android:label="@string/app_name" android:debuggable="false">
    <activity android:name="com.unity3d.player.UnityPlayerNativeActivity" android:label="@string/app_name" android:screenOrientation="landscape" android:launchMode="singleTask" …
Run Code Online (Sandbox Code Playgroud)

eclipse integration android unity-game-engine

4
推荐指数
1
解决办法
9026
查看次数

导入BitMap使我的窗口滞后

我需要一些帮助.

我将一个位图导入我的Win32窗口.我正在构建它,几秒钟后它开始滞后很多.我不知道为什么,但我想我使用它后没有正确地从内存中删除它.

提前感谢您的帮助.

我在测试时看到了一种行为.如果我没有移动窗口而不是移动窗口,但移动它后它开始滞后并阻止我的IDE.也许是WM_PAINT的东西?这是我的代码.

#include <windows.h>

//For more makros
#include <windowsx.h>
#include "Simulatron.h"




HINSTANCE hProgramInstance;
Simulatron Exo;

char Simulatron::m_szClassName[] = "Simulatron";



Simulatron::Simulatron(HINSTANCE hInstance)
{
    m_hInstance = hInstance; // Save Instance handle
    m_wndClass.cbSize = sizeof(WNDCLASSEX); // Must always be sizeof(WNDCLASSEX)
    m_wndClass.style = CS_DBLCLKS; // Class styles  
    m_wndClass.lpfnWndProc = MainWndProc; // Pointer to callback procedure
    m_wndClass.cbClsExtra = 0; // Extra bytes to allocate following the wndclassex structure
    m_wndClass.cbWndExtra = 0; // Extra bytes to allocate following an instance of the structure
    m_wndClass.hInstance …
Run Code Online (Sandbox Code Playgroud)

c++ winapi bitmap win32gui

1
推荐指数
1
解决办法
72
查看次数

getValueAt AbstractTableModel Java的方法

我需要一些getValue方法的帮助

我正在读取文件并将值存储在

 public List<Object[]> students;
Run Code Online (Sandbox Code Playgroud)

现在我想将所有这些值添加到我的JTable中

 @Override
    public Object getValueAt(int row, int col) {
        //return data[row][col];
        // Here I have to get data from students
    }
Run Code Online (Sandbox Code Playgroud)

通常从很多例子中我看到他们Object[][] data用来做这种事情,这可能是这样的

//return data[row][col];
Run Code Online (Sandbox Code Playgroud)

但是因为我从我想要的文件中读取 List<Object[]> students;

任何想法如何在getValueAt方法中实现它?

我的解决方案就是这个

@Override
    public Object getValueAt(int row, int col) {
        //return data[row][col];
        for(Object[] j: students)
        {
            return j[col];
        }
        return null;
    }
Run Code Online (Sandbox Code Playgroud)

但这只会占用第一个对象,并将分配给我的JTable中的所有行

java swing jtable abstracttablemodel

0
推荐指数
1
解决办法
1342
查看次数